diff --git a/docs/example_generation.jl b/docs/example_generation.jl index 3e69693f..1b4f6604 100644 --- a/docs/example_generation.jl +++ b/docs/example_generation.jl @@ -114,7 +114,7 @@ function generate_markdown(pkgname::Symbol) end # run it! -map(generate_markdown, (:qwt, :gadfly)) +map(generate_markdown, (:qwt, :gadfly, :unicodeplots)) end # module diff --git a/docs/gadfly_examples.md b/docs/gadfly_examples.md index f1f6342c..4d365fc6 100644 --- a/docs/gadfly_examples.md +++ b/docs/gadfly_examples.md @@ -1,141 +1,3 @@ -### Lines - -A simple line plot of the 3 columns. - -```julia -plot(rand(100,3)) -``` - -![](../img/gadfly_example_1.png) - -### Functions - -Plot multiple functions - -```julia -plot(0:0.01:4π,[sin,cos]) -``` - -![](../img/gadfly_example_2.png) - -### Global - -Change the guides/background without a separate call. - -```julia -plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.5,0.5,0.5)) -``` - -![](../img/gadfly_example_3.png) - -### Two-axis - -Use the `axis` or `axiss` arguments. - -Note: This is only supported with Qwt right now - -```julia -plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right]) -``` - -![](../img/gadfly_example_4.png) - -### Vectors w/ pluralized args - -Plot multiple series with different numbers of points. Mix arguments that apply to all series (singular... see `marker`) with arguments unique to each series (pluralized... see `colors`). - -```julia -plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue]) -``` - -![](../img/gadfly_example_5.png) - -### Build plot in pieces - -Start with a base plot... - -```julia -plot(rand(100) / 3; reg=true,fillto=0) -``` - -![](../img/gadfly_example_6.png) - -### - -and add to it later. - -```julia -scatter!(rand(100); markersize=6,color=:blue) -``` - -![](../img/gadfly_example_7.png) - -### Heatmaps - - - -```julia -heatmap(randn(10000),randn(10000); nbins=200) -``` - -![](../img/gadfly_example_8.png) - -### Lots of line types - -Options: (:line, :step, :stepinverted, :sticks, :dots, :none, :heatmap, :hexbin, :hist, :bar) -Note: some may not work with all backends - -```julia -plot(rand(20,4); linetypes=[:line,:step,:sticks,:dots]) -``` - -![](../img/gadfly_example_9.png) - -### Bar - -x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints) - -```julia -bar(randn(1000)) -``` - -![](../img/gadfly_example_10.png) - -### Histogram - -note: fillto isn't supported on all backends - -```julia -histogram(randn(1000); nbins=50,fillto=20) -``` - -![](../img/gadfly_example_11.png) - -### 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) -``` - -![](../img/gadfly_example_12.png) - -### 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) -``` - -![](../img/gadfly_example_13.png) - ### @@ -144,5 +6,5 @@ subplot(randn(100,5); n=4) subplot!(randn(100,3)) ``` -![](../img/gadfly_example_14.png) +![](../img/gadfly_example_15.png) diff --git a/docs/qwt_examples.md b/docs/qwt_examples.md index 3d0d5875..0ac2d5ef 100644 --- a/docs/qwt_examples.md +++ b/docs/qwt_examples.md @@ -10,7 +10,7 @@ plot(rand(100,3)) ### Functions -Plot multiple functions +Plot multiple functions. ```julia plot(0:0.01:4π,[sin,cos]) @@ -18,6 +18,16 @@ plot(0:0.01:4π,[sin,cos]) ![](../img/qwt_example_2.png) +### + +You can also call it with (xmin, xmax). + +```julia +plot([sin,cos],0,4π) +``` + +![](../img/qwt_example_3.png) + ### Global Change the guides/background without a separate call. @@ -26,7 +36,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)) ``` -![](../img/qwt_example_3.png) +![](../img/qwt_example_4.png) ### Two-axis @@ -38,7 +48,7 @@ Note: This is only supported with Qwt right now plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right]) ``` -![](../img/qwt_example_4.png) +![](../img/qwt_example_5.png) ### Vectors w/ pluralized args @@ -48,7 +58,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]) ``` -![](../img/qwt_example_5.png) +![](../img/qwt_example_6.png) ### Build plot in pieces @@ -58,7 +68,7 @@ Start with a base plot... plot(rand(100) / 3; reg=true,fillto=0) ``` -![](../img/qwt_example_6.png) +![](../img/qwt_example_7.png) ### @@ -68,7 +78,7 @@ and add to it later. scatter!(rand(100); markersize=6,color=:blue) ``` -![](../img/qwt_example_7.png) +![](../img/qwt_example_8.png) ### Heatmaps @@ -78,7 +88,7 @@ scatter!(rand(100); markersize=6,color=:blue) heatmap(randn(10000),randn(10000); nbins=200) ``` -![](../img/qwt_example_8.png) +![](../img/qwt_example_9.png) ### Lots of line types @@ -89,7 +99,7 @@ Note: some may not work with all backends plot(rand(20,4); linetypes=[:line,:step,:sticks,:dots]) ``` -![](../img/qwt_example_9.png) +![](../img/qwt_example_10.png) ### Bar @@ -99,7 +109,7 @@ x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints bar(randn(1000)) ``` -![](../img/qwt_example_10.png) +![](../img/qwt_example_11.png) ### Histogram @@ -109,7 +119,7 @@ note: fillto isn't supported on all backends histogram(randn(1000); nbins=50,fillto=20) ``` -![](../img/qwt_example_11.png) +![](../img/qwt_example_12.png) ### Subplots @@ -124,7 +134,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) ``` -![](../img/qwt_example_12.png) +![](../img/qwt_example_13.png) ### Adding to subplots @@ -134,7 +144,7 @@ Note here the automatic grid layout, as well as the order in which new series ar subplot(randn(100,5); n=4) ``` -![](../img/qwt_example_13.png) +![](../img/qwt_example_14.png) ### @@ -144,5 +154,5 @@ subplot(randn(100,5); n=4) subplot!(randn(100,3)) ``` -![](../img/qwt_example_14.png) +![](../img/qwt_example_15.png) diff --git a/docs/unicodeplots_examples.md b/docs/unicodeplots_examples.md new file mode 100644 index 00000000..5d876930 --- /dev/null +++ b/docs/unicodeplots_examples.md @@ -0,0 +1,113 @@ +### Lines + +A simple line plot of the 3 columns. + +```julia +plot(rand(100,3)) +``` + +![](../img/unicodeplots_example_1.png) + +### Functions + +Plot multiple functions. + +```julia +plot(0:0.01:4π,[sin,cos]) +``` + +![](../img/unicodeplots_example_2.png) + +### + +You can also call it with (xmin, xmax). + +```julia +plot([sin,cos],0,4π) +``` + +![](../img/unicodeplots_example_3.png) + +### Global + +Change the guides/background without a separate call. + +```julia +plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.5,0.5,0.5)) +``` + +![](../img/unicodeplots_example_4.png) + +### Two-axis + +Use the `axis` or `axiss` arguments. + +Note: This is only supported with Qwt right now + +```julia +plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right]) +``` + +![](../img/unicodeplots_example_5.png) + +### Vectors w/ pluralized args + +Plot multiple series with different numbers of points. Mix arguments that apply to all series (singular... see `marker`) with arguments unique to each series (pluralized... see `colors`). + +```julia +plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue]) +``` + +![](../img/unicodeplots_example_6.png) + +### Build plot in pieces + +Start with a base plot... + +```julia +plot(rand(100) / 3; reg=true,fillto=0) +``` + +![](../img/unicodeplots_example_7.png) + +### + +and add to it later. + +```julia +scatter!(rand(100); markersize=6,color=:blue) +``` + +![](../img/unicodeplots_example_8.png) + +### Lots of line types + +Options: (:line, :step, :stepinverted, :sticks, :dots, :none, :heatmap, :hexbin, :hist, :bar) +Note: some may not work with all backends + +```julia +plot(rand(20,4); linetypes=[:line,:step,:sticks,:dots]) +``` + +![](../img/unicodeplots_example_10.png) + +### Bar + +x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints) + +```julia +bar(randn(1000)) +``` + +![](../img/unicodeplots_example_11.png) + +### Histogram + +note: fillto isn't supported on all backends + +```julia +histogram(randn(1000); nbins=50,fillto=20) +``` + +![](../img/unicodeplots_example_12.png) + diff --git a/img/gadfly_example_15.png b/img/gadfly_example_15.png new file mode 100644 index 00000000..dd2427c3 Binary files /dev/null and b/img/gadfly_example_15.png differ diff --git a/img/qwt_example_1.png b/img/qwt_example_1.png index 269d0e7d..8de14e35 100644 Binary files a/img/qwt_example_1.png and b/img/qwt_example_1.png differ diff --git a/img/qwt_example_10.png b/img/qwt_example_10.png index 07b60409..4eb2c24f 100644 Binary files a/img/qwt_example_10.png and b/img/qwt_example_10.png differ diff --git a/img/qwt_example_11.png b/img/qwt_example_11.png index 483438cf..592361d0 100644 Binary files a/img/qwt_example_11.png and b/img/qwt_example_11.png differ diff --git a/img/qwt_example_12.png b/img/qwt_example_12.png index 366b86f0..e5b778ce 100644 Binary files a/img/qwt_example_12.png and b/img/qwt_example_12.png differ diff --git a/img/qwt_example_13.png b/img/qwt_example_13.png index 53dc52a0..9ec1bb43 100644 Binary files a/img/qwt_example_13.png and b/img/qwt_example_13.png differ diff --git a/img/qwt_example_14.png b/img/qwt_example_14.png index f3339622..4149bf5f 100644 Binary files a/img/qwt_example_14.png and b/img/qwt_example_14.png differ diff --git a/img/qwt_example_15.png b/img/qwt_example_15.png new file mode 100644 index 00000000..d0c67c33 Binary files /dev/null and b/img/qwt_example_15.png differ diff --git a/img/qwt_example_2.png b/img/qwt_example_2.png index d04b7672..2b24f613 100644 Binary files a/img/qwt_example_2.png and b/img/qwt_example_2.png differ diff --git a/img/qwt_example_3.png b/img/qwt_example_3.png index 557a4727..74eb29c3 100644 Binary files a/img/qwt_example_3.png and b/img/qwt_example_3.png differ diff --git a/img/qwt_example_4.png b/img/qwt_example_4.png index 0ec88638..b46f6063 100644 Binary files a/img/qwt_example_4.png and b/img/qwt_example_4.png differ diff --git a/img/qwt_example_5.png b/img/qwt_example_5.png index eb759794..81c9cb62 100644 Binary files a/img/qwt_example_5.png and b/img/qwt_example_5.png differ diff --git a/img/qwt_example_6.png b/img/qwt_example_6.png index 18f8e9ef..3d159b79 100644 Binary files a/img/qwt_example_6.png and b/img/qwt_example_6.png differ diff --git a/img/qwt_example_7.png b/img/qwt_example_7.png index 834b01a3..53cee8af 100644 Binary files a/img/qwt_example_7.png and b/img/qwt_example_7.png differ diff --git a/img/qwt_example_8.png b/img/qwt_example_8.png index 8f0c9eac..c9c2b362 100644 Binary files a/img/qwt_example_8.png and b/img/qwt_example_8.png differ diff --git a/img/qwt_example_9.png b/img/qwt_example_9.png index bfb133b7..9658e4fb 100644 Binary files a/img/qwt_example_9.png and b/img/qwt_example_9.png differ diff --git a/img/unicodeplots_example_1.png b/img/unicodeplots_example_1.png new file mode 100644 index 00000000..ebc43e7e Binary files /dev/null and b/img/unicodeplots_example_1.png differ diff --git a/img/unicodeplots_example_10.png b/img/unicodeplots_example_10.png new file mode 100644 index 00000000..e4522839 Binary files /dev/null and b/img/unicodeplots_example_10.png differ diff --git a/img/unicodeplots_example_11.png b/img/unicodeplots_example_11.png new file mode 100644 index 00000000..da49fb28 Binary files /dev/null and b/img/unicodeplots_example_11.png differ diff --git a/img/unicodeplots_example_12.png b/img/unicodeplots_example_12.png new file mode 100644 index 00000000..de253adc Binary files /dev/null and b/img/unicodeplots_example_12.png differ diff --git a/img/unicodeplots_example_2.png b/img/unicodeplots_example_2.png new file mode 100644 index 00000000..ad13964a Binary files /dev/null and b/img/unicodeplots_example_2.png differ diff --git a/img/unicodeplots_example_3.png b/img/unicodeplots_example_3.png new file mode 100644 index 00000000..d4b6f20e Binary files /dev/null and b/img/unicodeplots_example_3.png differ diff --git a/img/unicodeplots_example_4.png b/img/unicodeplots_example_4.png new file mode 100644 index 00000000..f1760a85 Binary files /dev/null and b/img/unicodeplots_example_4.png differ diff --git a/img/unicodeplots_example_5.png b/img/unicodeplots_example_5.png new file mode 100644 index 00000000..f364d29e Binary files /dev/null and b/img/unicodeplots_example_5.png differ diff --git a/img/unicodeplots_example_6.png b/img/unicodeplots_example_6.png new file mode 100644 index 00000000..39fccfec Binary files /dev/null and b/img/unicodeplots_example_6.png differ diff --git a/img/unicodeplots_example_7.png b/img/unicodeplots_example_7.png new file mode 100644 index 00000000..b6aec2a6 Binary files /dev/null and b/img/unicodeplots_example_7.png differ diff --git a/img/unicodeplots_example_8.png b/img/unicodeplots_example_8.png new file mode 100644 index 00000000..5ec8e4b1 Binary files /dev/null and b/img/unicodeplots_example_8.png differ diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 1eea4cf9..322c2047 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -116,8 +116,11 @@ end function savepng(::UnicodePlotsPackage, plt::PlottingObject, fn::String, args...) # = error("currently unsupported") display(plt) - # TODO - warn("savepng unimplemented") + @osx_only begin + run(`screencapture -w $fn`) + return + end + error("Can only savepng on osx with UnicodePlots.") end # -------------------------------