plotly fill, nbins, density; ref img

This commit is contained in:
Thomas Breloff 2015-11-23 23:05:24 -05:00
parent c7f3520ea8
commit cdb4901d91
5 changed files with 26 additions and 8 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, zcolor=abs(y-.5), m=(:heat,0.8,stroke(3,:green)), ms=10*abs(y-0.5)+3, lab="grad"))
:(scatter!(y, zcolor=abs(y-.5), m=(:heat,0.8,stroke(1,:green)), ms=10*abs(y-0.5)+4, 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!`",

View File

@ -214,6 +214,12 @@ function get_series_html(d::Dict)
else
hasline ? "lines" : "none"
end
if d[:fillrange] == true || d[:fillrange] == 0
d_out[:fill] = "tozeroy"
d_out[:fillcolor] = webcolor(d[:fillcolor], d[:fillalpha])
elseif !(d[:fillrange] in (false, nothing))
warn("fillrange ignored... plotly only supports filling to zero. fillrange: $(d[:fillrange])")
end
d_out[:x], d_out[:y] = x, y
elseif lt == :bar
@ -221,13 +227,24 @@ function get_series_html(d::Dict)
d_out[:x], d_out[:y] = x, y
elseif lt == :heatmap
d_out[:type] = "heatmap"
d_out[:type] = "histogram2d"
d_out[:x], d_out[:y] = x, y
if isa(d[:nbins], Tuple)
xbins, ybins = d[:nbins]
else
xbins = ybins = d[:nbins]
end
d_out[:nbinsx] = xbins
d_out[:nbinsy] = ybins
elseif lt == :hist
elseif lt in (:hist, :density)
d_out[:type] = "histogram"
isvert = d[:orientation] in (:vertical, :v, :vert)
d_out[isvert ? :x : :y] = y
d_out[isvert ? :nbinsx : :nbinsy] = d[:nbins]
if lt == :density
d_out[:histnorm] = "probability density"
end
elseif lt == :contour
d_out[:type] = "contour"
@ -254,7 +271,7 @@ function get_series_html(d::Dict)
d_out[:marker] = Dict(
:symbol => get(_plotly_markers, d[:markershape], string(d[:markershape])),
:opacity => d[:markeralpha],
:size => d[:markersize],
:size => 2 * d[:markersize],
:color => webcolor(d[:markercolor], d[:markeralpha]),
:line => Dict(
:color => webcolor(d[:markerstrokecolor], d[:markerstrokealpha]),

View File

@ -431,8 +431,8 @@ supportedArgs(::PlotlyPackage) = [
:background_color,
:color_palette,
:fillrange,
# :fillcolor,
# :fillalpha,
:fillcolor,
:fillalpha,
:foreground_color,
:group,
:label,
@ -451,7 +451,7 @@ supportedArgs(::PlotlyPackage) = [
:markerstrokecolor,
:markerstrokestyle,
# :n,
# :nbins,
:nbins,
# :nc,
# :nr,
# :pos,
@ -474,6 +474,7 @@ supportedArgs(::PlotlyPackage) = [
# :xflip,
# :yflip,
:z,
:zcolor,
:tickfont,
:guidefont,
:legendfont,
@ -482,7 +483,7 @@ supportedArgs(::PlotlyPackage) = [
]
supportedAxes(::PlotlyPackage) = [:auto, :left]
supportedTypes(::PlotlyPackage) = [:none, :path, :scatter, :steppre, :steppost,
:heatmap, :hist, :bar, :contour, :pie] #,, :sticks, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :contour]
:heatmap, :hist, :density, :bar, :contour, :pie] #,, :sticks, :hexbin, :hline, :vline]
supportedStyles(::PlotlyPackage) = [:auto, :solid, :dash, :dot, :dashdot]
supportedMarkers(::PlotlyPackage) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
:pentagon, :hexagon, :octagon] #vcat(_allMarkers, Shape)

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 66 KiB