pyplot set/get data; examples

This commit is contained in:
Thomas Breloff 2015-10-17 16:17:18 -04:00
parent d48f15ab4d
commit 7200b6adc6
42 changed files with 116 additions and 30 deletions

View File

@ -35,9 +35,9 @@ const examples = PlotExample[
:(plot(fakedata(50,5), w=3)) :(plot(fakedata(50,5), w=3))
]), ]),
PlotExample("Functions, adding data, and animations", PlotExample("Functions, adding data, and animations",
"Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Set, get, and push/append to series data, and easily build animations.\n\nNote: ImageMagick's `convert` or `ffmpeg` must be runnable from pwd to generate the animation.", "Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Set, get, and push/append to series data, and easily build animations.\n\nNote: ImageMagick's `convert` or `ffmpeg` must be runnable from pwd to generate the animation. Use command `gif(anim, filename, fps=15)` to save the animation.",
[ [
:(p = plot([sin,cos], zeros(0))), :(p = plot([sin,cos], zeros(0), leg=false)),
:(anim = Animation()), :(anim = Animation()),
:(for x in linspace(0, 10π, 200) :(for x in linspace(0, 10π, 200)
push!(p, x, Float64[sin(x), cos(x)]) push!(p, x, Float64[sin(x), cos(x)])

View File

@ -1,6 +1,6 @@
# Examples for backend: gadfly # Examples for backend: gadfly
- Supported arguments: `annotation`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `smooth`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`, `tickfont`, `guidefont`, `legendfont` - Supported arguments: `annotation`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `fillopacity`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `lineopacity`, `markershape`, `markercolor`, `markersize`, `markeropacity`, `n`, `nbins`, `nc`, `nr`, `smooth`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`, `tickfont`, `guidefont`, `legendfont`, `grid`
- Supported values for axis: `:auto`, `:left` - Supported values for axis: `:auto`, `:left`
- Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline`, `:ohlc` - Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline`, `:ohlc`
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot` - Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot`
@ -24,22 +24,29 @@ plot(fakedata(50,5),w=3)
![](../img/gadfly/gadfly_example_1.png) ![](../img/gadfly/gadfly_example_1.png)
### Functions ### Functions, adding data, and animations
Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Set, get, and push/append to series data, and easily build animations.
Note: ImageMagick's `convert` or `ffmpeg` must be runnable from pwd to generate the animation.
```julia ```julia
plot(0:0.01:4π,[sin,cos]) p = plot([sin,cos],zeros(0))
anim = Animation()
for x = linspace(0,10π,200) # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 43:
push!(p,x,Float64[sin(x),cos(x)]) # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 44:
frame(anim)
end
``` ```
![](../img/gadfly/gadfly_example_2.png) ![](../img/gadfly/gadfly_example_2.gif)
### ###
Or make a parametric plot (i.e. plot: (fx(u), fy(u))) 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 ```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 40: plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 50:
sin(2x) sin(2x)
end),0,2π,line=4,leg=false,fill=(0,:orange)) end),0,2π,line=4,leg=false,fill=(0,:orange))
``` ```
@ -63,7 +70,9 @@ scatter!(y,z=abs(y - 0.5),m=(10,:heat),lab="grad")
Change the guides/background/limits/ticks. Convenience args `xaxis` and `yaxis` allow you to pass a tuple or value which will be mapped to the relevant args automatically. The `xaxis` below will be replaced with `xlabel` and `xlims` args automatically during the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`, `yaxis!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!` Change the guides/background/limits/ticks. Convenience args `xaxis` and `yaxis` allow you to pass a tuple or value which will be mapped to the relevant args automatically. The `xaxis` below will be replaced with `xlabel` and `xlims` args automatically during the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`, `yaxis!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!`
```julia ```julia
plot(rand(20,3),title="TITLE",xaxis=("XLABEL",(-5,30),0:2:20,:flip),yaxis=("YLABEL",:log10),background_color=RGB(0.2,0.2,0.2),leg=false) plot(rand(20,3),xaxis=("XLABEL",(-5,30),0:2:20,:flip),background_color=RGB(0.2,0.2,0.2),leg=false)
title!("TITLE")
yaxis!("YLABEL",:log10)
``` ```
![](../img/gadfly/gadfly_example_5.png) ![](../img/gadfly/gadfly_example_5.png)
@ -75,7 +84,7 @@ Use the `axis` arguments.
Note: Currently only supported with Qwt and PyPlot Note: Currently only supported with Qwt and PyPlot
```julia ```julia
plot(Vector[randn(100),randn(100) * 100]; axis=[:l :r],ylabel="LEFT",yrightlabel="RIGHT") plot(Vector[randn(100),randn(100) * 100],axis=[:l :r],ylabel="LEFT",yrightlabel="RIGHT")
``` ```
![](../img/gadfly/gadfly_example_6.png) ![](../img/gadfly/gadfly_example_6.png)
@ -85,7 +94,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 (marker/markersize) with arguments unique to each series (colors). Special arguments `line`, `marker`, and `fill` will automatically figure out what arguments to set (for example, we are setting the `linestyle`, `linewidth`, and `color` arguments with `line`.) Note that we pass a matrix of colors, and this applies the colors to each series. Plot multiple series with different numbers of points. Mix arguments that apply to all series (marker/markersize) with arguments unique to each series (colors). Special arguments `line`, `marker`, and `fill` will automatically figure out what arguments to set (for example, we are setting the `linestyle`, `linewidth`, and `color` arguments with `line`.) Note that we pass a matrix of colors, and this applies the colors to each series.
```julia ```julia
plot(Vector[rand(10),rand(20)]; marker=(:ellipse,8),line=(:dot,3,[:black :orange])) plot(Vector[rand(10),rand(20)],marker=(:ellipse,8),line=(:dot,3,[:black :orange]))
``` ```
![](../img/gadfly/gadfly_example_7.png) ![](../img/gadfly/gadfly_example_7.png)
@ -140,7 +149,7 @@ plot(x,y,line=(types,3),lab=map(string,types),ms=15)
```julia ```julia
styles = setdiff(supportedStyles(),[:auto])' styles = setdiff(supportedStyles(),[:auto])'
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5) plot(cumsum(randn(20,length(styles)),1),style=:auto,label=map(string,styles),w=5)
``` ```
![](../img/gadfly/gadfly_example_12.png) ![](../img/gadfly/gadfly_example_12.png)

View File

@ -2,10 +2,10 @@
- Supported arguments: `annotation`, `axis`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yrightlabel`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z` - Supported arguments: `annotation`, `axis`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yrightlabel`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`
- Supported values for axis: `:auto`, `:left`, `:right` - Supported values for axis: `:auto`, `:left`, `:right`
- Supported values for linetype: `:none`, `:line`, `:path`, `:step`, `:stepinverted`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline` - Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline`
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot` - Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`
- Supported values for marker: `:none`, `:auto`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`, `:hexagon` - Supported values for marker: `:none`, `:auto`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star5`, `:hexagon`
- Is `subplot`/`subplot!` supported? No - Is `subplot`/`subplot!` supported? Yes
### Initialize ### Initialize
@ -24,22 +24,29 @@ plot(fakedata(50,5),w=3)
![](../img/pyplot/pyplot_example_1.png) ![](../img/pyplot/pyplot_example_1.png)
### Functions ### Functions, adding data, and animations
Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Plot multiple functions. You can also put the function first, or use the form `plot(f, xmin, xmax)` where f is a Function or AbstractVector{Function}. Set, get, and push/append to series data, and easily build animations.
Note: ImageMagick's `convert` or `ffmpeg` must be runnable from pwd to generate the animation. Use command `gif(anim, filename, fps=15)` to save the animation.
```julia ```julia
plot(0:0.01:4π,[sin,cos]) p = plot([sin,cos],zeros(0),leg=false)
anim = Animation()
for x = linspace(0,10π,200) # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 43:
push!(p,x,Float64[sin(x),cos(x)]) # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 44:
frame(anim)
end
``` ```
![](../img/pyplot/pyplot_example_2.png) ![](../img/pyplot/pyplot_example_2.gif)
### ###
Or make a parametric plot (i.e. plot: (fx(u), fy(u))) 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 ```julia
plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 40: plot(sin,(x->begin # /home/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 50:
sin(2x) sin(2x)
end),0,2π,line=4,leg=false,fill=(0,:orange)) end),0,2π,line=4,leg=false,fill=(0,:orange))
``` ```
@ -63,7 +70,9 @@ scatter!(y,z=abs(y - 0.5),m=(10,:heat),lab="grad")
Change the guides/background/limits/ticks. Convenience args `xaxis` and `yaxis` allow you to pass a tuple or value which will be mapped to the relevant args automatically. The `xaxis` below will be replaced with `xlabel` and `xlims` args automatically during the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`, `yaxis!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!` Change the guides/background/limits/ticks. Convenience args `xaxis` and `yaxis` allow you to pass a tuple or value which will be mapped to the relevant args automatically. The `xaxis` below will be replaced with `xlabel` and `xlims` args automatically during the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`, `yaxis!`, `xlabel!`, `ylabel!`, `xlims!`, `ylims!`, `xticks!`, `yticks!`
```julia ```julia
plot(rand(20,3),title="TITLE",xaxis=("XLABEL",(-5,30),0:2:20,:flip),yaxis=("YLABEL",:log10),background_color=RGB(0.2,0.2,0.2),leg=false) plot(rand(20,3),xaxis=("XLABEL",(-5,30),0:2:20,:flip),background_color=RGB(0.2,0.2,0.2),leg=false)
title!("TITLE")
yaxis!("YLABEL",:log10)
``` ```
![](../img/pyplot/pyplot_example_5.png) ![](../img/pyplot/pyplot_example_5.png)
@ -75,7 +84,7 @@ Use the `axis` arguments.
Note: Currently only supported with Qwt and PyPlot Note: Currently only supported with Qwt and PyPlot
```julia ```julia
plot(Vector[randn(100),randn(100) * 100]; axis=[:l :r],ylabel="LEFT",yrightlabel="RIGHT") plot(Vector[randn(100),randn(100) * 100],axis=[:l :r],ylabel="LEFT",yrightlabel="RIGHT")
``` ```
![](../img/pyplot/pyplot_example_6.png) ![](../img/pyplot/pyplot_example_6.png)
@ -85,7 +94,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 (marker/markersize) with arguments unique to each series (colors). Special arguments `line`, `marker`, and `fill` will automatically figure out what arguments to set (for example, we are setting the `linestyle`, `linewidth`, and `color` arguments with `line`.) Note that we pass a matrix of colors, and this applies the colors to each series. Plot multiple series with different numbers of points. Mix arguments that apply to all series (marker/markersize) with arguments unique to each series (colors). Special arguments `line`, `marker`, and `fill` will automatically figure out what arguments to set (for example, we are setting the `linestyle`, `linewidth`, and `color` arguments with `line`.) Note that we pass a matrix of colors, and this applies the colors to each series.
```julia ```julia
plot(Vector[rand(10),rand(20)]; marker=(:ellipse,8),line=(:dot,3,[:black :orange])) plot(Vector[rand(10),rand(20)],marker=(:ellipse,8),line=(:dot,3,[:black :orange]))
``` ```
![](../img/pyplot/pyplot_example_7.png) ![](../img/pyplot/pyplot_example_7.png)
@ -140,7 +149,7 @@ plot(x,y,line=(types,3),lab=map(string,types),ms=15)
```julia ```julia
styles = setdiff(supportedStyles(),[:auto])' styles = setdiff(supportedStyles(),[:auto])'
plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=5) plot(cumsum(randn(20,length(styles)),1),style=:auto,label=map(string,styles),w=5)
``` ```
![](../img/pyplot/pyplot_example_12.png) ![](../img/pyplot/pyplot_example_12.png)
@ -150,8 +159,11 @@ plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=
```julia ```julia
markers = setdiff(supportedMarkers(),[:none,:auto])' markers = setdiff(supportedMarkers(),[:none,:auto,Shape])'
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),ms=12) n = length(markers)
x = (linspace(0,10,n + 2))[2:end - 1]
y = repmat(reverse(x)',n,1)
scatter(x,y,m=(12,:auto),lab=map(string,markers),bg=:linen)
``` ```
![](../img/pyplot/pyplot_example_13.png) ![](../img/pyplot/pyplot_example_13.png)
@ -176,14 +188,47 @@ histogram(randn(1000),nbins=50)
![](../img/pyplot/pyplot_example_15.png) ![](../img/pyplot/pyplot_example_15.png)
### Subplots
subplot and subplot! are distinct commands which create many plots and add series to them in a circular fashion.
You can define the layout with keyword params... either set the number of plots `n` (and optionally number of rows `nr` or
number of columns `nc`), or you can set the layout directly with `layout`.
```julia
subplot(randn(100,5),layout=[1,1,3],t=[:line :hist :scatter :step :bar],nbins=10,leg=false)
```
![](../img/pyplot/pyplot_example_16.png)
### Adding to subplots
Note here the automatic grid layout, as well as the order in which new series are added to the plots.
```julia
subplot(fakedata(100,10),n=4,palette=[:grays :blues :heat :lightrainbow],bg=[:orange :pink :darkblue :black])
```
![](../img/pyplot/pyplot_example_17.png)
###
```julia
subplot!(fakedata(100,10))
```
![](../img/pyplot/pyplot_example_18.png)
### Annotations ### 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)` 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 ```julia
y = rand(10) y = rand(10)
plot(y,ann=(3,y[3],"this is #3")) plot(y,ann=(3,y[3],text("this is #3",:left)))
annotate!([(5,y[5],"this is #5"),(9,y[10],"this is #10")]) annotate!([(5,y[5],text("this is #5",16,:red,:center)),(10,y[10],text("this is #10",:right,20,"courier"))])
``` ```
![](../img/pyplot/pyplot_example_20.png) ![](../img/pyplot/pyplot_example_20.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 104 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: 19 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -315,6 +315,38 @@ function plot!(pkg::PyPlotPackage, plt::Plot; kw...)
plt plt
end end
# -----------------------------------------------------------------
function Base.getindex(plt::Plot{PyPlotPackage}, i::Integer)
series = plt.seriesargs[i][:serieshandle]
series[:get_data]()
# series[:relim]()
# mapping = getGadflyMappings(plt, i)[1]
# mapping[:x], mapping[:y]
end
function Base.setindex!(plt::Plot{PyPlotPackage}, xy::Tuple, i::Integer)
series = plt.seriesargs[i][:serieshandle]
series[:set_data](xy...)
ax = series[:axes]
if plt.initargs[:xlims] == :auto
xmin, xmax = ax[:get_xlim]()
ax[:set_xlim](min(xmin, minimum(xy[1])), max(xmax, maximum(xy[1])))
end
if plt.initargs[:ylims] == :auto
ymin, ymax = ax[:get_ylim]()
ax[:set_ylim](min(ymin, minimum(xy[2])), max(ymax, maximum(xy[2])))
end
# getLeftAxis(plt)[:relim]()
# getRightAxis(plt)[:relim]()
# for mapping in getGadflyMappings(plt, i)
# mapping[:x], mapping[:y] = xy
# end
plt
end
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@ -465,8 +497,8 @@ function addPyPlotLegend(plt::Plot, ax)
ax[:legend]([d[:serieshandle] for d in args], ax[:legend]([d[:serieshandle] for d in args],
[d[:label] for d in args], [d[:label] for d in args],
loc="best", loc="best",
fontsize = plt.initargs[:legendfont].pointsize, fontsize = plt.initargs[:legendfont].pointsize
framealpha = 0.6 # framealpha = 0.6
) )
end end
end end