z/zcolor
This commit is contained in:
parent
f1cca13796
commit
242cbe5ecb
@ -46,7 +46,7 @@ const examples = PlotExample[
|
|||||||
[
|
[
|
||||||
:(y = rand(100)),
|
:(y = rand(100)),
|
||||||
:(plot(0:10:100,rand(11,4),lab="lines",w=3, palette=:grays, fill=(0.5,:auto))),
|
:(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",
|
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!`",
|
"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",
|
PlotExample("Heatmaps",
|
||||||
"",
|
"",
|
||||||
[
|
[
|
||||||
:(heatmap(randn(10000),randn(10000), nbins=100))
|
:(heatmap(randn(10000),randn(10000), nbins=20))
|
||||||
]),
|
]),
|
||||||
PlotExample("Line types",
|
PlotExample("Line types",
|
||||||
"",
|
"",
|
||||||
@ -112,7 +112,7 @@ const examples = PlotExample[
|
|||||||
PlotExample("Histogram",
|
PlotExample("Histogram",
|
||||||
"",
|
"",
|
||||||
[
|
[
|
||||||
:(histogram(randn(1000), nbins=50))
|
:(histogram(randn(1000), nbins=20))
|
||||||
]),
|
]),
|
||||||
PlotExample("Subplots",
|
PlotExample("Subplots",
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -138,8 +138,8 @@ _seriesDefaults[:nbins] = 30 # number of bins for heatma
|
|||||||
_seriesDefaults[:smooth] = false # regression line?
|
_seriesDefaults[:smooth] = false # regression line?
|
||||||
_seriesDefaults[:group] = nothing # groupby vector
|
_seriesDefaults[:group] = nothing # groupby vector
|
||||||
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
|
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
|
||||||
_seriesDefaults[:z] = nothing # depth for contour, color scale, etc
|
_seriesDefaults[:z] = nothing # depth for contour, surface, etc
|
||||||
_seriesDefaults[:z]
|
_seriesDefaults[:zcolor] = nothing # value for color scale
|
||||||
_seriesDefaults[:surface] = nothing
|
_seriesDefaults[:surface] = nothing
|
||||||
_seriesDefaults[:nlevels] = 15
|
_seriesDefaults[:nlevels] = 15
|
||||||
|
|
||||||
|
|||||||
@ -157,9 +157,9 @@ function addGadflyMarker!(plt::Plot, numlayers::Int, d::Dict, plotargs::Dict, ge
|
|||||||
kwargs = Dict()
|
kwargs = Dict()
|
||||||
|
|
||||||
# handle continuous color scales for the markers
|
# handle continuous color scales for the markers
|
||||||
z = d[:z]
|
zcolor = d[:zcolor]
|
||||||
if z != nothing && typeof(z) <: AVec
|
if zcolor != nothing && typeof(zcolor) <: AVec
|
||||||
kwargs[:color] = z
|
kwargs[:color] = zcolor
|
||||||
if !isa(d[:markercolor], ColorGradient)
|
if !isa(d[:markercolor], ColorGradient)
|
||||||
d[:markercolor] = colorscheme(:bluesreds)
|
d[:markercolor] = colorscheme(:bluesreds)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -256,10 +256,10 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
|
|||||||
extra_kwargs[:marker] = getPyPlotMarker(d[:markershape])
|
extra_kwargs[:marker] = getPyPlotMarker(d[:markershape])
|
||||||
|
|
||||||
if lt in (:scatter, :scatter3d)
|
if lt in (:scatter, :scatter3d)
|
||||||
extra_kwargs[:s] = d[:markersize]^2
|
extra_kwargs[:s] = d[:markersize].^2
|
||||||
c = d[:markercolor]
|
c = d[:markercolor]
|
||||||
if isa(c, ColorGradient) && d[:z] != nothing
|
if isa(c, ColorGradient) && d[:zcolor] != nothing
|
||||||
extra_kwargs[:c] = convert(Vector{Float64}, d[:z])
|
extra_kwargs[:c] = convert(Vector{Float64}, d[:zcolor])
|
||||||
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeralpha])
|
extra_kwargs[:cmap] = getPyPlotColorMap(c, d[:markeralpha])
|
||||||
else
|
else
|
||||||
extra_kwargs[:c] = getPyPlotColor(c, d[:markeralpha])
|
extra_kwargs[:c] = getPyPlotColor(c, d[:markeralpha])
|
||||||
@ -290,6 +290,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
|
|||||||
extra_kwargs[:linewidth] = d[:linewidth]
|
extra_kwargs[:linewidth] = d[:linewidth]
|
||||||
end
|
end
|
||||||
extra_kwargs[:label] = d[:label]
|
extra_kwargs[:label] = d[:label]
|
||||||
|
extra_kwargs[:zorder] = plt.n
|
||||||
end
|
end
|
||||||
|
|
||||||
# do the plot
|
# do the plot
|
||||||
@ -329,9 +330,9 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
|
|||||||
if fillrange != nothing && lt != :contour
|
if fillrange != nothing && lt != :contour
|
||||||
fillcolor = getPyPlotColor(d[:fillcolor], d[:fillalpha])
|
fillcolor = getPyPlotColor(d[:fillcolor], d[:fillalpha])
|
||||||
if typeof(fillrange) <: @compat(Union{Real, AVec})
|
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
|
else
|
||||||
ax[:fill_between](d[:x], fillrange..., facecolor = fillcolor)
|
ax[:fill_between](d[:x], fillrange..., facecolor = fillcolor, zorder = plt.n)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ supportedArgs(::GadflyPackage) = [
|
|||||||
:xflip,
|
:xflip,
|
||||||
:yflip,
|
:yflip,
|
||||||
:z,
|
:z,
|
||||||
|
:zcolor,
|
||||||
:tickfont,
|
:tickfont,
|
||||||
:guidefont,
|
:guidefont,
|
||||||
:legendfont,
|
:legendfont,
|
||||||
@ -123,6 +124,7 @@ supportedArgs(::PyPlotPackage) = [
|
|||||||
:xflip,
|
:xflip,
|
||||||
:yflip,
|
:yflip,
|
||||||
:z,
|
:z,
|
||||||
|
:zcolor, # only supported for scatter/scatter3d
|
||||||
:tickfont,
|
:tickfont,
|
||||||
:guidefont,
|
:guidefont,
|
||||||
:legendfont,
|
:legendfont,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user