added parametric plot with example
@ -26,8 +26,11 @@ const examples = PlotExample[
|
||||
"Plot multiple functions.",
|
||||
[:(plot(0:0.01:4π, [sin,cos]))]),
|
||||
PlotExample("",
|
||||
"You can also call it with (xmin, xmax).",
|
||||
"You can also call it with plot(f, xmin, xmax).",
|
||||
[:(plot([sin,cos], 0, 4π))]),
|
||||
PlotExample("",
|
||||
"Or make a parametric plot with plot(fx, fy, umin, umax).",
|
||||
[:(plot(sin, x->sin(2x), 0, 2π))]),
|
||||
PlotExample("Global",
|
||||
"Change the guides/background without a separate call.",
|
||||
[:(plot(rand(10); title="TITLE", xlabel="XLABEL", ylabel="YLABEL", background_color = RGB(0.5,0.5,0.5)))]),
|
||||
@ -120,9 +123,9 @@ end
|
||||
|
||||
# run it!
|
||||
# note: generate separately so it's easy to comment out
|
||||
# generate_markdown(:qwt)
|
||||
generate_markdown(:qwt)
|
||||
generate_markdown(:gadfly)
|
||||
# generate_markdown(:unicodeplots)
|
||||
generate_markdown(:unicodeplots)
|
||||
|
||||
|
||||
end # module
|
||||
|
||||
@ -20,7 +20,7 @@ plot(0:0.01:4π,[sin,cos])
|
||||
|
||||
###
|
||||
|
||||
You can also call it with (xmin, xmax).
|
||||
You can also call it with plot(f, xmin, xmax).
|
||||
|
||||
```julia
|
||||
plot([sin,cos],0,4π)
|
||||
@ -28,6 +28,18 @@ plot([sin,cos],0,4π)
|
||||
|
||||

|
||||
|
||||
###
|
||||
|
||||
Or make a parametric plot with plot(fx, fy, umin, umax).
|
||||
|
||||
```julia
|
||||
plot(sin,(x->begin # /Users/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
||||
sin(2x)
|
||||
end),0,2π)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Global
|
||||
|
||||
Change the guides/background without a separate call.
|
||||
@ -36,7 +48,7 @@ Change the guides/background without a separate call.
|
||||
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.5,0.5,0.5))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Two-axis
|
||||
|
||||
@ -48,7 +60,7 @@ Note: This is only supported with Qwt right now
|
||||
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Vectors w/ pluralized args
|
||||
|
||||
@ -58,7 +70,7 @@ Plot multiple series with different numbers of points. Mix arguments that apply
|
||||
plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Build plot in pieces
|
||||
|
||||
@ -68,7 +80,7 @@ Start with a base plot...
|
||||
plot(rand(100) / 3; reg=true,fillto=0)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
###
|
||||
|
||||
@ -78,7 +90,7 @@ and add to it later.
|
||||
scatter!(rand(100); markersize=6,color=:blue)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Heatmaps
|
||||
|
||||
@ -88,7 +100,7 @@ scatter!(rand(100); markersize=6,color=:blue)
|
||||
heatmap(randn(10000),randn(10000); nbins=200)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Lots of line types
|
||||
|
||||
@ -99,7 +111,7 @@ Note: some may not work with all backends
|
||||
plot(rand(20,4); linetypes=[:line,:step,:sticks,:dots],labels=["line","step","sticks","dots"])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Bar
|
||||
|
||||
@ -109,7 +121,7 @@ x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints
|
||||
bar(randn(1000))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Histogram
|
||||
|
||||
@ -119,7 +131,7 @@ note: fillto isn't supported on all backends
|
||||
histogram(randn(1000); nbins=50,fillto=20)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Subplots
|
||||
|
||||
@ -134,7 +146,7 @@ histogram(randn(1000); nbins=50,fillto=20)
|
||||
subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:dots,:step,:bar],nbins=10,legend=false)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Adding to subplots
|
||||
|
||||
@ -144,7 +156,7 @@ Note here the automatic grid layout, as well as the order in which new series ar
|
||||
subplot(randn(100,5); n=4)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
###
|
||||
|
||||
@ -154,5 +166,5 @@ subplot(randn(100,5); n=4)
|
||||
subplot!(randn(100,3))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ plot(0:0.01:4π,[sin,cos])
|
||||
|
||||
###
|
||||
|
||||
You can also call it with (xmin, xmax).
|
||||
You can also call it with plot(f, xmin, xmax).
|
||||
|
||||
```julia
|
||||
plot([sin,cos],0,4π)
|
||||
@ -28,6 +28,18 @@ plot([sin,cos],0,4π)
|
||||
|
||||

|
||||
|
||||
###
|
||||
|
||||
Or make a parametric plot with plot(fx, fy, umin, umax).
|
||||
|
||||
```julia
|
||||
plot(sin,(x->begin # /Users/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
||||
sin(2x)
|
||||
end),0,2π)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Global
|
||||
|
||||
Change the guides/background without a separate call.
|
||||
@ -36,7 +48,7 @@ Change the guides/background without a separate call.
|
||||
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.5,0.5,0.5))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Two-axis
|
||||
|
||||
@ -48,7 +60,7 @@ Note: This is only supported with Qwt right now
|
||||
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Vectors w/ pluralized args
|
||||
|
||||
@ -58,7 +70,7 @@ Plot multiple series with different numbers of points. Mix arguments that apply
|
||||
plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Build plot in pieces
|
||||
|
||||
@ -68,7 +80,7 @@ Start with a base plot...
|
||||
plot(rand(100) / 3; reg=true,fillto=0)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
###
|
||||
|
||||
@ -78,7 +90,7 @@ and add to it later.
|
||||
scatter!(rand(100); markersize=6,color=:blue)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Heatmaps
|
||||
|
||||
@ -88,7 +100,7 @@ scatter!(rand(100); markersize=6,color=:blue)
|
||||
heatmap(randn(10000),randn(10000); nbins=200)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Lots of line types
|
||||
|
||||
@ -99,7 +111,7 @@ Note: some may not work with all backends
|
||||
plot(rand(20,4); linetypes=[:line,:step,:sticks,:dots],labels=["line","step","sticks","dots"])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Bar
|
||||
|
||||
@ -109,7 +121,7 @@ x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints
|
||||
bar(randn(1000))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Histogram
|
||||
|
||||
@ -119,7 +131,7 @@ note: fillto isn't supported on all backends
|
||||
histogram(randn(1000); nbins=50,fillto=20)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Subplots
|
||||
|
||||
@ -134,7 +146,7 @@ histogram(randn(1000); nbins=50,fillto=20)
|
||||
subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:dots,:step,:bar],nbins=10,legend=false)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Adding to subplots
|
||||
|
||||
@ -144,7 +156,7 @@ Note here the automatic grid layout, as well as the order in which new series ar
|
||||
subplot(randn(100,5); n=4)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
###
|
||||
|
||||
@ -154,5 +166,5 @@ subplot(randn(100,5); n=4)
|
||||
subplot!(randn(100,3))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ plot(0:0.01:4π,[sin,cos])
|
||||
|
||||
###
|
||||
|
||||
You can also call it with (xmin, xmax).
|
||||
You can also call it with plot(f, xmin, xmax).
|
||||
|
||||
```julia
|
||||
plot([sin,cos],0,4π)
|
||||
@ -28,6 +28,18 @@ plot([sin,cos],0,4π)
|
||||
|
||||

|
||||
|
||||
###
|
||||
|
||||
Or make a parametric plot with plot(fx, fy, umin, umax).
|
||||
|
||||
```julia
|
||||
plot(sin,(x->begin # /Users/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
|
||||
sin(2x)
|
||||
end),0,2π)
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Global
|
||||
|
||||
Change the guides/background without a separate call.
|
||||
@ -36,7 +48,7 @@ Change the guides/background without a separate call.
|
||||
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.5,0.5,0.5))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Two-axis
|
||||
|
||||
@ -48,7 +60,7 @@ Note: This is only supported with Qwt right now
|
||||
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Vectors w/ pluralized args
|
||||
|
||||
@ -58,7 +70,7 @@ Plot multiple series with different numbers of points. Mix arguments that apply
|
||||
plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Build plot in pieces
|
||||
|
||||
@ -68,7 +80,7 @@ Start with a base plot...
|
||||
plot(rand(100) / 3; reg=true,fillto=0)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
###
|
||||
|
||||
@ -78,7 +90,7 @@ and add to it later.
|
||||
scatter!(rand(100); markersize=6,color=:blue)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Lots of line types
|
||||
|
||||
@ -89,7 +101,7 @@ Note: some may not work with all backends
|
||||
plot(rand(20,4); linetypes=[:line,:step,:sticks,:dots],labels=["line","step","sticks","dots"])
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Bar
|
||||
|
||||
@ -99,7 +111,7 @@ x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints
|
||||
bar(randn(1000))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Histogram
|
||||
|
||||
@ -109,7 +121,7 @@ note: fillto isn't supported on all backends
|
||||
histogram(randn(1000); nbins=50,fillto=20)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Subplots
|
||||
|
||||
@ -124,7 +136,7 @@ histogram(randn(1000); nbins=50,fillto=20)
|
||||
subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:dots,:step,:bar],nbins=10,legend=false)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Adding to subplots
|
||||
|
||||
@ -134,7 +146,7 @@ Note here the automatic grid layout, as well as the order in which new series ar
|
||||
subplot(randn(100,5); n=4)
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
###
|
||||
|
||||
@ -144,5 +156,5 @@ subplot(randn(100,5); n=4)
|
||||
subplot!(randn(100,3))
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 58 KiB |
BIN
img/gadfly/gadfly_example_16.png
Normal file
|
After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
BIN
img/qwt/qwt_example_16.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 66 KiB |
BIN
img/unicodeplots/unicodeplots_example_16.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 74 KiB |
BIN
img/unicodeplots/unicodeplots_example_9.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
10
src/plot.jl
@ -235,6 +235,16 @@ function createKWargsList(plt::PlottingObject, fs::Vector{Function}, xmin::Real,
|
||||
ret
|
||||
end
|
||||
|
||||
# create 1 series, x = fx(u), y = fy(u); u ∈ [umin, umax]
|
||||
function createKWargsList(plt::PlottingObject, fx::Function, fy::Function, umin::Real, umax::Real; kw...)
|
||||
d = getPlotKeywordArgs(kw, 1, plt.n + 1)
|
||||
width = plt.initargs[:size][1]
|
||||
u = collect(linspace(umin, umax, width)) # we don't need more than the width
|
||||
d[:x] = map(fx, u)
|
||||
d[:y] = map(fy, u)
|
||||
[d]
|
||||
end
|
||||
|
||||
# create 1 series, y = f(x)
|
||||
function createKWargsList(plt::PlottingObject, x::AVec, f::Function; kw...)
|
||||
d = getPlotKeywordArgs(kw, 1, plt.n + 1)
|
||||
|
||||