diff --git a/README.md b/README.md index 249a988e..61a1ef2d 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Do a plot in Gadfly (inspired by [this example](http://gadflyjl.org/geom_point.h ```julia gadfly() # switch to Gadfly as a backend -dataframes!() # turn on support for DataFrames inputs +dataframes() # turn on support for DataFrames inputs # load some data using RDatasets @@ -98,7 +98,7 @@ There are many ways to pass in data to the plot functions... some examples: - Vectors of Vectors - Functions - Vectors of Functions -- DataFrames with column symbols (initialize with `dataframes!()`) +- 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 @@ -118,7 +118,7 @@ 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) +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): @@ -162,14 +162,14 @@ 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) +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) -annotate!(annotations) = plot!(annotation = annotations) +annotate!(anns) = plot!(annotation = anns) ``` Some keyword arguments you can set: @@ -187,16 +187,21 @@ Keyword | Default | Type | Aliases `:label` | `AUTO` | Series | `:lab`, `:labels` `:linestyle` | `solid` | Series | `:linestyles`, `:ls`, `:s`, `:style` `:linetype` | `path` | Series | `:linetypes`, `:lt`, `:t`, `:type` -`:marker` | `none` | Series | `:m`, `:markers` +`:marker` | `none` | Series | `:m`, `:markers`, `:shape` `:markercolor` | `match` | Series | `:markercolors`, `:mc`, `:mcolor` `:markersize` | `6` | Series | `:markersizes`, `:ms`, `:msize` `:nbins` | `100` | Series | `:nb`, `:nbin`, `:nbinss` -`:reg` | `false` | Series | `:regs` +`:reg` | `false` | Series | `:regression`, `: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` +`:layout` | `nothing` | Plot | `:legend` | `true` | Plot | `:leg` +`:n` | `-1` | Plot | +`:nc` | `-1` | Plot | +`:nr` | `-1` | Plot | +`:pos` | `(0,0)` | Plot | `:show` | `false` | Plot | `:display`, `:gui` `:size` | `(800,600)` | Plot | `:windowsize`, `:wsize` `:title` | `` | Plot | diff --git a/docs/immerse_examples.md b/docs/immerse_examples.md index 5b380b15..5d293040 100644 --- a/docs/immerse_examples.md +++ b/docs/immerse_examples.md @@ -1,6 +1,6 @@ # Examples for backend: immerse -- 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 arguments: `annotation`, `args`, `background_color`, `color`, `fillto`, `group`, `kwargs`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `reg`, `show`, `size`, `title`, `width`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `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` @@ -11,12 +11,12 @@ ```julia using Plots -immerse() +immerse!() ``` ### Lines -A simple line plot of the 3 columns. +A simple line plot of the columns. ```julia plot(rand(50,5),w=3) @@ -58,17 +58,17 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li ### Global -Change the guides/background without a separate call. +Change the guides/background/limits/ticks. You can also use shorthand functions: `title!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!` ```julia -plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2)) +plot(rand(10),title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2),xlim=(-3,13),yticks=0:0.1:1) ``` ![](../img/immerse/immerse_example_5.png) ### Two-axis -Use the `axis` or `axiss` arguments. +Use the `axis` arguments. Note: Currently only supported with Qwt and PyPlot @@ -83,7 +83,7 @@ plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel 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]) +plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,c=[:red,:blue]) ``` ![](../img/immerse/immerse_example_7.png) @@ -93,7 +93,7 @@ plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue] Start with a base plot... ```julia -plot(rand(100) / 3; reg=true,fillto=0) +plot(rand(100) / 3,reg=true,fillto=0) ``` ![](../img/immerse/immerse_example_8.png) @@ -103,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0) and add to it later. ```julia -scatter!(rand(100); markersize=6,c=:blue) +scatter!(rand(100),markersize=6,c=:blue) ``` ![](../img/immerse/immerse_example_9.png) @@ -113,7 +113,7 @@ scatter!(rand(100); markersize=6,c=:blue) ```julia -heatmap(randn(10000),randn(10000); nbins=100) +heatmap(randn(10000),randn(10000),nbins=100) ``` ![](../img/immerse/immerse_example_10.png) @@ -127,7 +127,7 @@ types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scat 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)) +plot(x,y,t=types,lab=map(string,types)) ``` ![](../img/immerse/immerse_example_11.png) @@ -149,7 +149,7 @@ plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w= ```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) +scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),ms=10) ``` ![](../img/immerse/immerse_example_13.png) @@ -169,7 +169,7 @@ bar(randn(1000)) ```julia -histogram(randn(1000); nbins=50) +histogram(randn(1000),nbins=50) ``` ![](../img/immerse/immerse_example_15.png) @@ -178,13 +178,11 @@ histogram(randn(1000); nbins=50) 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. + number of columns `nc`), or you can set the layout directly with `layout`. ```julia -subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:scatter,:step,:bar],nbins=10,legend=false) +subplot(randn(100,5),layout=[1,1,3],t=[:line,:hist,:scatter,:step,:bar],nbins=10,leg=false) ``` ![](../img/immerse/immerse_example_16.png) @@ -194,7 +192,7 @@ subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:scatter,:step,:bar] 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) +subplot(randn(100,5),n=4) ``` ![](../img/immerse/immerse_example_17.png) @@ -211,7 +209,7 @@ subplot!(randn(100,3)) ### 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`. +Create an OHLC chart. Pass in a vector of OHLC objects as your `y` argument. Adjust the tick width with arg `markersize`. ```julia n = 20 @@ -225,3 +223,15 @@ ohlc(y; markersize=8) ![](../img/immerse/immerse_example_19.png) +### Annotations + +Currently only text annotations are supported. Pass in a tuple or vector-of-tuples: (x,y,text). `annotate!(ann)` is shorthand for `plot!(; annotation=ann)` + +```julia +y = rand(10) +plot(y,ann=(3,y[3],"this is #3")) +annotate!([(5,y[5],"this is #5"),(9,y[10],"this is #10")]) +``` + +![](../img/immerse/immerse_example_20.png) + diff --git a/docs/pyplot_examples.md b/docs/pyplot_examples.md index c7363fee..4c01bd95 100644 --- a/docs/pyplot_examples.md +++ b/docs/pyplot_examples.md @@ -1,6 +1,6 @@ # Examples for backend: pyplot -- 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 arguments: `annotation`, `args`, `axis`, `background_color`, `color`, `foreground_color`, `group`, `kwargs`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `show`, `size`, `title`, `width`, `windowtitle`, `x`, `xlabel`, `y`, `ylabel`, `yrightlabel` - 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` @@ -11,12 +11,12 @@ ```julia using Plots -pyplot() +pyplot!() ``` ### Lines -A simple line plot of the 3 columns. +A simple line plot of the columns. ```julia plot(rand(50,5),w=3) @@ -58,17 +58,17 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li ### Global -Change the guides/background without a separate call. +Change the guides/background/limits/ticks. You can also use shorthand functions: `title!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!` ```julia -plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2)) +plot(rand(10),title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2),xlim=(-3,13),yticks=0:0.1:1) ``` ![](../img/pyplot/pyplot_example_5.png) ### Two-axis -Use the `axis` or `axiss` arguments. +Use the `axis` arguments. Note: Currently only supported with Qwt and PyPlot @@ -83,7 +83,7 @@ plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel 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]) +plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,c=[:red,:blue]) ``` ![](../img/pyplot/pyplot_example_7.png) @@ -93,7 +93,7 @@ plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue] Start with a base plot... ```julia -plot(rand(100) / 3; reg=true,fillto=0) +plot(rand(100) / 3,reg=true,fillto=0) ``` ![](../img/pyplot/pyplot_example_8.png) @@ -103,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0) and add to it later. ```julia -scatter!(rand(100); markersize=6,c=:blue) +scatter!(rand(100),markersize=6,c=:blue) ``` ![](../img/pyplot/pyplot_example_9.png) @@ -113,7 +113,7 @@ scatter!(rand(100); markersize=6,c=:blue) ```julia -heatmap(randn(10000),randn(10000); nbins=100) +heatmap(randn(10000),randn(10000),nbins=100) ``` ![](../img/pyplot/pyplot_example_10.png) @@ -127,7 +127,7 @@ types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scat 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)) +plot(x,y,t=types,lab=map(string,types)) ``` ![](../img/pyplot/pyplot_example_11.png) @@ -149,7 +149,7 @@ plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w= ```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) +scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),ms=10) ``` ![](../img/pyplot/pyplot_example_13.png) @@ -169,8 +169,20 @@ bar(randn(1000)) ```julia -histogram(randn(1000); nbins=50) +histogram(randn(1000),nbins=50) ``` ![](../img/pyplot/pyplot_example_15.png) +### Annotations + +Currently only text annotations are supported. Pass in a tuple or vector-of-tuples: (x,y,text). `annotate!(ann)` is shorthand for `plot!(; annotation=ann)` + +```julia +y = rand(10) +plot(y,ann=(3,y[3],"this is #3")) +annotate!([(5,y[5],"this is #5"),(9,y[10],"this is #10")]) +``` + +![](../img/pyplot/pyplot_example_20.png) + diff --git a/docs/qwt_examples.md b/docs/qwt_examples.md index 3a820a9b..5ba6006e 100644 --- a/docs/qwt_examples.md +++ b/docs/qwt_examples.md @@ -1,6 +1,6 @@ # Examples for backend: qwt -- 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 arguments: `annotation`, `args`, `axis`, `background_color`, `color`, `fillto`, `foreground_color`, `group`, `heatmap_c`, `kwargs`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `pos`, `reg`, `show`, `size`, `title`, `width`, `windowtitle`, `x`, `xlabel`, `y`, `ylabel`, `yrightlabel` - 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` @@ -11,12 +11,12 @@ ```julia using Plots -qwt() +qwt!() ``` ### Lines -A simple line plot of the 3 columns. +A simple line plot of the columns. ```julia plot(rand(50,5),w=3) @@ -58,17 +58,17 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li ### Global -Change the guides/background without a separate call. +Change the guides/background/limits/ticks. You can also use shorthand functions: `title!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!` ```julia -plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2)) +plot(rand(10),title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2),xlim=(-3,13),yticks=0:0.1:1) ``` ![](../img/qwt/qwt_example_5.png) ### Two-axis -Use the `axis` or `axiss` arguments. +Use the `axis` arguments. Note: Currently only supported with Qwt and PyPlot @@ -83,7 +83,7 @@ plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel 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]) +plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,c=[:red,:blue]) ``` ![](../img/qwt/qwt_example_7.png) @@ -93,7 +93,7 @@ plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue] Start with a base plot... ```julia -plot(rand(100) / 3; reg=true,fillto=0) +plot(rand(100) / 3,reg=true,fillto=0) ``` ![](../img/qwt/qwt_example_8.png) @@ -103,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0) and add to it later. ```julia -scatter!(rand(100); markersize=6,c=:blue) +scatter!(rand(100),markersize=6,c=:blue) ``` ![](../img/qwt/qwt_example_9.png) @@ -113,7 +113,7 @@ scatter!(rand(100); markersize=6,c=:blue) ```julia -heatmap(randn(10000),randn(10000); nbins=100) +heatmap(randn(10000),randn(10000),nbins=100) ``` ![](../img/qwt/qwt_example_10.png) @@ -127,7 +127,7 @@ types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scat 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)) +plot(x,y,t=types,lab=map(string,types)) ``` ![](../img/qwt/qwt_example_11.png) @@ -149,7 +149,7 @@ plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w= ```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) +scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),ms=10) ``` ![](../img/qwt/qwt_example_13.png) @@ -169,7 +169,7 @@ bar(randn(1000)) ```julia -histogram(randn(1000); nbins=50) +histogram(randn(1000),nbins=50) ``` ![](../img/qwt/qwt_example_15.png) @@ -178,13 +178,11 @@ histogram(randn(1000); nbins=50) 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. + number of columns `nc`), or you can set the layout directly with `layout`. ```julia -subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:scatter,:step,:bar],nbins=10,legend=false) +subplot(randn(100,5),layout=[1,1,3],t=[:line,:hist,:scatter,:step,:bar],nbins=10,leg=false) ``` ![](../img/qwt/qwt_example_16.png) @@ -194,7 +192,7 @@ subplot(randn(100,5); layout=[1,1,3],linetypes=[:line,:hist,:scatter,:step,:bar] 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) +subplot(randn(100,5),n=4) ``` ![](../img/qwt/qwt_example_17.png) diff --git a/docs/winston_examples.md b/docs/winston_examples.md index 686d5180..efe2fb35 100644 --- a/docs/winston_examples.md +++ b/docs/winston_examples.md @@ -1,6 +1,6 @@ # 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 arguments: `annotation`, `color`, `fillto`, `group`, `label`, `legend`, `linestyle`, `linetype`, `marker`, `markercolor`, `markersize`, `nbins`, `reg`, `show`, `size`, `title`, `width`, `windowtitle`, `x`, `xlabel`, `y`, `ylabel` - 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` @@ -11,12 +11,12 @@ ```julia using Plots -winston() +winston!() ``` ### Lines -A simple line plot of the 3 columns. +A simple line plot of the columns. ```julia plot(rand(50,5),w=3) @@ -58,17 +58,17 @@ plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, li ### Global -Change the guides/background without a separate call. +Change the guides/background/limits/ticks. You can also use shorthand functions: `title!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!` ```julia -plot(rand(10); title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2)) +plot(rand(10),title="TITLE",xlabel="XLABEL",ylabel="YLABEL",background_color=RGB(0.2,0.2,0.2),xlim=(-3,13),yticks=0:0.1:1) ``` ![](../img/winston/winston_example_5.png) ### Two-axis -Use the `axis` or `axiss` arguments. +Use the `axis` arguments. Note: Currently only supported with Qwt and PyPlot @@ -83,7 +83,7 @@ plot(Vector[randn(100),randn(100) * 100]; axis=[:l,:r],ylabel="LEFT",yrightlabel 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]) +plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,c=[:red,:blue]) ``` ![](../img/winston/winston_example_7.png) @@ -93,7 +93,7 @@ plot(Vector[rand(10),rand(20)]; marker=:ellipse,markersize=8,colors=[:red,:blue] Start with a base plot... ```julia -plot(rand(100) / 3; reg=true,fillto=0) +plot(rand(100) / 3,reg=true,fillto=0) ``` ![](../img/winston/winston_example_8.png) @@ -103,7 +103,7 @@ plot(rand(100) / 3; reg=true,fillto=0) and add to it later. ```julia -scatter!(rand(100); markersize=6,c=:blue) +scatter!(rand(100),markersize=6,c=:blue) ``` ![](../img/winston/winston_example_9.png) @@ -117,7 +117,7 @@ types = intersect(supportedTypes(),[:line,:path,:steppre,:steppost,:sticks,:scat 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)) +plot(x,y,t=types,lab=map(string,types)) ``` ![](../img/winston/winston_example_11.png) @@ -139,7 +139,7 @@ plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w= ```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) +scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),ms=10) ``` ![](../img/winston/winston_example_13.png) @@ -159,8 +159,20 @@ bar(randn(1000)) ```julia -histogram(randn(1000); nbins=50) +histogram(randn(1000),nbins=50) ``` ![](../img/winston/winston_example_15.png) +### Annotations + +Currently only text annotations are supported. Pass in a tuple or vector-of-tuples: (x,y,text). `annotate!(ann)` is shorthand for `plot!(; annotation=ann)` + +```julia +y = rand(10) +plot(y,ann=(3,y[3],"this is #3")) +annotate!([(5,y[5],"this is #5"),(9,y[10],"this is #10")]) +``` + +![](../img/winston/winston_example_20.png) + diff --git a/img/immerse/immerse_example_11.png b/img/immerse/immerse_example_11.png index c5ac0752..761639ea 100644 Binary files a/img/immerse/immerse_example_11.png and b/img/immerse/immerse_example_11.png differ diff --git a/img/immerse/immerse_example_13.png b/img/immerse/immerse_example_13.png index 364caa32..31667818 100644 Binary files a/img/immerse/immerse_example_13.png and b/img/immerse/immerse_example_13.png differ diff --git a/img/immerse/immerse_example_16.png b/img/immerse/immerse_example_16.png index f99be322..14053da3 100644 Binary files a/img/immerse/immerse_example_16.png and b/img/immerse/immerse_example_16.png differ diff --git a/img/immerse/immerse_example_20.png b/img/immerse/immerse_example_20.png new file mode 100644 index 00000000..37a77f79 Binary files /dev/null and b/img/immerse/immerse_example_20.png differ diff --git a/img/immerse/immerse_example_5.png b/img/immerse/immerse_example_5.png index 435e93bc..84e8fad1 100644 Binary files a/img/immerse/immerse_example_5.png and b/img/immerse/immerse_example_5.png differ diff --git a/img/immerse/immerse_example_7.png b/img/immerse/immerse_example_7.png index dfe3947e..1cd74585 100644 Binary files a/img/immerse/immerse_example_7.png and b/img/immerse/immerse_example_7.png differ diff --git a/img/immerse/immerse_example_8.png b/img/immerse/immerse_example_8.png index 5c426b75..9a36493c 100644 Binary files a/img/immerse/immerse_example_8.png and b/img/immerse/immerse_example_8.png differ diff --git a/img/immerse/immerse_example_9.png b/img/immerse/immerse_example_9.png index f2e83f32..653babd5 100644 Binary files a/img/immerse/immerse_example_9.png and b/img/immerse/immerse_example_9.png differ diff --git a/img/pyplot/pyplot_example_20.png b/img/pyplot/pyplot_example_20.png new file mode 100644 index 00000000..308b98bb Binary files /dev/null and b/img/pyplot/pyplot_example_20.png differ diff --git a/img/pyplot/pyplot_example_5.png b/img/pyplot/pyplot_example_5.png index 38953109..80c0387d 100644 Binary files a/img/pyplot/pyplot_example_5.png and b/img/pyplot/pyplot_example_5.png differ diff --git a/img/winston/winston_example_20.png b/img/winston/winston_example_20.png new file mode 100644 index 00000000..6a9758d4 Binary files /dev/null and b/img/winston/winston_example_20.png differ diff --git a/img/winston/winston_example_4.png b/img/winston/winston_example_4.png index bec12644..85947a97 100644 Binary files a/img/winston/winston_example_4.png and b/img/winston/winston_example_4.png differ