diff --git a/docs/example_generation.jl b/docs/example_generation.jl index e2aa9df5..469e14d0 100644 --- a/docs/example_generation.jl +++ b/docs/example_generation.jl @@ -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!`", diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 3771a439..778ea8be 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -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]), diff --git a/src/backends/supported.jl b/src/backends/supported.jl index 547d95e9..12fb9f65 100644 --- a/src/backends/supported.jl +++ b/src/backends/supported.jl @@ -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) diff --git a/test/refimg/gadfly/ref22.png b/test/refimg/gadfly/ref22.png new file mode 100644 index 00000000..6adf86bc Binary files /dev/null and b/test/refimg/gadfly/ref22.png differ diff --git a/test/refimg/gadfly/ref4.png b/test/refimg/gadfly/ref4.png index 16e52b39..ce0109e4 100644 Binary files a/test/refimg/gadfly/ref4.png and b/test/refimg/gadfly/ref4.png differ