This commit is contained in:
Thomas Breloff 2015-09-10 16:04:54 -04:00
parent c7d76a1f27
commit 3d3c50b2f5
2 changed files with 17 additions and 16 deletions

View File

@ -17,36 +17,23 @@ First, clone the package, and get any plotting packages you need:
``` ```
Pkg.clone("https://github.com/tbreloff/Plots.jl.git") Pkg.clone("https://github.com/tbreloff/Plots.jl.git")
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git") # [optional] requires pyqt and pyqwt
Pkg.add("Gadfly") # [optional] Pkg.add("Gadfly") # [optional]
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git") # [optional] requires pyqt and pyqwt
``` ```
## Use ## Use
Load it in. The underlying plotting backends are not imported until `plotter()` is called (which happens Load it in. The underlying plotting backends are not imported until `plotter()` is called (which happens
on your first call to `plot`). This means that you don't need any backends to be installed when you call `using Plots`. on your first call to `plot`). This means that you don't need any backends to be installed when you call `using Plots`.
For now, the default backend is Qwt. For now, the default backend is Gadfly.
``` ```
using Plots using Plots
``` ```
Do a plot in Qwt, then save a png:
```
plot(rand(10,2); marker = :rect)
savepng(Plots.IMG_DIR * "qwt1.png")
```
which saves:
![qwt_plt](img/qwt1.png)
Do a plot in Gadfly, then save a png: Do a plot in Gadfly, then save a png:
``` ```
plotter!(:gadfly) # switches the backend to Gadfly
plot(rand(10,2); marker = :rect) plot(rand(10,2); marker = :rect)
savepng(Plots.IMG_DIR * "gadfly1.png") savepng(Plots.IMG_DIR * "gadfly1.png")
``` ```
@ -56,6 +43,19 @@ which saves:
![gadfly_plt](img/gadfly1.png) ![gadfly_plt](img/gadfly1.png)
Do a plot in Qwt, then save a png:
```
plotter!(:qwt) # switches the backend to Qwt
plot(rand(10,2); marker = :rect)
savepng(Plots.IMG_DIR * "qwt1.png")
```
which saves:
![qwt_plt](img/qwt1.png)
## plot and plotter! interface (WIP) ## plot and plotter! interface (WIP)

View File

@ -14,7 +14,8 @@ type CurrentPackage
sym::Symbol sym::Symbol
pkg::PlottingPackage pkg::PlottingPackage
end end
const CURRENT_PACKAGE = CurrentPackage(:qwt, QwtPackage()) # const CURRENT_PACKAGE = CurrentPackage(:qwt, QwtPackage())
const CURRENT_PACKAGE = CurrentPackage(:gadfly, GadflyPackage())
doc""" doc"""