Compare commits

..

67 Commits

Author SHA1 Message Date
Thomas Breloff 22fd25b30f readme 2015-09-23 13:36:51 -04:00
Thomas Breloff 610ddb09ff readme and cleanup 2015-09-23 13:33:12 -04:00
Thomas Breloff 33602aca11 fixed tests 2015-09-23 13:03:37 -04:00
Thomas Breloff a207856e99 lims/ticks for gadfly/immerse 2015-09-23 12:45:24 -04:00
Thomas Breloff 80e8b5b5e4 fixes 2015-09-23 11:35:08 -04:00
Thomas Breloff 273996aa91 working on ticks/lims 2015-09-23 00:14:32 -04:00
Thomas Breloff 646b88c5be working on ticks 2015-09-22 23:30:20 -04:00
Thomas Breloff 88cfd82a25 unicodeplots fixes 2015-09-22 17:19:37 -04:00
Thomas Breloff 2f8436be87 winston examples 2015-09-22 17:04:51 -04:00
Thomas Breloff a6237cdda3 qwt examples 2015-09-22 17:02:19 -04:00
Thomas Breloff eb93a767fc pyplot fixes and examples 2015-09-22 16:57:23 -04:00
Thomas Breloff 41852412ca gadfly/immerse fixes and examples 2015-09-22 16:46:54 -04:00
Thomas Breloff 224b2b7323 various fixes; readme 2015-09-22 16:30:40 -04:00
Thomas Breloff ec939f9f9a more display fun 2015-09-22 14:56:37 -04:00
Thomas Breloff eced15b712 working on display/writemime overhaul 2015-09-22 12:54:55 -04:00
Thomas Breloff f8fb473981 reexport Colors; move default backend choice into __init__; fixed pickDefaultBackend 2015-09-22 08:10:30 -04:00
Thomas Breloff f2bcb77cfb trying fgcolor gadfly 2015-09-22 00:04:35 -04:00
Thomas Breloff dc5da28176 initial dataframes support 2015-09-21 23:36:07 -04:00
Thomas Breloff be43e64743 foreground_color fixes and added support in pyplot 2015-09-21 23:04:37 -04:00
Thomas Breloff 454630dace qwt fixes 2015-09-21 22:14:59 -04:00
Thomas Breloff c9df244333 qwt fixes 2015-09-21 17:38:27 -04:00
Thomas Breloff 2649d97d69 readme 2015-09-21 17:31:36 -04:00
Thomas Breloff bcb9ac5501 readme 2015-09-21 17:29:51 -04:00
Thomas Breloff 76d1e26f7d readme 2015-09-21 17:04:20 -04:00
Thomas Breloff ba13ab9926 readme 2015-09-21 16:59:15 -04:00
Thomas Breloff c43b34b67f auto-generated readme 2015-09-21 16:49:45 -04:00
Thomas Breloff 3739c2881b fixed linetype aliases; for qwt as well 2015-09-21 16:18:58 -04:00
Thomas Breloff bc13b81351 working on readme_template; added path linetype and sorting logic for line 2015-09-21 16:03:59 -04:00
Thomas Breloff 86a56e487a working on aliases 2015-09-21 14:38:03 -04:00
Thomas Breloff 031058cd0c cleanup and renaming constants 2015-09-21 12:15:40 -04:00
Thomas Breloff 85040d6104 fix creating empty plot with plot() 2015-09-21 12:05:17 -04:00
Thomas Breloff efbf74b44c working on auto generated color palette 2015-09-21 11:45:37 -04:00
Thomas Breloff 774fc42e8e replaced creation of kw args 2015-09-20 23:48:45 -04:00
Thomas Breloff 692cfe4f52 added srand calls to tests and examples 2015-09-20 22:59:25 -04:00
Thomas Breloff 8b34d4417b gadfly display size and fix: check for line_style 2015-09-20 21:12:56 -04:00
Thomas Breloff c20a7b3c69 added fillto for gadfly/immerse 2015-09-19 17:23:18 -04:00
Thomas Breloff ff6e83c55e working on new plot logic 2015-09-19 14:39:25 -04:00
Thomas Breloff 6aa56fd30f fixed subplot bug 2015-09-19 00:38:50 -04:00
Thomas Breloff f5a6f129dd foreground_color 2015-09-19 00:05:24 -04:00
Thomas Breloff 5405c1d240 working on colors 2015-09-18 17:20:35 -04:00
Thomas Breloff 455f85e230 working on colors, args 2015-09-18 16:53:43 -04:00
Thomas Breloff fa899a67a7 added support for gadfly linestyles... depends on gadfly PR 695 2015-09-18 12:26:18 -04:00
Thomas Breloff 56cf25eebf gadfly shapes 2015-09-18 01:55:16 -04:00
Thomas Breloff 1a490551e6 working on arg aliases and reorg 2015-09-18 01:48:00 -04:00
Thomas Breloff 4514802e35 replacing String with AbstractString 2015-09-17 21:32:27 -04:00
Thomas Breloff a9062b0611 examples 2015-09-17 17:11:25 -04:00
Thomas Breloff eb6b30aab1 markers, fixes, and rerun examples 2015-09-17 17:05:08 -04:00
Thomas Breloff 922abd7ad3 examples 2015-09-17 16:21:13 -04:00
Thomas Breloff c4596dda75 more shape fun... completed gadfly's set 2015-09-17 16:18:48 -04:00
Thomas Breloff 168b77326b fixing markers 2015-09-17 15:44:01 -04:00
Thomas Breloff f674bba861 added gadfly shapes utriangle, dtriangle, and xcross 2015-09-17 15:28:54 -04:00
Thomas Breloff 6b2e65e738 ohlc example 2015-09-17 14:49:37 -04:00
Thomas Breloff 51021c799d accept vectors of tuples; implement ohlc for gadfly with an example 2015-09-17 14:44:29 -04:00
Thomas Breloff 01cb036976 added fillto support for winston 2015-09-17 11:26:26 -04:00
Thomas Breloff ea7867429f added hline/vline support in gadfly 2015-09-17 10:14:13 -04:00
Thomas Breloff c5300cd7be notes 2015-09-17 08:32:32 -04:00
Thomas Breloff ea34c7d226 working on winston and examples 2015-09-16 17:17:05 -04:00
Thomas Breloff 537e04989f working on winston 2015-09-16 16:34:40 -04:00
Thomas Breloff d447c5dc25 moved exports into backend files 2015-09-16 15:11:44 -04:00
Thomas Breloff 73944fc9bf first draft winston 2015-09-16 15:08:50 -04:00
Thomas Breloff 01e994e0f1 regenerate markdown 2015-09-16 14:32:36 -04:00
Thomas Breloff af3f3f436c improving markdown 2015-09-16 14:24:58 -04:00
Thomas Breloff 56e90a266a examples 2015-09-16 14:16:58 -04:00
Thomas Breloff 1fc59ed522 fix ALL_ARGS; unicodeplots examples 2015-09-16 14:01:53 -04:00
Thomas Breloff 3a3b1a6c17 examples 2015-09-16 13:40:23 -04:00
Thomas Breloff 242ce807df examples 2015-09-16 13:32:43 -04:00
Thomas Breloff 734967152c fixed suppported typo 2015-09-16 13:29:51 -04:00
127 changed files with 2712 additions and 965 deletions
+149 -108
View File
@@ -4,7 +4,12 @@
#### Author: Thomas Breloff (@tbreloff)
Plotting interface and wrapper for several plotting packages.
Plots is a plotting interface and wrapper for several plotting packages. My goals with the package are:
- Simple. The interface should be intuitive enough that someone coming from Matlab, Python, etc can immediately start generating complex plots without reading volumes of documentation.
- Automatic (if you want). There should be smart defaults for the most common functionality, and simple, high-level ways to override complex functionality.
- Flexible. You should be able to produce your favorite plot in your favorite package, but quicker and simpler.
- Consistent. Don't commit to one graphics package. One command will switch your backend, and the exact same plotting commands will work with a very different underlying backend.
Please add wishlist items, bugs, or any other comments/questions to the issues list.
@@ -15,6 +20,7 @@ Please add wishlist items, bugs, or any other comments/questions to the issues l
- [UnicodePlots.jl](docs/unicodeplots_examples.md)
- [PyPlot.jl](docs/pyplot_examples.md)
- [Immerse.jl](docs/immerse_examples.md)
- [Winston.jl](docs/winston_examples.md)
## Installation
@@ -32,6 +38,7 @@ Pkg.add("Immerse")
Pkg.add("UnicodePlots")
Pkg.add("PyPlot") # requires python and matplotlib
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git") # requires pyqt and pyqwt
Pkg.add("Winston")
```
## Use
@@ -50,8 +57,8 @@ Do a plot in Gadfly, then save a png:
# switch to Gadfly as a backend
gadfly!()
# This will bring up a browser window with the plot. Add a semicolon to skip display.
plot(rand(10,2); marker = :rect, markersizes=[10,30])
# This will bring up a browser window with the plot. Add a semicolon at the end to skip display.
plot(rand(10,2); marker = :rect, markersize = [10,30], style = :auto)
# save it as a PNG
savepng(Plots.IMG_DIR * "gadfly1.png")
@@ -84,55 +91,41 @@ plot!(plotobj, args...; kw...) # adds to the plot `plotobj`
```
Now that you know which plot object you're updating (new, current, or other), I'll leave it off for simplicity.
Here are some various args to supply, and the implicit mapping (AVec == AbstractVector and AMat == AbstractMatrix):
There are many ways to pass in data to the plot functions... some examples:
- Vector-like (subtypes of AbstractArray{T,1})
- Matrix-like (subtypes of AbstractArray{T,2})
- Vectors of Vectors
- Functions
- Vectors of Functions
- DataFrames with column symbols (initialize with `dataframes!()`)
In general, you can pass in a `y` only, or an `x` and `y`, both of whatever type(s) you want, and Plots will slice up the data as needed.
For matrices, data is split by columns. For functions, data is mapped. For DataFrames, a Symbol/Symbols in place of x/y will map to
the relevant column(s).
Here are some example usages... remember you can always use `plot!` to update an existing plot, and that, unless specified, you will update the `currentPlot()`.
```julia
# one line... x = 1:length(y)
plot(y::AVec; kw...)
plot() # empty plot object
plot(4) # initialize with 4 empty series
plot(rand(10)) # plot 1 series... x = 1:10
plot(rand(10,5)) # plot 5 series... x = 1:10
plot(rand(10), rand(10)) # plot 1 series
plot(rand(10,5), rand(10)) # plot 5 series... y is the same for all
plot(sin, rand(10)) # y = sin(x)
plot(rand(10), sin) # same... y = sin(x)
plot([sin,cos], 0:0.1:π) # plot 2 series, sin(x) and cos(x)
plot([sin,cos], 0, π) # plot sin and cos on the range [0, π]
plot(1:10, Any[rand(10), sin]) # plot 2 series, y = rand(10) for the first, y = sin(x) for the second... x = 1:10 for both
plot(dataset("Ecdat", "Airline"), :Cost) # plot from a DataFrame (call `dataframes!()` first to import DataFrames and initialize)
```
# one line (will assert length(x) == length(y))
plot(x::AVec, y::AVec; kw...)
You can update certain plot settings after plot creation (not supported on all backends):
# multiple lines (one per column of x), all sharing x = 1:size(y,1)
plot(y::AMat; kw...)
# multiple lines (one per column of x), all sharing x (will assert length(x) == size(y,1))
plot(x::AVec, y::AMat; kw...)
# multiple lines (one per column of x/y... will assert size(x) == size(y))
plot(x::AMat, y::AMat; kw...)
# one line, map function for range [xmin,xmax]
plot(f::Function, xmin::Real, xmax::Real; kw...)
# multiple lines, map functions for range [xmin,xmax]
plot(f::AVec{Function}, xmin::Real, xmax::Real; kw...)
# parametric plot... x = fx(u), y = fy(u)
plot(fx::Function, fy::Function, umin::Real, umax::Real; kw...)
# one line, y = f(x)... can swap x and f
plot(x::AVec, f::Function; kw...)
# multiple lines, yᵢⱼ = f(xᵢⱼ)... can swap f and x
plot(x::AMat, f::Function; kw...)
# multiple lines, yᵢⱼ = fⱼ(xᵢ)
plot(x::AVec, fs::AVec{Function}; kw...)
# multiple lines, each with x = 1:length(y[i])
plot(y::AVec{AVec}; kw...)
# multiple lines, will assert length(x) == length(y[i])
plot(x::AVec, y::AVec{AVec}; kw...)
# multiple lines, will assert length(x[i]) == length(y[i])
plot(x::AVec{AVec}, y::AVec{AVec}; kw...)
# n lines, all empty (for updating plots)
plot(n::Integer; kw...)
# TODO: DataFrames, categorical values
```julia
plot!(title = "New Title", xlabel = "New xlabel", ylabel = "New ylabel")
plot!(xlims = (0, 5.5), ylims = (-2.2, 6), xticks = 0:0.5:10, yticks = [0,1,5,10])
```
With `subplot`, create multiple plots at once, with flexible layout options:
@@ -162,81 +155,129 @@ heatmap(args...; kw...) = plot(args...; kw..., linetype = :heatmap)
heatmap!(args...; kw...) = plot!(args...; kw..., linetype = :heatmap)
sticks(args...; kw...) = plot(args...; kw..., linetype = :sticks, marker = :ellipse)
sticks!(args...; kw...) = plot!(args...; kw..., linetype = :sticks, marker = :ellipse)
hline(args...; kw...) = plot(args...; kw..., linetype = :hline)
hline!(args...; kw...) = plot!(args...; kw..., linetype = :hline)
vline(args...; kw...) = plot(args...; kw..., linetype = :vline)
vline!(args...; kw...) = plot!(args...; kw..., linetype = :vline)
ohlc(args...; kw...) = plot(args...; kw..., linetype = :ohlc)
ohlc!(args...; kw...) = plot!(args...; kw..., linetype = :ohlc)
title!(s::AbstractString) = plot!(title = s)
xlabel!(s::AbstractString) = plot!(xlabel = s)
ylabel!(s::AbstractString) = plot!(ylabel = s)
xlims!{T<:Real,S<:Real}(lims::Tuple{T,S}) = plot!(xlims = lims)
ylims!{T<:Real,S<:Real}(lims::Tuple{T,S}) = plot!(ylims = lims)
xticks!{T<:Real}(v::AVec{T}) = plot!(xticks = v)
yticks!{T<:Real}(v::AVec{T}) = plot!(yticks = v)
```
Some keyword arguments you can set:
```
axis # :left or :right
color # can be a string ("red") or a symbol (:red) or a ColorsTypes.jl
# Colorant (RGB(1,0,0)) or :auto (which lets the package pick)
label # string or symbol, applies to that line, may go in a legend
width # width of a line
linetype # :line, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar
linestyle # :solid, :dash, :dot, :dashdot, :dashdotdot
marker # :none, :ellipse, :rect, :diamond, :utriangle, :dtriangle,
# :cross, :xcross, :star1, :star2, :hexagon
markercolor # same choices as `color`, or :match will set the color to be the same as `color`
markersize # size of the marker
nbins # number of bins for heatmap/hexbin and histograms
heatmap_c # color cutoffs for Qwt heatmaps
fillto # fillto value for area plots
title # string or symbol, title of the plot
xlabel # string or symbol, label on the bottom (x) axis
ylabel # string or symbol, label on the left (y) axis
yrightlabel # string or symbol, label on the right (y) axis
reg # true or false, add a regression line for each line
size # (Int,Int), resize the enclosing window
pos # (Int,Int), move the enclosing window to this position
windowtitle # string or symbol, set the title of the enclosing windowtitle
screen # Integer, move enclosing window to this screen number (for multiscreen desktops)
```
Keyword | Default | Type | Aliases
---- | ---- | ---- | ----
`:args` | `Any[]` | Series | `:argss`
`:axis` | `left` | Series | `:axiss`
`:color` | `auto` | Series | `:c`, `:colors`
`:fillto` | `nothing` | Series | `:area`, `:fill`, `:filltos`
`:group` | `nothing` | Series | `:g`, `:groups`
`:heatmap_c` | `(0.15,0.5)` | Series | `:heatmap_cs`
`:kwargs` | `Any[]` | Series | `:kwargss`
`:label` | `AUTO` | Series | `:lab`, `:labels`
`:linestyle` | `solid` | Series | `:linestyles`, `:ls`, `:s`, `:style`
`:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type`
`:marker` | `none` | Series | `:m`, `:markers`
`:markercolor` | `match` | Series | `:markercolors`, `:mc`, `:mcolor`
`:markersize` | `6` | Series | `:markersizes`, `:ms`, `:msize`
`:nbins` | `100` | Series | `:nb`, `:nbin`, `:nbinss`
`:reg` | `false` | Series | `:regs`
`:ribbon` | `nothing` | Series | `:r`, `:ribbons`
`:width` | `1` | Series | `:linewidth`, `:w`, `:widths`
`:background_color` | `RGB{U8}(1.0,1.0,1.0)` | Plot | `:background`, `:bg`, `:bg_color`, `:bgcolor`
`:foreground_color` | `auto` | Plot | `:fg`, `:fg_color`, `:fgcolor`, `:foreground`
`:legend` | `true` | Plot | `:leg`
`:show` | `false` | Plot | `:display`
`:size` | `(800,600)` | Plot | `:windowsize`, `:wsize`
`:title` | `` | Plot |
`:windowtitle` | `Plots.jl` | Plot | `:wtitle`
`:xlabel` | `` | Plot | `:xlab`
`:xlims` | `auto` | Plot | `:xlim`, `:xlimit`, `:xlimits`
`:xticks` | `auto` | Plot | `:xtick`
`:ylabel` | `` | Plot | `:ylab`
`:ylims` | `auto` | Plot | `:ylim`, `:ylimit`, `:ylimits`
`:yrightlabel` | `` | Plot | `:y2lab`, `:y2label`, `:ylab2`, `:ylabel2`, `:ylabelright`, `:ylabr`, `:yrlab`
`:yticks` | `auto` | Plot | `:ytick`
Plot types:
Type | Desc | Aliases
---- | ---- | ----
`:none` | No line | `:n`, `:no`
`:line` | Lines with sorted x-axis | `:l`
`:path` | Lines | `:p`
`:steppre` | Step plot (vertical then horizontal) | `:stepinv`, `:stepinverted`, `:stepsinv`, `:stepsinverted`
`:steppost` | Step plot (horizontal then vertical) | `:stair`, `:stairs`, `:step`, `:steps`
`:sticks` | Vertical lines | `:stem`, `:stems`
`:scatter` | Points, no lines | `:dots`
`:heatmap` | Colored regions by density |
`:hexbin` | Similar to heatmap |
`:hist` | Histogram (doesn't use x) | `:histogram`
`:bar` | Bar plot (centered on x values) |
`:hline` | Horizontal line (doesn't use x) |
`:vline` | Vertical line (doesn't use x) |
`:ohlc` | Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC}) |
Line styles:
Type | Aliases
---- | ----
`:auto` | `:a`
`:solid` | `:s`
`:dash` | `:d`
`:dot` |
`:dashdot` | `:dd`
`:dashdotdot` | `:ddd`
Markers:
Type | Aliases
---- | ----
`:none` | `:n`, `:no`
`:auto` | `:a`
`:ellipse` | `:c`, `:circle`
`:rect` | `:r`, `:sq`, `:square`
`:diamond` | `:d`
`:utriangle` | `:^`, `:uptri`, `:uptriangle`, `:ut`, `:utri`
`:dtriangle` | `:V`, `:downtri`, `:downtriangle`, `:dt`, `:dtri`, `:v`
`:cross` | `:+`, `:plus`
`:xcross` | `:X`, `:x`
`:star1` | `:s`, `:star`
`:star2` | `:s2`
`:hexagon` | `:h`, `:hex`
`:octagon` | `:o`, `:oct`
Note that not every backend supports all options.
If you don't include a keyword argument, these are the defaults:
```
axis = :left
color = :auto
label = automatically generated (y1, y2, ...., or y1 (R), y2 (R) for the right axis)
width = 1
linetype = :line
linestype = :solid
marker = :none
markercolor = :match
markersize = 3
nbins = 100
heatmap_c = (0.15, 0.5)
fillto = nothing
title = ""
xlabel = ""
ylabel = ""
yrightlabel = ""
reg = false
size = (600,400)
pos = (0,0)
windowtitle = "Plots.jl"
screen = 1
```
__Tip__: You can see the default value for a given argument with `plotDefault(arg::Symbol)`, and set the default value with `plotDefault!(arg::Symbol, value)`
__Tip__: When plotting multiple lines, you can give every line the same trait by using the singular, or add an "s" to pluralize.
(yes I know it's not gramatically correct, but it's easy to use and implement)
__Tip__: When plotting multiple lines, you can set all series to use the same value, or pass in an array to cycle through values. Example:
```julia
# Note: The same width is applied to both lines, whereas
# each line gets different color and axis.
plot(rand(100,2); colors = [:red, RGB(.5,.5,0)],
axiss = [:left, :right],
width = 5)
plot(rand(100,4); color = [:red, RGB(0,0,1)], # lines 1 and 3 are red, lines 2 and 4 are blue
axis = :auto, # lines 1 and 3 are on the left axis, lines 2 and 4 are on the right
width = 5) # all lines have a width of 5
```
__Tip__: Not all features are supported for each backend, but you can see what's supported by calling the functions: `supportedArgs()`, `supportedAxes()`, `supportedTypes()`, `supportedStyles()`, `supportedMarkers()`, `subplotSupported()`
__Tip__: Call `gui()` to display the plot in a window. Interactivity depends on backend. Plotting at the REPL (without semicolon) implicitly calls `gui()`.
## TODO features:
- [x] Plot vectors/matrices/functions
- [ ] Plot DataFrames
- [x] Plot DataFrames
- [ ] Scales
- [ ] Categorical Inputs (strings, etc... for hist, bar? or can split one series into multiple?)
- [ ] Custom markers
@@ -255,7 +296,7 @@ plot(rand(100,2); colors = [:red, RGB(.5,.5,0)],
- [x] PyPlot.jl
- [x] UnicodePlots.jl
- [x] Qwt.jl
- [ ] Winston.jl
- [x] Winston.jl
- [ ] GLPlot.jl
- [ ] Bokeh.jl
- [ ] Vega.jl
+1
View File
@@ -1,3 +1,4 @@
julia 0.4-
Colors
Reexport
+127 -24
View File
@@ -11,8 +11,8 @@ doc"""
Holds all data needed for a documentation example... header, description, and plotting expression (Expr)
"""
type PlotExample
header::String
desc::String
header::AbstractString
desc::AbstractString
exprs::Vector{Expr}
end
@@ -21,7 +21,7 @@ end
const examples = PlotExample[
PlotExample("Lines",
"A simple line plot of the 3 columns.",
[:(plot(rand(100,3)))]),
[:(plot(rand(50,5), w=3))]),
PlotExample("Functions",
"Plot multiple functions. You can also put the function first.",
[:(plot(0:0.01:4π, [sin,cos]))]),
@@ -30,13 +30,13 @@ const examples = PlotExample[
[:(plot([sin,cos], 0, 4π))]),
PlotExample("",
"Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, umax).",
[:(plot(sin, x->sin(2x), 0, 2π))]),
[:(plot(sin, x->sin(2x), 0, 2π, legend=false, fillto=0))]),
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)))]),
[:(plot(rand(10); title="TITLE", xlabel="XLABEL", ylabel="YLABEL", background_color = RGB(0.2,0.2,0.2)))]),
PlotExample("Two-axis",
"Use the `axis` or `axiss` arguments.\n\nNote: Currently only supported with Qwt and PyPlot",
[:(plot(Vector[randn(100), randn(100)*100]; axiss = [:left,:right], ylabel="LEFT", yrightlabel="RIGHT"))]),
[:(plot(Vector[randn(100), randn(100)*100]; axis = [:l,:r], ylabel="LEFT", yrightlabel="RIGHT"))]),
PlotExample("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`).",
[:(plot(Vector[rand(10), rand(20)]; marker=:ellipse, markersize=8, colors=[:red,:blue]))]),
@@ -45,29 +45,29 @@ const examples = PlotExample[
[:(plot(rand(100)/3; reg=true, fillto=0))]),
PlotExample("",
"and add to it later.",
[:(scatter!(rand(100); markersize=6, color=:blue))]),
[:(scatter!(rand(100); markersize=6, c=:blue))]),
PlotExample("Heatmaps",
"",
[:(heatmap(randn(10000),randn(10000); nbins=100))]),
PlotExample("Suported line types",
"All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)",
[:(types = intersect(supportedTypes(), [:line, :step, :stepinverted, :sticks, :scatter])),
PlotExample("Line types",
"",
[:(types = intersect(supportedTypes(), [:line, :path, :steppre, :steppost, :sticks, :scatter])),
:(n = length(types)),
:(x = Vector[sort(rand(20)) for i in 1:n]),
:(y = rand(20,n)),
:(plot(x, y; linetypes=types, labels=map(string,types)))]),
PlotExample("Supported line styles",
"All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)",
[:(styles = setdiff(supportedStyles(), [:auto])), :(plot(rand(20,length(styles)); linestyle=:auto, labels=map(string,styles)))]),
PlotExample("Supported marker types",
"All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)",
[:(markers = setdiff(supportedMarkers(), [:none,:auto])), :(plot([fill(i,10) for i=1:length(markers)]; marker=:auto, labels=map(string,markers), markersize=10))]),
:(plot(x, y; t=types, lab=map(string,types)))]),
PlotExample("Line styles",
"",
[:(styles = setdiff(supportedStyles(), [:auto])), :(plot(cumsum(randn(20,length(styles)),1); style=:auto, label=map(string,styles), w=5))]),
PlotExample("Marker types",
"",
[:(markers = setdiff(supportedMarkers(), [:none,:auto])), :(scatter(0.5:9.5, [fill(i-0.5,10) for i=length(markers):-1:1]; marker=:auto, label=map(string,markers), markersize=10))]),
PlotExample("Bar",
"x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)",
[:(bar(randn(1000)))]),
PlotExample("Histogram",
"note: fillto isn't supported on all backends",
[:(histogram(randn(1000); nbins=50, fillto=20))]),
"",
[:(histogram(randn(1000); nbins=50))]),
PlotExample("Subplots",
"""
subplot and subplot! are distinct commands which create many plots and add series to them in a circular fashion.
@@ -83,11 +83,20 @@ const examples = PlotExample[
PlotExample("",
"",
[:(subplot!(randn(100,3)))]),
PlotExample("Open/High/Low/Close",
"Create an OHLC chart. Pass in a vector of 4-tuples as your `y` argument. Adjust the tick width with arg `markersize`.",
[:(n=20), :(hgt=rand(n)+1), :(bot=randn(n)), :(openpct=rand(n)), :(closepct=rand(n)), :(y = [OHLC(openpct[i]*hgt[i]+bot[i], bot[i]+hgt[i], bot[i], closepct[i]*hgt[i]+bot[i]) for i in 1:n]), :(ohlc(y; markersize=8))]),
]
function createStringOfMarkDownCodeValues(arr, prefix = "")
string("`", prefix, join(arr, "`, `$prefix"), "`")
end
createStringOfMarkDownSymbols(arr) = isempty(arr) ? "" : createStringOfMarkDownCodeValues(arr, ":")
function generate_markdown(pkgname::Symbol)
# set up the plotter, and don't show the plots by default
@@ -103,23 +112,30 @@ function generate_markdown(pkgname::Symbol)
md = open("$DOCDIR/$(pkgname)_examples.md", "w")
write(md, "# Examples for backend: $pkgname\n\n")
write(md, "- Supported arguments: $(join(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, "- 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")
for (i,example) in enumerate(examples)
try
# we want to always produce consistent results
srand(1234)
# run the code
map(eval, example.exprs)
# save the png
imgname = "$(pkgname)_example_$i.png"
# NOTE: uncomment this to overwrite the images as well
savepng("$IMGDIR/$pkgname/$imgname")
# write out the header, description, code block, and image link
@@ -171,6 +187,92 @@ function test_all_examples(pkgname::Symbol)
plts
end
# axis # :left or :right
# color # can be a string ("red") or a symbol (:red) or a ColorsTypes.jl
# # Colorant (RGB(1,0,0)) or :auto (which lets the package pick)
# label # string or symbol, applies to that line, may go in a legend
# width # width of a line
# linetype # :line, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar
# linestyle # :solid, :dash, :dot, :dashdot, :dashdotdot
# marker # :none, :ellipse, :rect, :diamond, :utriangle, :dtriangle,
# # :cross, :xcross, :star1, :star2, :hexagon
# markercolor # same choices as `color`, or :match will set the color to be the same as `color`
# markersize # size of the marker
# nbins # number of bins for heatmap/hexbin and histograms
# heatmap_c # color cutoffs for Qwt heatmaps
# fillto # fillto value for area plots
# title # string or symbol, title of the plot
# xlabel # string or symbol, label on the bottom (x) axis
# ylabel # string or symbol, label on the left (y) axis
# yrightlabel # string or symbol, label on the right (y) axis
# reg # true or false, add a regression line for each line
# size # (Int,Int), resize the enclosing window
# pos # (Int,Int), move the enclosing window to this position
# windowtitle # string or symbol, set the title of the enclosing windowtitle
# screen # Integer, move enclosing window to this screen number (for multiscreen desktops)
const _ltdesc = Dict(
:none => "No line",
:line => "Lines with sorted x-axis",
:path => "Lines",
:steppre => "Step plot (vertical then horizontal)",
:steppost => "Step plot (horizontal then vertical)",
:sticks => "Vertical lines",
:scatter => "Points, no lines",
:heatmap => "Colored regions by density",
:hexbin => "Similar to heatmap",
:hist => "Histogram (doesn't use x)",
:bar => "Bar plot (centered on x values)",
:hline => "Horizontal line (doesn't use x)",
:vline => "Vertical line (doesn't use x)",
:ohlc => "Open/High/Low/Close chart (expects y is AbstractVector{Plots.OHLC})",
)
function buildReadme()
readme = readall("$DOCDIR/readme_template.md")
# build keyword arg table
table = "Keyword | Default | Type | Aliases \n---- | ---- | ---- | ----\n"
for d in (Plots._seriesDefaults, Plots._plotDefaults)
for k in Plots.sortedkeys(d)
aliasstr = createStringOfMarkDownSymbols(aliases(Plots._keyAliases, k))
table = string(table, "`:$k` | `$(d[k])` | $(d==Plots._seriesDefaults ? "Series" : "Plot") | $aliasstr \n")
end
end
readme = replace(readme, "[[KEYWORD_ARGS_TABLE]]", table)
# build linetypes table
table = "Type | Desc | Aliases\n---- | ---- | ----\n"
for lt in Plots._allTypes
aliasstr = createStringOfMarkDownSymbols(aliases(Plots._typeAliases, lt))
table = string(table, "`:$lt` | $(_ltdesc[lt]) | $aliasstr \n")
end
readme = replace(readme, "[[LINETYPES_TABLE]]", table)
# build linestyles table
table = "Type | Aliases\n---- | ----\n"
for s in Plots._allStyles
aliasstr = createStringOfMarkDownSymbols(aliases(Plots._styleAliases, s))
table = string(table, "`:$s` | $aliasstr \n")
end
readme = replace(readme, "[[LINESTYLES_TABLE]]", table)
# build markers table
table = "Type | Aliases\n---- | ----\n"
for s in Plots._allMarkers
aliasstr = createStringOfMarkDownSymbols(aliases(Plots._markerAliases, s))
table = string(table, "`:$s` | $aliasstr \n")
end
readme = replace(readme, "[[MARKERS_TABLE]]", table)
readme_fn = Pkg.dir("Plots") * "/README.md"
f = open(readme_fn, "w")
write(f, readme)
close(f)
end
# run it!
# note: generate separately so it's easy to comment out
# @osx_only generate_markdown(:unicodeplots)
@@ -178,6 +280,7 @@ end
# generate_markdown(:gadfly)
# generate_markdown(:pyplot)
# generate_markdown(:immerse)
# generate_markdown(:winston)
end # module
+45 -22
View File
@@ -1,18 +1,25 @@
# 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: [:auto,:left]
- Supported values for linetype: [:line,:step,:sticks,:scatter,:heatmap,:hexbin,:hist,:bar]
- Supported values for linestyle: [:auto,:solid]
- Supported values for marker: [:none,:auto,:rect,:ellipse,:diamond,:cross]
- Supported arguments: `args`, `axis`, `background_color`, `color`, `fillto`, `foreground_color`, `group`, `kwargs`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `nbins`, `reg`, `ribbon`, `show`, `size`, `title`, `width`, `windowtitle`, `xlabel`, `xticks`, `ylabel`, `yrightlabel`, `yticks`
- Supported values for axis: `:auto`, `:left`
- Supported values for linetype: `:none`, `:line`, `:path`, `: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`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`, `:star2`, `:hexagon`, `:octagon`
- Is `subplot`/`subplot!` supported? Yes
### Initialize
```julia
using Plots
gadfly!()
```
### Lines
A simple line plot of the 3 columns.
```julia
plot(rand(100,3))
plot(rand(50,5),w=3)
```
![](../img/gadfly/gadfly_example_1.png)
@@ -44,7 +51,7 @@ Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, um
```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
sin(2x)
end),0,2π)
end),0,2π,legend=false,fillto=0)
```
![](../img/gadfly/gadfly_example_4.png)
@@ -54,7 +61,7 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li
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))
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2))
```
![](../img/gadfly/gadfly_example_5.png)
@@ -66,7 +73,7 @@ Use the `axis` or `axiss` arguments.
Note: Currently only supported with Qwt and PyPlot
```julia
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel="RIGHT")
```
![](../img/gadfly/gadfly_example_6.png)
@@ -96,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0)
and add to it later.
```julia
scatter!(rand(100); markersize=6,color=:blue)
scatter!(rand(100); markersize=6,c=:blue)
```
![](../img/gadfly/gadfly_example_9.png)
@@ -111,38 +118,38 @@ heatmap(randn(10000),randn(10000); nbins=100)
![](../img/gadfly/gadfly_example_10.png)
### Suported line types
### Line types
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
```julia
types = intersect(supportedTypes(),[:line,:step,:stepinverted,:sticks,:scatter])
types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scatter])
n = length(types)
x = Vector[sort(rand(20)) for i = 1:n]
y = rand(20,n)
plot(x,y; linetypes=types,labels=map(string,types))
plot(x,y; t=types,lab=map(string,types))
```
![](../img/gadfly/gadfly_example_11.png)
### Supported line styles
### Line styles
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
```julia
styles = setdiff(supportedStyles(),[:auto])
plot(rand(20,length(styles)); linestyle=:auto,labels=map(string,styles))
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5)
```
![](../img/gadfly/gadfly_example_12.png)
### Supported marker types
### Marker types
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
```julia
markers = setdiff(supportedMarkers(),[:none,:auto])
plot([fill(i,10) for i = 1:length(markers)]; marker=:auto,labels=map(string,markers),markersize=10)
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),markersize=10)
```
![](../img/gadfly/gadfly_example_13.png)
@@ -159,10 +166,10 @@ bar(randn(1000))
### Histogram
note: fillto isn't supported on all backends
```julia
histogram(randn(1000); nbins=50,fillto=20)
histogram(randn(1000); nbins=50)
```
![](../img/gadfly/gadfly_example_15.png)
@@ -202,3 +209,19 @@ subplot!(randn(100,3))
![](../img/gadfly/gadfly_example_18.png)
### Open/High/Low/Close
Create an OHLC chart. Pass in a vector of 4-tuples as your `y` argument. Adjust the tick width with arg `markersize`.
```julia
n = 20
hgt = rand(n) + 1
bot = randn(n)
openpct = rand(n)
closepct = rand(n)
y = [OHLC(openpct[i] * hgt[i] + bot[i],bot[i] + hgt[i],bot[i],closepct[i] * hgt[i] + bot[i]) for i = 1:n]
ohlc(y; markersize=8)
```
![](../img/gadfly/gadfly_example_19.png)
+45 -22
View File
@@ -1,18 +1,25 @@
# Examples for backend: immerse
- 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]
- Supported values for linetype: [:line,:step,:sticks,:scatter,:heatmap,:hexbin,:hist,:bar]
- Supported values for linestyle: [:auto,:solid]
- Supported values for marker: [:none,:auto,:rect,:ellipse,:diamond,:cross]
- Supported arguments: `args`, `axis`, `background_color`, `color`, `fillto`, `foreground_color`, `group`, `kwargs`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `nbins`, `reg`, `ribbon`, `show`, `size`, `title`, `width`, `windowtitle`, `xlabel`, `xticks`, `ylabel`, `yrightlabel`, `yticks`
- Supported values for axis: `:auto`, `:left`
- Supported values for linetype: `:none`, `:line`, `:path`, `: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`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`, `:star2`, `:hexagon`, `:octagon`
- Is `subplot`/`subplot!` supported? Yes
### Initialize
```julia
using Plots
immerse!()
```
### Lines
A simple line plot of the 3 columns.
```julia
plot(rand(100,3))
plot(rand(50,5),w=3)
```
![](../img/immerse/immerse_example_1.png)
@@ -44,7 +51,7 @@ Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, um
```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
sin(2x)
end),0,2π)
end),0,2π,legend=false,fillto=0)
```
![](../img/immerse/immerse_example_4.png)
@@ -54,7 +61,7 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li
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))
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2))
```
![](../img/immerse/immerse_example_5.png)
@@ -66,7 +73,7 @@ Use the `axis` or `axiss` arguments.
Note: Currently only supported with Qwt and PyPlot
```julia
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel="RIGHT")
```
![](../img/immerse/immerse_example_6.png)
@@ -96,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0)
and add to it later.
```julia
scatter!(rand(100); markersize=6,color=:blue)
scatter!(rand(100); markersize=6,c=:blue)
```
![](../img/immerse/immerse_example_9.png)
@@ -111,38 +118,38 @@ heatmap(randn(10000),randn(10000); nbins=100)
![](../img/immerse/immerse_example_10.png)
### Suported line types
### Line types
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
```julia
types = intersect(supportedTypes(),[:line,:step,:stepinverted,:sticks,:scatter])
types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scatter])
n = length(types)
x = Vector[sort(rand(20)) for i = 1:n]
y = rand(20,n)
plot(x,y; linetypes=types,labels=map(string,types))
plot(x,y; t=types,lab=map(string,types))
```
![](../img/immerse/immerse_example_11.png)
### Supported line styles
### Line styles
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
```julia
styles = setdiff(supportedStyles(),[:auto])
plot(rand(20,length(styles)); linestyle=:auto,labels=map(string,styles))
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5)
```
![](../img/immerse/immerse_example_12.png)
### Supported marker types
### Marker types
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
```julia
markers = setdiff(supportedMarkers(),[:none,:auto])
plot([fill(i,10) for i = 1:length(markers)]; marker=:auto,labels=map(string,markers),markersize=10)
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),markersize=10)
```
![](../img/immerse/immerse_example_13.png)
@@ -159,10 +166,10 @@ bar(randn(1000))
### Histogram
note: fillto isn't supported on all backends
```julia
histogram(randn(1000); nbins=50,fillto=20)
histogram(randn(1000); nbins=50)
```
![](../img/immerse/immerse_example_15.png)
@@ -202,3 +209,19 @@ subplot!(randn(100,3))
![](../img/immerse/immerse_example_18.png)
### Open/High/Low/Close
Create an OHLC chart. Pass in a vector of 4-tuples as your `y` argument. Adjust the tick width with arg `markersize`.
```julia
n = 20
hgt = rand(n) + 1
bot = randn(n)
openpct = rand(n)
closepct = rand(n)
y = [OHLC(openpct[i] * hgt[i] + bot[i],bot[i] + hgt[i],bot[i],closepct[i] * hgt[i] + bot[i]) for i = 1:n]
ohlc(y; markersize=8)
```
![](../img/immerse/immerse_example_19.png)
+29 -22
View File
@@ -1,18 +1,25 @@
# Examples for backend: pyplot
- 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]
- Supported values for marker: [:none,:auto,:ellipse,:rect,:diamond,:utriangle,:dtriangle,:cross,:xcross,:star1,:hexagon]
- Supported arguments: `args`, `axis`, `background_color`, `color`, `foreground_color`, `group`, `kwargs`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `nbins`, `ribbon`, `show`, `size`, `title`, `width`, `windowtitle`, `xlabel`, `xticks`, `ylabel`, `yrightlabel`, `yticks`
- Supported values for axis: `:auto`, `:left`, `:right`
- Supported values for linetype: `:none`, `:line`, `:path`, `:step`, `:stepinverted`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`
- Supported values for marker: `:none`, `:auto`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`, `:hexagon`
- Is `subplot`/`subplot!` supported? No
### Initialize
```julia
using Plots
pyplot!()
```
### Lines
A simple line plot of the 3 columns.
```julia
plot(rand(100,3))
plot(rand(50,5),w=3)
```
![](../img/pyplot/pyplot_example_1.png)
@@ -44,7 +51,7 @@ Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, um
```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
sin(2x)
end),0,2π)
end),0,2π,legend=false,fillto=0)
```
![](../img/pyplot/pyplot_example_4.png)
@@ -54,7 +61,7 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li
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))
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2))
```
![](../img/pyplot/pyplot_example_5.png)
@@ -66,7 +73,7 @@ Use the `axis` or `axiss` arguments.
Note: Currently only supported with Qwt and PyPlot
```julia
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel="RIGHT")
```
![](../img/pyplot/pyplot_example_6.png)
@@ -96,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0)
and add to it later.
```julia
scatter!(rand(100); markersize=6,color=:blue)
scatter!(rand(100); markersize=6,c=:blue)
```
![](../img/pyplot/pyplot_example_9.png)
@@ -111,38 +118,38 @@ heatmap(randn(10000),randn(10000); nbins=100)
![](../img/pyplot/pyplot_example_10.png)
### Suported line types
### Line types
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
```julia
types = intersect(supportedTypes(),[:line,:step,:stepinverted,:sticks,:scatter])
types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scatter])
n = length(types)
x = Vector[sort(rand(20)) for i = 1:n]
y = rand(20,n)
plot(x,y; linetypes=types,labels=map(string,types))
plot(x,y; t=types,lab=map(string,types))
```
![](../img/pyplot/pyplot_example_11.png)
### Supported line styles
### Line styles
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
```julia
styles = setdiff(supportedStyles(),[:auto])
plot(rand(20,length(styles)); linestyle=:auto,labels=map(string,styles))
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5)
```
![](../img/pyplot/pyplot_example_12.png)
### Supported marker types
### Marker types
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
```julia
markers = setdiff(supportedMarkers(),[:none,:auto])
plot([fill(i,10) for i = 1:length(markers)]; marker=:auto,labels=map(string,markers),markersize=10)
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),markersize=10)
```
![](../img/pyplot/pyplot_example_13.png)
@@ -159,10 +166,10 @@ bar(randn(1000))
### Histogram
note: fillto isn't supported on all backends
```julia
histogram(randn(1000); nbins=50,fillto=20)
histogram(randn(1000); nbins=50)
```
![](../img/pyplot/pyplot_example_15.png)
+29 -22
View File
@@ -1,18 +1,25 @@
# 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]
- Supported arguments: `args`, `axis`, `background_color`, `color`, `fillto`, `foreground_color`, `group`, `heatmap_c`, `kwargs`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `nbins`, `reg`, `ribbon`, `show`, `size`, `title`, `width`, `windowtitle`, `xlabel`, `xticks`, `ylabel`, `yrightlabel`, `yticks`
- Supported values for axis: `:auto`, `:left`, `:right`
- Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot`
- Supported values for marker: `:none`, `:auto`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`, `:star2`, `:hexagon`
- Is `subplot`/`subplot!` supported? Yes
### Initialize
```julia
using Plots
qwt!()
```
### Lines
A simple line plot of the 3 columns.
```julia
plot(rand(100,3))
plot(rand(50,5),w=3)
```
![](../img/qwt/qwt_example_1.png)
@@ -44,7 +51,7 @@ Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, um
```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
sin(2x)
end),0,2π)
end),0,2π,legend=false,fillto=0)
```
![](../img/qwt/qwt_example_4.png)
@@ -54,7 +61,7 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li
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))
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2))
```
![](../img/qwt/qwt_example_5.png)
@@ -66,7 +73,7 @@ Use the `axis` or `axiss` arguments.
Note: Currently only supported with Qwt and PyPlot
```julia
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel="RIGHT")
```
![](../img/qwt/qwt_example_6.png)
@@ -96,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0)
and add to it later.
```julia
scatter!(rand(100); markersize=6,color=:blue)
scatter!(rand(100); markersize=6,c=:blue)
```
![](../img/qwt/qwt_example_9.png)
@@ -111,38 +118,38 @@ heatmap(randn(10000),randn(10000); nbins=100)
![](../img/qwt/qwt_example_10.png)
### Suported line types
### Line types
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
```julia
types = intersect(supportedTypes(),[:line,:step,:stepinverted,:sticks,:scatter])
types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scatter])
n = length(types)
x = Vector[sort(rand(20)) for i = 1:n]
y = rand(20,n)
plot(x,y; linetypes=types,labels=map(string,types))
plot(x,y; t=types,lab=map(string,types))
```
![](../img/qwt/qwt_example_11.png)
### Supported line styles
### Line styles
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
```julia
styles = setdiff(supportedStyles(),[:auto])
plot(rand(20,length(styles)); linestyle=:auto,labels=map(string,styles))
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5)
```
![](../img/qwt/qwt_example_12.png)
### Supported marker types
### Marker types
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
```julia
markers = setdiff(supportedMarkers(),[:none,:auto])
plot([fill(i,10) for i = 1:length(markers)]; marker=:auto,labels=map(string,markers),markersize=10)
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),markersize=10)
```
![](../img/qwt/qwt_example_13.png)
@@ -159,10 +166,10 @@ bar(randn(1000))
### Histogram
note: fillto isn't supported on all backends
```julia
histogram(randn(1000); nbins=50,fillto=20)
histogram(randn(1000); nbins=50)
```
![](../img/qwt/qwt_example_15.png)
+248
View File
@@ -0,0 +1,248 @@
# Plots
[![Build Status](https://travis-ci.org/tbreloff/Plots.jl.svg?branch=master)](https://travis-ci.org/tbreloff/Plots.jl)
#### Author: Thomas Breloff (@tbreloff)
Plots is a plotting interface and wrapper for several plotting packages. My goals with the package are:
- Simple. The interface should be intuitive enough that someone coming from Matlab, Python, etc can immediately start generating complex plots without reading volumes of documentation.
- Automatic (if you want). There should be smart defaults for the most common functionality, and simple, high-level ways to override complex functionality.
- Flexible. You should be able to produce your favorite plot in your favorite package, but quicker and simpler.
- Consistent. Don't commit to one graphics package. One command will switch your backend, and the exact same plotting commands will work with a very different underlying backend.
Please add wishlist items, bugs, or any other comments/questions to the issues list.
## Examples for each implemented backend:
- [Qwt.jl](docs/qwt_examples.md)
- [Gadfly.jl](docs/gadfly_examples.md)
- [UnicodePlots.jl](docs/unicodeplots_examples.md)
- [PyPlot.jl](docs/pyplot_examples.md)
- [Immerse.jl](docs/immerse_examples.md)
- [Winston.jl](docs/winston_examples.md)
## Installation
First, add the package
```julia
Pkg.add("Plots")
```
then get any plotting packages you need (obviously, you should get at least one backend):
```julia
Pkg.add("Gadfly")
Pkg.add("Immerse")
Pkg.add("UnicodePlots")
Pkg.add("PyPlot") # requires python and matplotlib
Pkg.clone("https://github.com/tbreloff/Qwt.jl.git") # requires pyqt and pyqwt
Pkg.add("Winston")
```
## Use
Load it in. The underlying plotting backends are not imported until `plotter()` is called (which happens
on your first call to `plot` or `subplot`). This means that you don't need any backends to be installed when you call `using Plots`.
Plots will try to figure out a good default backend for you automatically based on what backends are installed.
```julia
using Plots
```
Do a plot in Gadfly, then save a png:
```julia
# switch to Gadfly as a backend
gadfly!()
# This will bring up a browser window with the plot. Add a semicolon at the end to skip display.
plot(rand(10,2); marker = :rect, markersize = [10,30], style = :auto)
# save it as a PNG
savepng(Plots.IMG_DIR * "gadfly1.png")
```
which saves:
![gadfly_plt](img/gadfly1.png)
See the examples pages for lots of examples of plots, and what those commands produce for each supported backend.
## API
Call `plotter!(backend::Symbol)` or the shorthands (`gadfly!()`, `qwt!()`, `unicodeplots!()`, etc) to set the current plotting backend.
Subsequent commands are converted into the relevant plotting commands for that package:
```julia
gadfly!()
plot(1:10) # this effectively calls `y = 1:10; Gadfly.plot(x=1:length(y), y=y)`
qwt!()
plot(1:10) # this effectively calls `Qwt.plot(1:10)`
```
Use `plot` to create a new plot object, and `plot!` to add to an existing one:
```julia
plot(args...; kw...) # creates a new plot window, and sets it to be the `currentPlot`
plot!(args...; kw...) # adds to the `currentPlot`
plot!(plotobj, args...; kw...) # adds to the plot `plotobj`
```
Now that you know which plot object you're updating (new, current, or other), I'll leave it off for simplicity.
There are many ways to pass in data to the plot functions... some examples:
- Vector-like (subtypes of AbstractArray{T,1})
- Matrix-like (subtypes of AbstractArray{T,2})
- Vectors of Vectors
- Functions
- Vectors of Functions
- DataFrames with column symbols (initialize with `dataframes!()`)
In general, you can pass in a `y` only, or an `x` and `y`, both of whatever type(s) you want, and Plots will slice up the data as needed.
For matrices, data is split by columns. For functions, data is mapped. For DataFrames, a Symbol/Symbols in place of x/y will map to
the relevant column(s).
Here are some example usages... remember you can always use `plot!` to update an existing plot, and that, unless specified, you will update the `currentPlot()`.
```julia
plot() # empty plot object
plot(4) # initialize with 4 empty series
plot(rand(10)) # plot 1 series... x = 1:10
plot(rand(10,5)) # plot 5 series... x = 1:10
plot(rand(10), rand(10)) # plot 1 series
plot(rand(10,5), rand(10)) # plot 5 series... y is the same for all
plot(sin, rand(10)) # y = sin(x)
plot(rand(10), sin) # same... y = sin(x)
plot([sin,cos], 0:0.1:π) # plot 2 series, sin(x) and cos(x)
plot([sin,cos], 0, π) # plot sin and cos on the range [0, π]
plot(1:10, Any[rand(10), sin]) # plot 2 series, y = rand(10) for the first, y = sin(x) for the second... x = 1:10 for both
plot(dataset("Ecdat", "Airline"), :Cost) # plot from a DataFrame (call `dataframes!()` first to import DataFrames and initialize)
```
You can update certain plot settings after plot creation (not supported on all backends):
```julia
plot!(title = "New Title", xlabel = "New xlabel", ylabel = "New ylabel")
plot!(xlims = (0, 5.5), ylims = (-2.2, 6), xticks = 0:0.5:10, yticks = [0,1,5,10])
```
With `subplot`, create multiple plots at once, with flexible layout options:
```julia
y = rand(100,3)
subplot(y; n = 3) # create an automatic grid, and let it figure out the shape
subplot(y; n = 3, nr = 1) # create an automatic grid, but fix the number of rows
subplot(y; n = 3, nc = 1) # create an automatic grid, but fix the number of columns
subplot(y; layout = [1, 2]) # explicit layout. Lists the number of plots in each row
```
__Tip__: You can call `subplot!(args...; kw...)` to add to an existing subplot.
__Tip__: Calling `subplot!` on a `Plot` object, or `plot!` on a `Subplot` object will throw an error.
Shorthands:
```julia
scatter(args...; kw...) = plot(args...; kw..., linetype = :scatter)
scatter!(args...; kw...) = plot!(args...; kw..., linetype = :scatter)
bar(args...; kw...) = plot(args...; kw..., linetype = :bar)
bar!(args...; kw...) = plot!(args...; kw..., linetype = :bar)
histogram(args...; kw...) = plot(args...; kw..., linetype = :hist)
histogram!(args...; kw...) = plot!(args...; kw..., linetype = :hist)
heatmap(args...; kw...) = plot(args...; kw..., linetype = :heatmap)
heatmap!(args...; kw...) = plot!(args...; kw..., linetype = :heatmap)
sticks(args...; kw...) = plot(args...; kw..., linetype = :sticks, marker = :ellipse)
sticks!(args...; kw...) = plot!(args...; kw..., linetype = :sticks, marker = :ellipse)
hline(args...; kw...) = plot(args...; kw..., linetype = :hline)
hline!(args...; kw...) = plot!(args...; kw..., linetype = :hline)
vline(args...; kw...) = plot(args...; kw..., linetype = :vline)
vline!(args...; kw...) = plot!(args...; kw..., linetype = :vline)
ohlc(args...; kw...) = plot(args...; kw..., linetype = :ohlc)
ohlc!(args...; kw...) = plot!(args...; kw..., linetype = :ohlc)
title!(s::AbstractString) = plot!(title = s)
xlabel!(s::AbstractString) = plot!(xlabel = s)
ylabel!(s::AbstractString) = plot!(ylabel = s)
xlims!{T<:Real,S<:Real}(lims::Tuple{T,S}) = plot!(xlims = lims)
ylims!{T<:Real,S<:Real}(lims::Tuple{T,S}) = plot!(ylims = lims)
xticks!{T<:Real}(v::AVec{T}) = plot!(xticks = v)
yticks!{T<:Real}(v::AVec{T}) = plot!(yticks = v)
```
Some keyword arguments you can set:
[[KEYWORD_ARGS_TABLE]]
Plot types:
[[LINETYPES_TABLE]]
Line styles:
[[LINESTYLES_TABLE]]
Markers:
[[MARKERS_TABLE]]
__Tip__: You can see the default value for a given argument with `plotDefault(arg::Symbol)`, and set the default value with `plotDefault!(arg::Symbol, value)`
__Tip__: When plotting multiple lines, you can set all series to use the same value, or pass in an array to cycle through values. Example:
```julia
plot(rand(100,4); color = [:red, RGB(0,0,1)], # lines 1 and 3 are red, lines 2 and 4 are blue
axis = :auto, # lines 1 and 3 are on the left axis, lines 2 and 4 are on the right
width = 5) # all lines have a width of 5
```
__Tip__: Not all features are supported for each backend, but you can see what's supported by calling the functions: `supportedArgs()`, `supportedAxes()`, `supportedTypes()`, `supportedStyles()`, `supportedMarkers()`, `subplotSupported()`
__Tip__: Call `gui()` to display the plot in a window. Interactivity depends on backend. Plotting at the REPL (without semicolon) implicitly calls `gui()`.
## TODO features:
- [x] Plot vectors/matrices/functions
- [x] Plot DataFrames
- [ ] Scales
- [ ] Categorical Inputs (strings, etc... for hist, bar? or can split one series into multiple?)
- [ ] Custom markers
- [ ] Special plots (boxplot, ohlc?)
- [x] Subplots
- [x] Histograms
- [ ] 3D plotting
- [ ] Scenes/Drawing
- [ ] Graphs
- [ ] Interactivity (GUIs)
## TODO backends:
- [x] Gadfly.jl
- [x] Immerse.jl
- [x] PyPlot.jl
- [x] UnicodePlots.jl
- [x] Qwt.jl
- [x] Winston.jl
- [ ] GLPlot.jl
- [ ] Bokeh.jl
- [ ] Vega.jl
- [ ] Gaston.jl
- [ ] Plotly.jl
- [ ] GoogleCharts.jl
- [ ] PLplot.jl
- [ ] TextPlots.jl
- [ ] ASCIIPlots.jl
- [ ] Sparklines.jl
- [ ] Hinton.jl
- [ ] ImageTerm.jl
- [ ] GraphViz.jl
- [ ] TikzGraphs.jl
- [ ] GraphLayout.jl
## More information on backends (both supported and unsupported)
See the wiki at: https://github.com/JuliaPlot/juliaplot_docs/wiki
+45 -16
View File
@@ -1,3 +1,19 @@
# Examples for backend: unicodeplots
- Supported arguments: `args`, `axis`, `color`, `kwargs`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `nbins`, `size`, `title`, `width`, `windowtitle`, `xlabel`, `ylabel`, `yrightlabel`
- Supported values for axis: `:auto`, `:left`
- Supported values for linetype: `:none`, `:line`, `:step`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`
- Supported values for linestyle: `:auto`, `:solid`
- Supported values for marker: `:none`, `:auto`, `:ellipse`
- Is `subplot`/`subplot!` supported? Yes
### Initialize
```julia
using Plots
unicodeplots!()
```
### Lines
A simple line plot of the 3 columns.
@@ -10,7 +26,7 @@ plot(rand(100,3))
### Functions
Plot multiple functions.
Plot multiple functions. You can also put the function first.
```julia
plot(0:0.01:4π,[sin,cos])
@@ -30,10 +46,10 @@ 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
plot(sin,(x->begin # /Users/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:
sin(2x)
end),0,2π)
```
@@ -54,7 +70,7 @@ plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RG
Use the `axis` or `axiss` arguments.
Note: This is only supported with Qwt right now
Note: Currently only supported with Qwt and PyPlot
```julia
plot(Vector[randn(100),randn(100) * 100]; axiss=[:left,:right],ylabel="LEFT",yrightlabel="RIGHT")
@@ -92,35 +108,48 @@ scatter!(rand(100); markersize=6,color=:blue)
![](../img/unicodeplots/unicodeplots_example_9.png)
### Lots of line types
### Heatmaps
Options: (:line, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
Note: some may not work with all backends
```julia
plot(rand(20,4); linetypes=[:line,:step,:sticks,:scatter],labels=["line","step","sticks","dots"])
heatmap(randn(10000),randn(10000); nbins=100)
```
![](../img/unicodeplots/unicodeplots_example_10.png)
### Suported line types
All options: (:line, :orderedline, :step, :stepinverted, :sticks, :scatter, :none, :heatmap, :hexbin, :hist, :bar)
```julia
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; linetypes=types,labels=map(string,types))
```
![](../img/unicodeplots/unicodeplots_example_11.png)
### Lots of line styles
### Supported line styles
Options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
Note: some may not work with all backends
All options: (:solid, :dash, :dot, :dashdot, :dashdotdot)
```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))
```
![](../img/unicodeplots/unicodeplots_example_12.png)
### Lots of marker types
### Supported marker types
Options: (:none, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
Note: some may not work with all backends
All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)
```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"],markersize=10)
markers = setdiff(supportedMarkers(),[:none,:auto])
plot([fill(i,10) for i = 1:length(markers)]; marker=:auto,labels=map(string,markers),markersize=10)
```
![](../img/unicodeplots/unicodeplots_example_13.png)
+166
View File
@@ -0,0 +1,166 @@
# Examples for backend: winston
- Supported arguments: `args`, `axis`, `color`, `foreground_color`, `group`, `kwargs`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markersize`, `nbins`, `reg`, `ribbon`, `show`, `size`, `title`, `width`, `windowtitle`, `xlabel`, `xticks`, `ylabel`, `yrightlabel`, `yticks`
- Supported values for axis: `:auto`, `:left`
- Supported values for linetype: `:none`, `:line`, `:path`, `:sticks`, `:scatter`, `:hist`, `:bar`
- Supported values for linestyle: `:solid`, `:dash`, `:dot`, `:dashdot`
- Supported values for marker: `:none`, `:ellipse`, `:rect`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`
- Is `subplot`/`subplot!` supported? No
### Initialize
```julia
using Plots
winston!()
```
### Lines
A simple line plot of the 3 columns.
```julia
plot(rand(50,5),w=3)
```
![](../img/winston/winston_example_1.png)
### Functions
Plot multiple functions. You can also put the function first.
```julia
plot(0:0.01:4π,[sin,cos])
```
![](../img/winston/winston_example_2.png)
###
You can also call it with plot(f, xmin, xmax).
```julia
plot([sin,cos],0,4π)
```
![](../img/winston/winston_example_3.png)
###
Or make a parametric plot (i.e. plot: (fx(u), fy(u))) with plot(fx, fy, umin, umax).
```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 33:
sin(2x)
end),0,2π,legend=false,fillto=0)
```
![](../img/winston/winston_example_4.png)
### Global
Change the guides/background without a separate call.
```julia
plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2))
```
![](../img/winston/winston_example_5.png)
### Two-axis
Use the `axis` or `axiss` arguments.
Note: Currently only supported with Qwt and PyPlot
```julia
plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel="RIGHT")
```
![](../img/winston/winston_example_6.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/winston/winston_example_7.png)
### Build plot in pieces
Start with a base plot...
```julia
plot(rand(100) / 3; reg=true,fillto=0)
```
![](../img/winston/winston_example_8.png)
###
and add to it later.
```julia
scatter!(rand(100); markersize=6,c=:blue)
```
![](../img/winston/winston_example_9.png)
### Line types
```julia
types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scatter])
n = length(types)
x = Vector[sort(rand(20)) for i = 1:n]
y = rand(20,n)
plot(x,y; t=types,lab=map(string,types))
```
![](../img/winston/winston_example_11.png)
### Line styles
```julia
styles = setdiff(supportedStyles(),[:auto])
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5)
```
![](../img/winston/winston_example_12.png)
### Marker types
```julia
markers = setdiff(supportedMarkers(),[:none,:auto])
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),markersize=10)
```
![](../img/winston/winston_example_13.png)
### Bar
x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)
```julia
bar(randn(1000))
```
![](../img/winston/winston_example_14.png)
### Histogram
```julia
histogram(randn(1000); nbins=50)
```
![](../img/winston/winston_example_15.png)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 363 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Some files were not shown because too many files have changed in this diff Show More