subplot fixes and examples
@ -49,6 +49,23 @@ const examples = PlotExample[
|
||||
PlotExample("Histogram",
|
||||
"note: fillto isn't supported on all backends",
|
||||
[:(histogram(randn(1000); nbins=50, fillto=20))]),
|
||||
PlotExample("Subplots",
|
||||
"""
|
||||
subplot and subplot! are distinct commands which create many plots and add series to them in a circular fashion.
|
||||
You can define the layout with keyword params... either set the number of plots `n` (and optionally number of rows `nr` or
|
||||
number of columns `nc`), or you can set the layout directly with `layout`.
|
||||
|
||||
Note: Gadfly is not very friendly here, and although you can create a plot and save a PNG, I haven't been able to actually display it.
|
||||
""",
|
||||
[:(subplot(randn(100,5); layout=[1,1,3], linetypes=[:line,:hist,:dots,:step,:bar], nbins=10, legend=false))]),
|
||||
PlotExample("Adding to subplots",
|
||||
"Note here the automatic grid layout, as well as the order in which new series are added to the plots.",
|
||||
[:(subplot(randn(100,5); n=4))]),
|
||||
PlotExample("Adding to subplots (continued)",
|
||||
"",
|
||||
[:(subplot!(randn(100,3)))]),
|
||||
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
@ -100,3 +100,38 @@ histogram(randn(1000); nbins=50,fillto=20)
|
||||
|
||||

|
||||
|
||||
### Subplots
|
||||
|
||||
subplot and subplot! are distinct commands which create many plots and add series to them in a circular fashion.
|
||||
You can define the layout with keyword params... either set the number of plots `n` (and optionally number of rows `nr` or
|
||||
number of columns `nc`), or you can set the layout directly with `layout`.
|
||||
|
||||
Note: Gadfly is not very friendly here, and although you can create a plot and save a PNG, I haven't been able to actually display it.
|
||||
|
||||
|
||||
```julia
|
||||
subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:dots,:step,:bar],nbins=10,legend=false)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Adding to subplots
|
||||
|
||||
Note here the automatic grid layout, as well as the order in which new series are added to the plots.
|
||||
|
||||
```julia
|
||||
subplot(randn(100,5); n=4)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Adding to subplots (continued)
|
||||
|
||||
|
||||
|
||||
```julia
|
||||
subplot!(randn(100,3))
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
@ -100,3 +100,38 @@ histogram(randn(1000); nbins=50,fillto=20)
|
||||
|
||||

|
||||
|
||||
### Subplots
|
||||
|
||||
subplot and subplot! are distinct commands which create many plots and add series to them in a circular fashion.
|
||||
You can define the layout with keyword params... either set the number of plots `n` (and optionally number of rows `nr` or
|
||||
number of columns `nc`), or you can set the layout directly with `layout`.
|
||||
|
||||
Note: Gadfly is not very friendly here, and although you can create a plot and save a PNG, I haven't been able to actually display it.
|
||||
|
||||
|
||||
```julia
|
||||
subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:dots,:step,:bar],nbins=10,legend=false)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Adding to subplots
|
||||
|
||||
Note here the automatic grid layout, as well as the order in which new series are added to the plots.
|
||||
|
||||
```julia
|
||||
subplot(randn(100,5); n=4)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Adding to subplots (continued)
|
||||
|
||||
|
||||
|
||||
```julia
|
||||
subplot!(randn(100,3))
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
BIN
img/gadfly_example_11.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
img/gadfly_example_12.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
img/gadfly_example_13.png
Normal file
|
After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.8 KiB |
BIN
img/qwt_example_11.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
img/qwt_example_12.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
img/qwt_example_13.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
@ -12,7 +12,7 @@ export
|
||||
plotter!,
|
||||
plot!,
|
||||
subplot!,
|
||||
|
||||
|
||||
currentPlot,
|
||||
plotDefault,
|
||||
scatter,
|
||||
@ -69,7 +69,7 @@ heatmap!(args...; kw...) = plot!(args...; kw..., linetype = :heatmap)
|
||||
|
||||
|
||||
savepng(args...; kw...) = savepng(currentPlot(), args...; kw...)
|
||||
savepng(plt::Plot, args...; kw...) = savepng(plt.plotter, plt, args...; kw...)
|
||||
savepng(plt::PlottingObject, args...; kw...) = savepng(plt.plotter, plt, args...; kw...)
|
||||
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
@ -104,8 +104,9 @@ function Base.display(::GadflyPackage, plt::Plot)
|
||||
display(plt.o)
|
||||
end
|
||||
|
||||
# -------------------------------
|
||||
|
||||
function savepng(::GadflyPackage, plt::Plot, fn::String;
|
||||
function savepng(::GadflyPackage, plt::PlottingObject, fn::String;
|
||||
w = 6 * Gadfly.inch,
|
||||
h = 4 * Gadfly.inch)
|
||||
Gadfly.draw(Gadfly.PNG(fn, w, h), plt.o)
|
||||
|
||||
@ -115,7 +115,7 @@ function subplot!(subplt::Subplot, args...; kw...)
|
||||
# do we want to show it?
|
||||
d = Dict(kw)
|
||||
if haskey(d, :show) && d[:show]
|
||||
display(subplt)
|
||||
draw(subplt)
|
||||
end
|
||||
|
||||
subplt
|
||||
|
||||