supported functions; renamed a few things package to backend
@ -51,17 +51,17 @@ const examples = PlotExample[
|
|||||||
[:(heatmap(randn(10000),randn(10000); nbins=100))]),
|
[:(heatmap(randn(10000),randn(10000); nbins=100))]),
|
||||||
PlotExample("Suported line types",
|
PlotExample("Suported line types",
|
||||||
"All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)",
|
"All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)",
|
||||||
[:(types = intersect(supportedTypes(), [:line, :orderedline, :path, :step, :stepinverted, :sticks, :scatter])),
|
[:(types = intersect(supportedTypes(), [:line, :step, :stepinverted, :sticks, :scatter])),
|
||||||
:(n = length(types)),
|
:(n = length(types)),
|
||||||
:(x = Vector[sort(rand(20)) for i in 1:n]),
|
:(x = Vector[sort(rand(20)) for i in 1:n]),
|
||||||
:(y = rand(20,n)),
|
:(y = rand(20,n)),
|
||||||
:(plot(x, y; linetype=:auto, labels=map(string,types)))]),
|
:(plot(x, y; linetypes=types, labels=map(string,types)))]),
|
||||||
PlotExample("Supported line styles",
|
PlotExample("Supported line styles",
|
||||||
"All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)",
|
"All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)",
|
||||||
[:(styles = supportedStyles()), :(plot(rand(20,length(styles)); linestyle=:auto, labels=map(string,styles)))]),
|
[:(styles = setdiff(supportedStyles(), [:auto])), :(plot(rand(20,length(styles)); linestyle=:auto, labels=map(string,styles)))]),
|
||||||
PlotExample("Supported marker types",
|
PlotExample("Supported marker types",
|
||||||
"All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)",
|
"All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)",
|
||||||
[:(markers = supportedMarkers()), :(plot([fill(i,10) for i=1:length(markers)]; marker=:auto, labels=map(string,markers), markersize=10))]),
|
[:(markers = setdiff(supportedMarkers(), [:none,:auto])), :(plot([fill(i,10) for i=1:length(markers)]; marker=:auto, labels=map(string,markers), markersize=10))]),
|
||||||
PlotExample("Bar",
|
PlotExample("Bar",
|
||||||
"x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)",
|
"x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)",
|
||||||
[:(bar(randn(1000)))]),
|
[:(bar(randn(1000)))]),
|
||||||
@ -91,7 +91,7 @@ const examples = PlotExample[
|
|||||||
function generate_markdown(pkgname::Symbol)
|
function generate_markdown(pkgname::Symbol)
|
||||||
|
|
||||||
# set up the plotter, and don't show the plots by default
|
# set up the plotter, and don't show the plots by default
|
||||||
plotter!(pkgname)
|
pkg = plotter!(pkgname)
|
||||||
# plotDefault!(:show, false)
|
# plotDefault!(:show, false)
|
||||||
|
|
||||||
# mkdir if necessary
|
# mkdir if necessary
|
||||||
@ -102,6 +102,15 @@ function generate_markdown(pkgname::Symbol)
|
|||||||
# open the markdown file
|
# open the markdown file
|
||||||
md = open("$DOCDIR/$(pkgname)_examples.md", "w")
|
md = open("$DOCDIR/$(pkgname)_examples.md", "w")
|
||||||
|
|
||||||
|
write(md, "# Examples for backend: $pkgname\n\n")
|
||||||
|
write(md, "- Supported arguments: $(supportedArgs(pkg))\n")
|
||||||
|
write(md, "- Supported values for axis: $(supportedAxes(pkg))\n")
|
||||||
|
write(md, "- Supported values for linetype: $(supportedTypes(pkg))\n")
|
||||||
|
write(md, "- Supported values for linestyle: $(supportedStyles(pkg))\n")
|
||||||
|
write(md, "- Supported values for marker: $(supportedMarkers(pkg))\n")
|
||||||
|
write(md, "- Is `subplot`/`subplot!` supported? $(subplotSupported(pkg) ? "Yes" : "No")\n\n")
|
||||||
|
|
||||||
|
|
||||||
for (i,example) in enumerate(examples)
|
for (i,example) in enumerate(examples)
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -147,6 +156,10 @@ end
|
|||||||
function test_all_examples(pkgname::Symbol)
|
function test_all_examples(pkgname::Symbol)
|
||||||
plts = Dict()
|
plts = Dict()
|
||||||
for i in 1:length(examples)
|
for i in 1:length(examples)
|
||||||
|
if examples[i].header == "Subplots" && !subplotSupported()
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
try
|
try
|
||||||
plt = test_example(pkgname, i)
|
plt = test_example(pkgname, i)
|
||||||
plts[i] = plt
|
plts[i] = plt
|
||||||
|
|||||||
@ -1,3 +1,12 @@
|
|||||||
|
# Examples for backend: gadfly
|
||||||
|
|
||||||
|
- Supported arguments: [:args,:axis,:color,:fillto,:heatmap_c,:kwargs,:label,:legend,:linestyle,:linetype,:marker,:markercolor,:markersize,:nbins,:reg,:size,:title,:width,:windowtitle,:xlabel,:ylabel,:yrightlabel]
|
||||||
|
- Supported values for axis: [:left]
|
||||||
|
- Supported values for linetype: [:line,:step,:sticks,:scatter,:heatmap,:hexbin,:hist,:bar]
|
||||||
|
- Supported values for linestyle: [:solid]
|
||||||
|
- Supported values for marker: [:rect,:ellipse,:diamond,:cross]
|
||||||
|
- Is `subplot`/`subplot!` supported? Yes
|
||||||
|
|
||||||
### Lines
|
### Lines
|
||||||
|
|
||||||
A simple line plot of the 3 columns.
|
A simple line plot of the 3 columns.
|
||||||
@ -10,7 +19,7 @@ plot(rand(100,3))
|
|||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
|
|
||||||
Plot multiple functions.
|
Plot multiple functions. You can also put the function first.
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(0:0.01:4π,[sin,cos])
|
plot(0:0.01:4π,[sin,cos])
|
||||||
@ -30,7 +39,7 @@ plot([sin,cos],0,4π)
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
Or make a parametric plot with plot(fx, fy, umin, umax).
|
Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, umax).
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
||||||
@ -54,7 +63,7 @@ plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RG
|
|||||||
|
|
||||||
Use the `axis` or `axiss` arguments.
|
Use the `axis` or `axiss` arguments.
|
||||||
|
|
||||||
Note: This is only supported with Qwt right now
|
Note: Currently only supported with Qwt and PyPlot
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
|
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
|
||||||
@ -102,31 +111,34 @@ heatmap(randn(10000),randn(10000); nbins=100)
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Lots of line types
|
### Suported line types
|
||||||
|
|
||||||
Options: (:line, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
|
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
|
||||||
Note: some may not work with all backends
|
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(rand(20,4); linetypes=[:line,:step,:sticks,:scatter],labels=["line","step","sticks","dots"])
|
types = intersect(supportedTypes(),[:line,:orderedline,:path,:step,:stepinverted,:sticks,:scatter])
|
||||||
|
n = length(types)
|
||||||
|
x = Vector[sort(rand(20)) for i = 1:n]
|
||||||
|
y = rand(20,n)
|
||||||
|
plot(x,y; linetype=:auto,labels=map(string,types))
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Lots of line styles
|
### Supported line styles
|
||||||
|
|
||||||
Options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
|
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
|
||||||
Note: some may not work with all backends
|
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(rand(20,5); linestyles=[:solid,:dash,:dot,:dashdot,:dashdotdot],labels=["solid","dash","dot","dashdot","dashdotdot"])
|
styles = supportedStyles()
|
||||||
|
plot(rand(20,length(styles)); linestyle=:auto,labels=map(string,styles))
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Lots of marker types
|
### Supported marker types
|
||||||
|
|
||||||
|
|
||||||
|
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
markers = supportedMarkers()
|
markers = supportedMarkers()
|
||||||
@ -155,3 +167,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,:scatter,: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)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```julia
|
||||||
|
subplot!(randn(100,3))
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,12 @@
|
|||||||
|
# Examples for backend: qwt
|
||||||
|
|
||||||
|
- Supported arguments: [:args,:axis,:color,:fillto,:heatmap_c,:kwargs,:label,:legend,:linestyle,:linetype,:marker,:markercolor,:markersize,:nbins,:reg,:size,:title,:width,:windowtitle,:xlabel,:ylabel,:yrightlabel]
|
||||||
|
- Supported values for axis: [:auto,:left,:right]
|
||||||
|
- Supported values for linetype: [:none,:line,:step,:stepinverted,:sticks,:scatter,:heatmap,:hexbin,:hist,:bar]
|
||||||
|
- Supported values for linestyle: [:auto,:solid,:dash,:dot,:dashdot,:dashdotdot]
|
||||||
|
- Supported values for marker: [:none,:auto,:ellipse,:rect,:diamond,:utriangle,:dtriangle,:cross,:xcross,:star1,:star2,:hexagon]
|
||||||
|
- Is `subplot`/`subplot!` supported? Yes
|
||||||
|
|
||||||
### Lines
|
### Lines
|
||||||
|
|
||||||
A simple line plot of the 3 columns.
|
A simple line plot of the 3 columns.
|
||||||
@ -10,7 +19,7 @@ plot(rand(100,3))
|
|||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
|
|
||||||
Plot multiple functions.
|
Plot multiple functions. You can also put the function first.
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(0:0.01:4π,[sin,cos])
|
plot(0:0.01:4π,[sin,cos])
|
||||||
@ -30,7 +39,7 @@ plot([sin,cos],0,4π)
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
Or make a parametric plot with plot(fx, fy, umin, umax).
|
Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, umax).
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
||||||
@ -54,7 +63,7 @@ plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RG
|
|||||||
|
|
||||||
Use the `axis` or `axiss` arguments.
|
Use the `axis` or `axiss` arguments.
|
||||||
|
|
||||||
Note: This is only supported with Qwt right now
|
Note: Currently only supported with Qwt and PyPlot
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
|
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
|
||||||
@ -102,35 +111,38 @@ heatmap(randn(10000),randn(10000); nbins=100)
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Lots of line types
|
### Suported line types
|
||||||
|
|
||||||
Options: (:line, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
|
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
|
||||||
Note: some may not work with all backends
|
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(rand(20,4); linetypes=[:line,:step,:sticks,:scatter],labels=["line","step","sticks","dots"])
|
types = intersect(supportedTypes(),[:line,:step,:stepinverted,:sticks,:scatter])
|
||||||
|
n = length(types)
|
||||||
|
x = Vector[sort(rand(20)) for i = 1:n]
|
||||||
|
y = rand(20,n)
|
||||||
|
plot(x,y; linetype=:auto,labels=map(string,types))
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Lots of line styles
|
### Supported line styles
|
||||||
|
|
||||||
Options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
|
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
|
||||||
Note: some may not work with all backends
|
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(rand(20,5); linestyles=[:solid,:dash,:dot,:dashdot,:dashdotdot],labels=["solid","dash","dot","dashdot","dashdotdot"])
|
styles = setdiff(supportedStyles(),[:auto])
|
||||||
|
plot(rand(20,length(styles)); linestyle=:auto,labels=map(string,styles))
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Lots of marker types
|
### Supported marker types
|
||||||
|
|
||||||
Options: (:none, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
|
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
|
||||||
Note: some may not work with all backends
|
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(repmat(collect(1:10)',10,1); markers=[:ellipse,:rect,:diamond,:utriangle,:dtriangle,:cross,:xcross,:star1,:star2,:hexagon],labels=["ellipse","rect","diamond","utriangle","dtriangle","cross","xcross","star1","star2","hexagon"],linetype=:none,markersize=10)
|
markers = setdiff(supportedMarkers(),[:none,:auto])
|
||||||
|
plot([fill(i,10) for i = 1:length(markers)]; marker=:auto,labels=map(string,markers),markersize=10)
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 31 KiB |
29
src/args.jl
@ -9,11 +9,16 @@ const TYPES = [:line, :step, :stepinverted, :sticks, :scatter, :heatmap, :hexbin
|
|||||||
const STYLES = [:solid, :dash, :dot, :dashdot, :dashdotdot]
|
const STYLES = [:solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
const MARKERS = [:ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon]
|
const MARKERS = [:ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon]
|
||||||
|
|
||||||
supportedAxes(::PlottingPackage) = AXES
|
const ALL_AXES = vcat(:auto, AXES)
|
||||||
supportedTypes(::PlottingPackage) = TYPES
|
const ALL_TYPES = vcat(:none, TYPES)
|
||||||
supportedStyles(::PlottingPackage) = STYLES
|
const ALL_STYLES = vcat(:auto, STYLES)
|
||||||
supportedMarkers(::PlottingPackage) = MARKERS
|
const ALL_MARKERS = vcat(:none, :auto, MARKERS)
|
||||||
subplotSupported(::GadflyPackage) = true
|
|
||||||
|
supportedAxes(::PlottingPackage) = ALL_AXES
|
||||||
|
supportedTypes(::PlottingPackage) = ALL_TYPES
|
||||||
|
supportedStyles(::PlottingPackage) = ALL_STYLES
|
||||||
|
supportedMarkers(::PlottingPackage) = ALL_MARKERS
|
||||||
|
subplotSupported(::PlottingPackage) = true
|
||||||
|
|
||||||
supportedAxes() = supportedAxes(plotter())
|
supportedAxes() = supportedAxes(plotter())
|
||||||
supportedTypes() = supportedTypes(plotter())
|
supportedTypes() = supportedTypes(plotter())
|
||||||
@ -78,6 +83,8 @@ makeplural(s::Symbol) = Symbol(string(s,"s"))
|
|||||||
autopick(arr::AVec, idx::Integer) = arr[mod1(idx,length(arr))]
|
autopick(arr::AVec, idx::Integer) = arr[mod1(idx,length(arr))]
|
||||||
autopick(notarr, idx::Integer) = notarr
|
autopick(notarr, idx::Integer) = notarr
|
||||||
|
|
||||||
|
autopick_ignore_none_auto(arr::AVec, idx::Integer) = autopick(setdiff(arr, [:none, :auto]), idx)
|
||||||
|
autopick_ignore_none_auto(notarr, idx::Integer) = notarr
|
||||||
|
|
||||||
# converts a symbol or string into a colorant (Colors.RGB), and assigns a color automatically
|
# converts a symbol or string into a colorant (Colors.RGB), and assigns a color automatically
|
||||||
# note: if plt is nothing, we aren't doing anything with the color anyways
|
# note: if plt is nothing, we aren't doing anything with the color anyways
|
||||||
@ -146,16 +153,16 @@ function getPlotKeywordArgs(pkg::PlottingPackage, kw, idx::Int, n::Int)
|
|||||||
# auto-pick
|
# auto-pick
|
||||||
if n > 0
|
if n > 0
|
||||||
if d[:axis] == :auto
|
if d[:axis] == :auto
|
||||||
d[:axis] = autopick(supportedAxes(pkg), n)
|
d[:axis] = autopick_ignore_none_auto(supportedAxes(pkg), n)
|
||||||
end
|
|
||||||
if d[:linetype] == :auto
|
|
||||||
d[:linetype] = autopick(supportedTypes(pkg), n)
|
|
||||||
end
|
end
|
||||||
|
# if d[:linetype] == :auto
|
||||||
|
# d[:linetype] = autopick_ignore_none_auto(supportedTypes(pkg), n)
|
||||||
|
# end
|
||||||
if d[:linestyle] == :auto
|
if d[:linestyle] == :auto
|
||||||
d[:linestyle] = autopick(supportedStyles(pkg), n)
|
d[:linestyle] = autopick_ignore_none_auto(supportedStyles(pkg), n)
|
||||||
end
|
end
|
||||||
if d[:marker] == :auto
|
if d[:marker] == :auto
|
||||||
d[:marker] = autopick(supportedMarkers(pkg), n)
|
d[:marker] = autopick_ignore_none_auto(supportedMarkers(pkg), n)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -6,11 +6,11 @@ immutable GadflyPackage <: PlottingPackage end
|
|||||||
gadfly!() = plotter!(:gadfly)
|
gadfly!() = plotter!(:gadfly)
|
||||||
|
|
||||||
|
|
||||||
suppportedArgs(::GadflyPackage) = setdiff(ARGS, [:heatmap_c, :fillto, :pos])
|
suppportedArgs(::GadflyPackage) = setdiff(ALL_ARGS, [:heatmap_c, :fillto, :pos])
|
||||||
supportedAxes(::GadflyPackage) = [:left]
|
supportedAxes(::GadflyPackage) = setdiff(ALL_AXES, [:right])
|
||||||
supportedTypes(::GadflyPackage) = setdiff(TYPES, [:stepinverted])
|
supportedTypes(::GadflyPackage) = setdiff(TYPES, [:stepinverted])
|
||||||
supportedStyles(::GadflyPackage) = [:solid]
|
supportedStyles(::GadflyPackage) = [:auto, :solid]
|
||||||
supportedMarkers(::GadflyPackage) = [:rect, :ellipse, :diamond, :cross]
|
supportedMarkers(::GadflyPackage) = [:none, :auto, :rect, :ellipse, :diamond, :cross]
|
||||||
|
|
||||||
|
|
||||||
include("gadfly_shapes.jl")
|
include("gadfly_shapes.jl")
|
||||||
|
|||||||
@ -6,7 +6,7 @@ immutable ImmersePackage <: PlottingPackage end
|
|||||||
immerse!() = plotter!(:immerse)
|
immerse!() = plotter!(:immerse)
|
||||||
|
|
||||||
|
|
||||||
suppportedArgs(::ImmersePackage) = setdiff(ARGS, [:heatmap_c, :fillto, :pos])
|
suppportedArgs(::ImmersePackage) = suppportedArgs(GadflyPackage())
|
||||||
supportedAxes(::ImmersePackage) = supportedAxes(GadflyPackage())
|
supportedAxes(::ImmersePackage) = supportedAxes(GadflyPackage())
|
||||||
supportedTypes(::ImmersePackage) = supportedTypes(GadflyPackage())
|
supportedTypes(::ImmersePackage) = supportedTypes(GadflyPackage())
|
||||||
supportedStyles(::ImmersePackage) = supportedStyles(GadflyPackage())
|
supportedStyles(::ImmersePackage) = supportedStyles(GadflyPackage())
|
||||||
|
|||||||
@ -7,11 +7,12 @@ pyplot!() = plotter!(:pyplot)
|
|||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
suppportedArgs(::PyPlotPackage) = setdiff(ARGS, [:reg, :heatmap_c, :fillto, :pos])
|
suppportedArgs(::PyPlotPackage) = setdiff(ALL_ARGS, [:reg, :heatmap_c, :fillto, :pos])
|
||||||
# supportedAxes(::PyPlotPackage) = [:left]
|
# supportedAxes(::PyPlotPackage) = [:left]
|
||||||
# supportedTypes(::PyPlotPackage) = setdiff(TYPES, [:stepinverted])
|
# supportedTypes(::PyPlotPackage) = setdiff(TYPES, [:stepinverted])
|
||||||
supportedStyles(::PyPlotPackage) = [:solid,:dash,:dot,:dashdot]
|
supportedStyles(::PyPlotPackage) = setdiff(ALL_STYLES, [:dashdotdot])
|
||||||
supportedMarkers(::PyPlotPackage) = [:rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :hexagon]
|
supportedMarkers(::PyPlotPackage) = setdiff(ALL_MARKERS, [:star2])
|
||||||
|
subplotSupported(::PyPlotPackage) = false
|
||||||
|
|
||||||
# convert colorant to 4-tuple RGBA
|
# convert colorant to 4-tuple RGBA
|
||||||
getPyPlotColor(c::Colorant) = map(f->float(f(c)), (red, green, blue, alpha))
|
getPyPlotColor(c::Colorant) = map(f->float(f(c)), (red, green, blue, alpha))
|
||||||
@ -180,7 +181,7 @@ function plot!(::PyPlotPackage, plt::Plot; kw...)
|
|||||||
extraargs[:label] = d[:label]
|
extraargs[:label] = d[:label]
|
||||||
|
|
||||||
# do the plot
|
# do the plot
|
||||||
@show lt
|
# @show lt
|
||||||
if lt == :hist
|
if lt == :hist
|
||||||
d[:serieshandle] = plotfunc(d[:y]; extraargs...)[1]
|
d[:serieshandle] = plotfunc(d[:y]; extraargs...)[1]
|
||||||
elseif lt in (:scatter, :heatmap, :hexbin)
|
elseif lt in (:scatter, :heatmap, :hexbin)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ supportedAxes(::[PkgName]Package) = AXES
|
|||||||
supportedTypes(::[PkgName]Package) = TYPES
|
supportedTypes(::[PkgName]Package) = TYPES
|
||||||
supportedStyles(::[PkgName]Package) = STYLES
|
supportedStyles(::[PkgName]Package) = STYLES
|
||||||
supportedMarkers(::[PkgName]Package) = MARKERS
|
supportedMarkers(::[PkgName]Package) = MARKERS
|
||||||
|
subplotSupported(::[PkgName]Package) = false
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,11 @@ unicodeplots!() = plotter!(:unicodeplots)
|
|||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
suppportedArgs(::GadflyPackage) = setdiff(ARGS, [:reg, :heatmap_c, :fillto, :pos])
|
suppportedArgs(::UnicodePlotsPackage) = setdiff(ALL_ARGS, [:reg, :heatmap_c, :fillto, :pos])
|
||||||
supportedAxes(::GadflyPackage) = [:left]
|
supportedAxes(::UnicodePlotsPackage) = [:auto, :left]
|
||||||
supportedTypes(::GadflyPackage) = setdiff(TYPES, [:stepinverted])
|
supportedTypes(::UnicodePlotsPackage) = setdiff(ALL_TYPES, [:stepinverted])
|
||||||
supportedStyles(::GadflyPackage) = [:solid]
|
supportedStyles(::UnicodePlotsPackage) = [:auto, :solid]
|
||||||
supportedMarkers(::GadflyPackage) = [:ellipse]
|
supportedMarkers(::UnicodePlotsPackage) = [:none, :auto, :ellipse]
|
||||||
|
|
||||||
|
|
||||||
function expandLimits!(lims, x)
|
function expandLimits!(lims, x)
|
||||||
|
|||||||
@ -21,12 +21,12 @@ Base.display(pkg::PlottingPackage, subplt::Subplot) = error("display($pkg, subpl
|
|||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
const AVAILABLE_PACKAGES = [:qwt, :gadfly, :unicodeplots, :pyplot, :immerse]
|
const BACKENDS = [:qwt, :gadfly, :unicodeplots, :pyplot, :immerse]
|
||||||
const INITIALIZED_PACKAGES = Set{Symbol}()
|
const INITIALIZED_BACKENDS = Set{Symbol}()
|
||||||
backends() = AVAILABLE_PACKAGES
|
backends() = BACKENDS
|
||||||
|
|
||||||
|
|
||||||
function getPlottingPackage(sym::Symbol)
|
function backend(sym::Symbol)
|
||||||
sym == :qwt && return QwtPackage()
|
sym == :qwt && return QwtPackage()
|
||||||
sym == :gadfly && return GadflyPackage()
|
sym == :gadfly && return GadflyPackage()
|
||||||
sym == :unicodeplots && return UnicodePlotsPackage()
|
sym == :unicodeplots && return UnicodePlotsPackage()
|
||||||
@ -36,40 +36,40 @@ function getPlottingPackage(sym::Symbol)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
type CurrentPackage
|
type CurrentBackend
|
||||||
sym::Symbol
|
sym::Symbol
|
||||||
pkg::PlottingPackage
|
pkg::PlottingPackage
|
||||||
end
|
end
|
||||||
CurrentPackage(sym::Symbol) = CurrentPackage(sym, getPlottingPackage(sym))
|
CurrentBackend(sym::Symbol) = CurrentBackend(sym, backend(sym))
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
function pickDefaultBackend()
|
function pickDefaultBackend()
|
||||||
try
|
try
|
||||||
Pkg.installed("Immerse")
|
Pkg.installed("Immerse")
|
||||||
return CurrentPackage(:immerse)
|
return CurrentBackend(:immerse)
|
||||||
end
|
end
|
||||||
try
|
try
|
||||||
Pkg.installed("Qwt")
|
Pkg.installed("Qwt")
|
||||||
return CurrentPackage(:qwt)
|
return CurrentBackend(:qwt)
|
||||||
end
|
end
|
||||||
try
|
try
|
||||||
Pkg.installed("PyPlot")
|
Pkg.installed("PyPlot")
|
||||||
return CurrentPackage(:pyplot)
|
return CurrentBackend(:pyplot)
|
||||||
end
|
end
|
||||||
try
|
try
|
||||||
Pkg.installed("Gadfly")
|
Pkg.installed("Gadfly")
|
||||||
return CurrentPackage(:gadfly)
|
return CurrentBackend(:gadfly)
|
||||||
end
|
end
|
||||||
try
|
try
|
||||||
Pkg.installed("UnicodePlots")
|
Pkg.installed("UnicodePlots")
|
||||||
return CurrentPackage(:unicodeplots)
|
return CurrentBackend(:unicodeplots)
|
||||||
end
|
end
|
||||||
warn("You don't have any of the supported backends installed! Chose from ", backends())
|
warn("You don't have any of the supported backends installed! Chose from ", backends())
|
||||||
return CurrentPackage(:gadfly)
|
return CurrentBackend(:gadfly)
|
||||||
end
|
end
|
||||||
const CURRENT_PACKAGE = pickDefaultBackend()
|
const CURRENT_BACKEND = pickDefaultBackend()
|
||||||
println("[Plots.jl] Default backend: ", CURRENT_PACKAGE.sym)
|
println("[Plots.jl] Default backend: ", CURRENT_BACKEND.sym)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
@ -79,12 +79,12 @@ Returns the current plotting package name. Initializes package on first call.
|
|||||||
"""
|
"""
|
||||||
function plotter()
|
function plotter()
|
||||||
|
|
||||||
currentPackageSymbol = CURRENT_PACKAGE.sym
|
currentBackendSymbol = CURRENT_BACKEND.sym
|
||||||
if !(currentPackageSymbol in INITIALIZED_PACKAGES)
|
if !(currentBackendSymbol in INITIALIZED_BACKENDS)
|
||||||
|
|
||||||
# initialize
|
# initialize
|
||||||
println("[Plots.jl] Initializing package: ", CURRENT_PACKAGE.sym)
|
println("[Plots.jl] Initializing package: ", CURRENT_BACKEND.sym)
|
||||||
if currentPackageSymbol == :qwt
|
if currentBackendSymbol == :qwt
|
||||||
try
|
try
|
||||||
@eval import Qwt
|
@eval import Qwt
|
||||||
@eval export Qwt
|
@eval export Qwt
|
||||||
@ -92,7 +92,7 @@ function plotter()
|
|||||||
error("Couldn't import Qwt. Install it with: Pkg.clone(\"https://github.com/tbreloff/Qwt.jl.git\")\n (Note: also requires pyqt and pyqwt)")
|
error("Couldn't import Qwt. Install it with: Pkg.clone(\"https://github.com/tbreloff/Qwt.jl.git\")\n (Note: also requires pyqt and pyqwt)")
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif currentPackageSymbol == :gadfly
|
elseif currentBackendSymbol == :gadfly
|
||||||
try
|
try
|
||||||
@eval import Gadfly, Compose
|
@eval import Gadfly, Compose
|
||||||
@eval export Gadfly, Compose
|
@eval export Gadfly, Compose
|
||||||
@ -100,7 +100,7 @@ function plotter()
|
|||||||
error("Couldn't import Gadfly. Install it with: Pkg.add(\"Gadfly\")")
|
error("Couldn't import Gadfly. Install it with: Pkg.add(\"Gadfly\")")
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif currentPackageSymbol == :unicodeplots
|
elseif currentBackendSymbol == :unicodeplots
|
||||||
try
|
try
|
||||||
@eval import UnicodePlots
|
@eval import UnicodePlots
|
||||||
@eval export UnicodePlots
|
@eval export UnicodePlots
|
||||||
@ -108,7 +108,7 @@ function plotter()
|
|||||||
error("Couldn't import UnicodePlots. Install it with: Pkg.add(\"UnicodePlots\")")
|
error("Couldn't import UnicodePlots. Install it with: Pkg.add(\"UnicodePlots\")")
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif currentPackageSymbol == :pyplot
|
elseif currentBackendSymbol == :pyplot
|
||||||
try
|
try
|
||||||
@eval import PyPlot
|
@eval import PyPlot
|
||||||
@eval export PyPlot
|
@eval export PyPlot
|
||||||
@ -116,7 +116,7 @@ function plotter()
|
|||||||
error("Couldn't import PyPlot. Install it with: Pkg.add(\"PyPlot\")")
|
error("Couldn't import PyPlot. Install it with: Pkg.add(\"PyPlot\")")
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif currentPackageSymbol == :immerse
|
elseif currentBackendSymbol == :immerse
|
||||||
try
|
try
|
||||||
@eval import Immerse, Gadfly, Compose, Gtk
|
@eval import Immerse, Gadfly, Compose, Gtk
|
||||||
@eval export Immerse, Gadfly, Compose, Gtk
|
@eval export Immerse, Gadfly, Compose, Gtk
|
||||||
@ -125,13 +125,13 @@ function plotter()
|
|||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
error("Unknown plotter $currentPackageSymbol. Choose from: $AVAILABLE_PACKAGES")
|
error("Unknown plotter $currentBackendSymbol. Choose from: $BACKENDS")
|
||||||
end
|
end
|
||||||
push!(INITIALIZED_PACKAGES, currentPackageSymbol)
|
push!(INITIALIZED_BACKENDS, currentBackendSymbol)
|
||||||
println("[Plots.jl] done.")
|
println("[Plots.jl] done.")
|
||||||
|
|
||||||
end
|
end
|
||||||
CURRENT_PACKAGE.pkg
|
CURRENT_BACKEND.pkg
|
||||||
end
|
end
|
||||||
|
|
||||||
doc"""
|
doc"""
|
||||||
@ -141,22 +141,22 @@ function plotter!(modname)
|
|||||||
|
|
||||||
# set the PlottingPackage
|
# set the PlottingPackage
|
||||||
if modname == :qwt
|
if modname == :qwt
|
||||||
CURRENT_PACKAGE.pkg = QwtPackage()
|
CURRENT_BACKEND.pkg = QwtPackage()
|
||||||
elseif modname == :gadfly
|
elseif modname == :gadfly
|
||||||
CURRENT_PACKAGE.pkg = GadflyPackage()
|
CURRENT_BACKEND.pkg = GadflyPackage()
|
||||||
elseif modname == :unicodeplots
|
elseif modname == :unicodeplots
|
||||||
CURRENT_PACKAGE.pkg = UnicodePlotsPackage()
|
CURRENT_BACKEND.pkg = UnicodePlotsPackage()
|
||||||
elseif modname == :pyplot
|
elseif modname == :pyplot
|
||||||
CURRENT_PACKAGE.pkg = PyPlotPackage()
|
CURRENT_BACKEND.pkg = PyPlotPackage()
|
||||||
elseif modname == :immerse
|
elseif modname == :immerse
|
||||||
CURRENT_PACKAGE.pkg = ImmersePackage()
|
CURRENT_BACKEND.pkg = ImmersePackage()
|
||||||
else
|
else
|
||||||
error("Unknown plotter $modname. Choose from: $AVAILABLE_PACKAGES")
|
error("Unknown plotter $modname. Choose from: $BACKENDS")
|
||||||
end
|
end
|
||||||
|
|
||||||
# update the symbol
|
# update the symbol
|
||||||
CURRENT_PACKAGE.sym = modname
|
CURRENT_BACKEND.sym = modname
|
||||||
|
|
||||||
# return the package
|
# return the package
|
||||||
CURRENT_PACKAGE.pkg
|
CURRENT_BACKEND.pkg
|
||||||
end
|
end
|
||||||
|
|||||||
@ -102,6 +102,10 @@ end
|
|||||||
|
|
||||||
# # this adds to a specific subplot... most plot commands will flow through here
|
# # this adds to a specific subplot... most plot commands will flow through here
|
||||||
function subplot!(subplt::Subplot, args...; kw...)
|
function subplot!(subplt::Subplot, args...; kw...)
|
||||||
|
if !subplotSupported()
|
||||||
|
error(CURRENT_BACKEND.sym, " does not support the subplot/subplot! commands at this time. Try one of: ", join(filter(pkg->subplotSupported(backend(pkg)), backends()),", "))
|
||||||
|
end
|
||||||
|
|
||||||
kwList = createKWargsList(subplt, args...; kw...)
|
kwList = createKWargsList(subplt, args...; kw...)
|
||||||
for (i,d) in enumerate(kwList)
|
for (i,d) in enumerate(kwList)
|
||||||
subplt.n += 1
|
subplt.n += 1
|
||||||
|
|||||||