This commit is contained in:
Thomas Breloff 2015-11-11 17:46:44 -05:00
parent f1cca13796
commit 242cbe5ecb
5 changed files with 16 additions and 13 deletions

View File

@ -46,7 +46,7 @@ const examples = PlotExample[
[
:(y = rand(100)),
:(plot(0:10:100,rand(11,4),lab="lines",w=3, palette=:grays, fill=(0.5,:auto))),
:(scatter!(y, z=abs(y-.5), m=(10,:heat), lab="grad"))
:(scatter!(y, zcolor=abs(y-.5), m=(:heat,0.8,stroke(3,:green)), ms=10*abs(y-0.5)+3, lab="grad"))
]),
PlotExample("Global",
"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!`",
@ -78,7 +78,7 @@ const examples = PlotExample[
PlotExample("Heatmaps",
"",
[
:(heatmap(randn(10000),randn(10000), nbins=100))
:(heatmap(randn(10000),randn(10000), nbins=20))
]),
PlotExample("Line types",
"",
@ -112,7 +112,7 @@ const examples = PlotExample[
PlotExample("Histogram",
"",
[
:(histogram(randn(1000), nbins=50))
:(histogram(randn(1000), nbins=20))
]),
PlotExample("Subplots",
"""

View File

@ -138,8 +138,8 @@ _seriesDefaults[:nbins] = 30 # number of bins for heatma
_seriesDefaults[:smooth] = false # regression line?
_seriesDefaults[:group] = nothing # groupby vector
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
_seriesDefaults[:z] = nothing # depth for contour, color scale, etc
_seriesDefaults[:z]
_seriesDefaults[:z] = nothing # depth for contour, surface, etc
_seriesDefaults[:zcolor] = nothing # value for color scale
_seriesDefaults[:surface] = nothing
_seriesDefaults[:nlevels] = 15

View File

@ -157,9 +157,9 @@ function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, ge
kwargs = Dict()
# handle continuous color scales for the markers
z = d[:z]
if z != nothing && typeof(z) <: AVec
kwargs[:color] = z
zcolor = d[:zcolor]
if zcolor != nothing && typeof(zcolor) <: AVec
kwargs[:color] = zcolor
if !isa(d[:markercolor], ColorGradient)
d[:markercolor] = colorscheme(:bluesreds)
end

View File

@ -256,10 +256,10 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
extra_kwargs[:marker] = getPyPlotMarker(d[:markershape])
if lt in (:scatter, :scatter3d)
extra_kwargs[:s] = d[:markersize]^2
extra_kwargs[:s] = d[:markersize].^2
c = d[:markercolor]
if isa(c, ColorGradient) && d[:z] != nothing
extra_kwargs[:c] = convert(Vector{Float64}, d[:z])
if isa(c, ColorGradient) && d[:zcolor] != nothing
extra_kwargs[:c] = convert(Vector{Float64}, d[:zcolor])
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeralpha])
else
extra_kwargs[:c] = getPyPlotColor(c, d[:markeralpha])
@ -290,6 +290,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
extra_kwargs[:linewidth] = d[:linewidth]
end
extra_kwargs[:label] = d[:label]
extra_kwargs[:zorder] = plt.n
end
# do the plot
@ -329,9 +330,9 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
if fillrange != nothing && lt != :contour
fillcolor = getPyPlotColor(d[:fillcolor], d[:fillalpha])
if typeof(fillrange) <: @compat(Union{Real, AVec})
ax[:fill_between](d[:x], fillrange, d[:y], facecolor = fillcolor)
ax[:fill_between](d[:x], fillrange, d[:y], facecolor = fillcolor, zorder = plt.n)
else
ax[:fill_between](d[:x], fillrange..., facecolor = fillcolor)
ax[:fill_between](d[:x], fillrange..., facecolor = fillcolor, zorder = plt.n)
end
end

View File

@ -48,6 +48,7 @@ supportedArgs(::GadflyPackage) = [
:xflip,
:yflip,
:z,
:zcolor,
:tickfont,
:guidefont,
:legendfont,
@ -123,6 +124,7 @@ supportedArgs(::PyPlotPackage) = [
:xflip,
:yflip,
:z,
:zcolor, # only supported for scatter/scatter3d
:tickfont,
:guidefont,
:legendfont,