examples
This commit is contained in:
parent
0f6bb7ce6f
commit
593c47b938
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
Plots is a plotting API and toolset. My goals with the package are:
|
Plots is a plotting API and toolset. My goals with the package are:
|
||||||
|
|
||||||
- **Intuitive** Start generating complex plots without reading volumes of documentation. Commands should "just work".
|
- **Intuitive**. Start generating complex plots without reading volumes of documentation. Commands should "just work".
|
||||||
- **Concise**. Less code means fewer mistakes and more efficient development/analysis.
|
- **Concise**. Less code means fewer mistakes and more efficient development/analysis.
|
||||||
- **Flexible**. Produce your favorite plots from your favorite package, but quicker and simpler.
|
- **Flexible**. Produce your favorite plots from your favorite package, but quicker and simpler.
|
||||||
- **Consistent**. Don't commit to one graphics package. Use the same code and access the strengths of all backends.
|
- **Consistent**. Don't commit to one graphics package. Use the same code and access the strengths of all backends.
|
||||||
|
|||||||
@ -35,7 +35,7 @@ const examples = PlotExample[
|
|||||||
:(plot(fakedata(50,5), w=3))
|
:(plot(fakedata(50,5), w=3))
|
||||||
]),
|
]),
|
||||||
PlotExample("Functions, adding data, and animations",
|
PlotExample("Functions, adding data, and animations",
|
||||||
"Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Set, get, and push/append to series data, and easily build animations.\n\nNote: ImageMagick's `convert` or `ffmpeg` must be runnable from pwd to generate the animation. Use command `gif(anim, filename, fps=15)` to save the animation.",
|
"Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}.\n\nGet series data: `x, y = plt[i]`. Set series data: `plt[i] = (x,y)`. Add to the series with `push!`/`append!`.\n\nEasily build animations. (`convert` or `ffmpeg` must be available to generate the animation.) Use command `gif(anim, filename, fps=15)` to save the animation.",
|
||||||
[
|
[
|
||||||
:(p = plot([sin,cos], zeros(0), leg=false)),
|
:(p = plot([sin,cos], zeros(0), leg=false)),
|
||||||
:(anim = Animation()),
|
:(anim = Animation()),
|
||||||
@ -44,8 +44,8 @@ const examples = PlotExample[
|
|||||||
frame(anim)
|
frame(anim)
|
||||||
end)
|
end)
|
||||||
]),
|
]),
|
||||||
PlotExample("",
|
PlotExample("Parametric plots",
|
||||||
"Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, umax).",
|
"Plot function pair (x(u), y(u)).",
|
||||||
[
|
[
|
||||||
:(plot(sin, x->sin(2x), 0, 2π, line=4, leg=false, fill=(0,:orange)))
|
:(plot(sin, x->sin(2x), 0, 2π, line=4, leg=false, fill=(0,:orange)))
|
||||||
]),
|
]),
|
||||||
@ -177,7 +177,7 @@ const examples = PlotExample[
|
|||||||
|
|
||||||
|
|
||||||
function createStringOfMarkDownCodeValues(arr, prefix = "")
|
function createStringOfMarkDownCodeValues(arr, prefix = "")
|
||||||
string("`", prefix, join(arr, "`, `$prefix"), "`")
|
string("`", prefix, join(sort(map(string, arr)), "`, `$prefix"), "`")
|
||||||
end
|
end
|
||||||
createStringOfMarkDownSymbols(arr) = isempty(arr) ? "" : createStringOfMarkDownCodeValues(arr, ":")
|
createStringOfMarkDownSymbols(arr) = isempty(arr) ? "" : createStringOfMarkDownCodeValues(arr, ":")
|
||||||
|
|
||||||
@ -196,13 +196,7 @@ 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 (generated $(now()))\n\n")
|
write(md, "## Examples for backend: $pkgname\n(generated $(now()))\n\n")
|
||||||
write(md, "- Supported arguments: $(createStringOfMarkDownCodeValues(supportedArgs(pkg)))\n")
|
|
||||||
write(md, "- Supported values for axis: $(createStringOfMarkDownSymbols(supportedAxes(pkg)))\n")
|
|
||||||
write(md, "- Supported values for linetype: $(createStringOfMarkDownSymbols(supportedTypes(pkg)))\n")
|
|
||||||
write(md, "- Supported values for linestyle: $(createStringOfMarkDownSymbols(supportedStyles(pkg)))\n")
|
|
||||||
write(md, "- Supported values for marker: $(createStringOfMarkDownSymbols(supportedMarkers(pkg)))\n")
|
|
||||||
write(md, "- Is `subplot`/`subplot!` supported? $(subplotSupported(pkg) ? "Yes" : "No")\n\n")
|
|
||||||
|
|
||||||
write(md, "### Initialize\n\n```julia\nusing Plots\n$(pkgname)()\n```\n\n")
|
write(md, "### Initialize\n\n```julia\nusing Plots\n$(pkgname)()\n```\n\n")
|
||||||
|
|
||||||
@ -243,6 +237,13 @@ function generate_markdown(pkgname::Symbol)
|
|||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|
||||||
|
write(md, "- Supported arguments: $(createStringOfMarkDownCodeValues(supportedArgs(pkg)))\n")
|
||||||
|
write(md, "- Supported values for axis: $(createStringOfMarkDownSymbols(supportedAxes(pkg)))\n")
|
||||||
|
write(md, "- Supported values for linetype: $(createStringOfMarkDownSymbols(supportedTypes(pkg)))\n")
|
||||||
|
write(md, "- Supported values for linestyle: $(createStringOfMarkDownSymbols(supportedStyles(pkg)))\n")
|
||||||
|
write(md, "- Supported values for marker: $(createStringOfMarkDownSymbols(supportedMarkers(pkg)))\n")
|
||||||
|
write(md, "- Is `subplot`/`subplot!` supported? $(subplotSupported(pkg) ? "Yes" : "No")\n\n")
|
||||||
|
|
||||||
close(md)
|
close(md)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
# Examples for backend: gadfly (generated 2015-10-17T23:09:16)
|
## Examples for backend: gadfly
|
||||||
|
(generated 2015-10-17T23:27:21)
|
||||||
- Supported arguments: `annotation`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `fillopacity`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `lineopacity`, `markershape`, `markercolor`, `markersize`, `markeropacity`, `n`, `nbins`, `nc`, `nr`, `smooth`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`, `tickfont`, `guidefont`, `legendfont`, `grid`
|
|
||||||
- Supported values for axis: `:auto`, `:left`
|
|
||||||
- Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline`, `:ohlc`
|
|
||||||
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot`
|
|
||||||
- Supported values for marker: `:none`, `:auto`, `:cross`, `:diamond`, `:dtriangle`, `:ellipse`, `:heptagon`, `:hexagon`, `:octagon`, `:pentagon`, `:rect`, `:star4`, `:star5`, `:star6`, `:star7`, `:star8`, `:utriangle`, `:xcross`, `:Plots.Shape`
|
|
||||||
- Is `subplot`/`subplot!` supported? Yes
|
|
||||||
|
|
||||||
### Initialize
|
### Initialize
|
||||||
|
|
||||||
@ -26,9 +20,11 @@ plot(fakedata(50,5),w=3)
|
|||||||
|
|
||||||
### Functions, adding data, and animations
|
### Functions, adding data, and animations
|
||||||
|
|
||||||
Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Set, get, and push/append to series data, and easily build animations.
|
Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}.
|
||||||
|
|
||||||
Note: ImageMagick's `convert` or `ffmpeg` must be runnable from pwd to generate the animation. Use command `gif(anim, filename, fps=15)` to save the animation.
|
Get series data: `x, y = plt[i]`. Set series data: `plt[i] = (x,y)`. Add to the series with `push!`/`append!`.
|
||||||
|
|
||||||
|
Easily build animations. (`convert` or `ffmpeg` must be available to generate the animation.) Use command `gif(anim, filename, fps=15)` to save the animation.
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
p = plot([sin,cos],zeros(0),leg=false)
|
p = plot([sin,cos],zeros(0),leg=false)
|
||||||
@ -41,9 +37,9 @@ end
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
###
|
### Parametric plots
|
||||||
|
|
||||||
Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, umax).
|
Plot function pair (x(u), y(u)).
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
plot(sin,(x->begin # /Users/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 50:
|
plot(sin,(x->begin # /Users/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 50:
|
||||||
@ -244,3 +240,10 @@ plot(0.1:0.2:0.9,0.7 * rand(5) + 0.15,l=(3,:dash,:lightblue),m=(Shape(verts),30,
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
- Supported arguments: `annotation`, `background_color`, `color`, `color_palette`, `fillcolor`, `fillopacity`, `fillrange`, `foreground_color`, `grid`, `group`, `guidefont`, `label`, `layout`, `legend`, `legendfont`, `lineopacity`, `linestyle`, `linetype`, `linewidth`, `markercolor`, `markeropacity`, `markershape`, `markersize`, `n`, `nbins`, `nc`, `nr`, `show`, `size`, `smooth`, `tickfont`, `title`, `windowtitle`, `x`, `xflip`, `xlabel`, `xlims`, `xscale`, `xticks`, `y`, `yflip`, `ylabel`, `ylims`, `yscale`, `yticks`, `z`
|
||||||
|
- Supported values for axis: `:auto`, `:left`
|
||||||
|
- Supported values for linetype: `:bar`, `:heatmap`, `:hexbin`, `:hist`, `:hline`, `:line`, `:none`, `:ohlc`, `:path`, `:scatter`, `:steppost`, `:steppre`, `:sticks`, `:vline`
|
||||||
|
- Supported values for linestyle: `:auto`, `:dash`, `:dashdot`, `:dashdotdot`, `:dot`, `:solid`
|
||||||
|
- Supported values for marker: `:Plots.Shape`, `:auto`, `:cross`, `:diamond`, `:dtriangle`, `:ellipse`, `:heptagon`, `:hexagon`, `:none`, `:octagon`, `:pentagon`, `:rect`, `:star4`, `:star5`, `:star6`, `:star7`, `:star8`, `:utriangle`, `:xcross`
|
||||||
|
- Is `subplot`/`subplot!` supported? Yes
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
Plots is a plotting API and toolset. My goals with the package are:
|
Plots is a plotting API and toolset. My goals with the package are:
|
||||||
|
|
||||||
- **Intuitive** Start generating complex plots without reading volumes of documentation. Commands should "just work".
|
- **Intuitive**. Start generating complex plots without reading volumes of documentation. Commands should "just work".
|
||||||
- **Concise**. Less code means fewer mistakes and more efficient development/analysis.
|
- **Concise**. Less code means fewer mistakes and more efficient development/analysis.
|
||||||
- **Flexible**. Produce your favorite plots from your favorite package, but quicker and simpler.
|
- **Flexible**. Produce your favorite plots from your favorite package, but quicker and simpler.
|
||||||
- **Consistent**. Don't commit to one graphics package. Use the same code and access the strengths of all backends.
|
- **Consistent**. Don't commit to one graphics package. Use the same code and access the strengths of all backends.
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 46 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 58 KiB |
Loading…
x
Reference in New Issue
Block a user