recompute_lengths fix; renamed hist to histogram, hist2d to histogram2d to match methods; fix tests
This commit is contained in:
parent
536746d47e
commit
088543176f
@ -243,10 +243,10 @@ end
|
|||||||
# bar!(args...; kw...) = plot!(args...; kw..., seriestype = :bar)
|
# bar!(args...; kw...) = plot!(args...; kw..., seriestype = :bar)
|
||||||
# barh(args...; kw...) = plot(args...; kw..., seriestype = :barh, orientation = :h)
|
# barh(args...; kw...) = plot(args...; kw..., seriestype = :barh, orientation = :h)
|
||||||
# barh!(args...; kw...) = plot!(args...; kw..., seriestype = :barh, orientation = :h)
|
# barh!(args...; kw...) = plot!(args...; kw..., seriestype = :barh, orientation = :h)
|
||||||
# histogram(args...; kw...) = plot(args...; kw..., seriestype = :hist)
|
# histogram(args...; kw...) = plot(args...; kw..., seriestype = :histogram)
|
||||||
# histogram!(args...; kw...) = plot!(args...; kw..., seriestype = :hist)
|
# histogram!(args...; kw...) = plot!(args...; kw..., seriestype = :histogram)
|
||||||
# histogram2d(args...; kw...) = plot(args...; kw..., seriestype = :hist2d)
|
# histogram2d(args...; kw...) = plot(args...; kw..., seriestype = :histogram2d)
|
||||||
# histogram2d!(args...; kw...) = plot!(args...; kw..., seriestype = :hist2d)
|
# histogram2d!(args...; kw...) = plot!(args...; kw..., seriestype = :histogram2d)
|
||||||
# density(args...; kw...) = plot(args...; kw..., seriestype = :density)
|
# density(args...; kw...) = plot(args...; kw..., seriestype = :density)
|
||||||
# density!(args...; kw...) = plot!(args...; kw..., seriestype = :density)
|
# density!(args...; kw...) = plot!(args...; kw..., seriestype = :density)
|
||||||
# heatmap(args...; kw...) = plot(args...; kw..., seriestype = :heatmap)
|
# heatmap(args...; kw...) = plot(args...; kw..., seriestype = :heatmap)
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const _3dTypes = [
|
|||||||
]
|
]
|
||||||
const _allTypes = vcat([
|
const _allTypes = vcat([
|
||||||
:none, :line, :path, :steppre, :steppost, :sticks, :scatter,
|
:none, :line, :path, :steppre, :steppost, :sticks, :scatter,
|
||||||
:heatmap, :hexbin, :hist, :hist2d, :hist3d, :density, :bar, :hline, :vline, #:ohlc,
|
:heatmap, :hexbin, :histogram, :histogram2d, :histogram3d, :density, :bar, :hline, :vline, #:ohlc,
|
||||||
:contour, :pie, :shape, :image #, :boxplot, :violin, :quiver,
|
:contour, :pie, :shape, :image #, :boxplot, :violin, :quiver,
|
||||||
], _3dTypes)
|
], _3dTypes)
|
||||||
|
|
||||||
@ -32,7 +32,6 @@ const _allTypes = vcat([
|
|||||||
:stem => :sticks,
|
:stem => :sticks,
|
||||||
:stems => :sticks,
|
:stems => :sticks,
|
||||||
:dots => :scatter,
|
:dots => :scatter,
|
||||||
:histogram => :hist,
|
|
||||||
:pdf => :density,
|
:pdf => :density,
|
||||||
:contours => :contour,
|
:contours => :contour,
|
||||||
:line3d => :path3d,
|
:line3d => :path3d,
|
||||||
@ -47,9 +46,11 @@ const _allTypes = vcat([
|
|||||||
:img => :image,
|
:img => :image,
|
||||||
:imshow => :image,
|
:imshow => :image,
|
||||||
:imagesc => :image,
|
:imagesc => :image,
|
||||||
|
:hist => :histogram,
|
||||||
|
:hist2d => :histogram2d,
|
||||||
)
|
)
|
||||||
|
|
||||||
like_histogram(seriestype::Symbol) = seriestype in (:hist, :density)
|
like_histogram(seriestype::Symbol) = seriestype in (:histogram, :density)
|
||||||
like_line(seriestype::Symbol) = seriestype in (:line, :path, :steppre, :steppost)
|
like_line(seriestype::Symbol) = seriestype in (:line, :path, :steppre, :steppost)
|
||||||
like_surface(seriestype::Symbol) = seriestype in (:contour, :contour3d, :heatmap, :surface, :wireframe, :image)
|
like_surface(seriestype::Symbol) = seriestype in (:contour, :contour3d, :heatmap, :surface, :wireframe, :image)
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ supportedArgs(::BokehBackend) = [
|
|||||||
# :levels,
|
# :levels,
|
||||||
]
|
]
|
||||||
supportedAxes(::BokehBackend) = [:auto, :left]
|
supportedAxes(::BokehBackend) = [:auto, :left]
|
||||||
supportedTypes(::BokehBackend) = [:none, :path, :scatter] #,:steppre, :steppost, :sticks, :hist2d, :hexbin, :hist, :bar, :hline, :vline, :contour]
|
supportedTypes(::BokehBackend) = [:none, :path, :scatter] #,:steppre, :steppost, :sticks, :histogram2d, :hexbin, :histogram, :bar, :hline, :vline, :contour]
|
||||||
supportedStyles(::BokehBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supportedStyles(::BokehBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::BokehBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
supportedMarkers(::BokehBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
||||||
supportedScales(::BokehBackend) = [:identity, :ln] #, :ln, :log2, :log10, :asinh, :sqrt]
|
supportedScales(::BokehBackend) = [:identity, :ln] #, :ln, :log2, :log10, :asinh, :sqrt]
|
||||||
|
|||||||
@ -27,7 +27,7 @@ supportedArgs(::GadflyBackend) = [
|
|||||||
supportedAxes(::GadflyBackend) = [:auto, :left]
|
supportedAxes(::GadflyBackend) = [:auto, :left]
|
||||||
supportedTypes(::GadflyBackend) = [
|
supportedTypes(::GadflyBackend) = [
|
||||||
:none, :line, :path, :steppre, :steppost, :sticks,
|
:none, :line, :path, :steppre, :steppost, :sticks,
|
||||||
:scatter, :hist2d, :hexbin, :hist,
|
:scatter, :histogram2d, :hexbin, :histogram,
|
||||||
:bar, #:box, :violin, :quiver,
|
:bar, #:box, :violin, :quiver,
|
||||||
:hline, :vline, :contour, :shape
|
:hline, :vline, :contour, :shape
|
||||||
]
|
]
|
||||||
@ -73,9 +73,9 @@ function getLineGeom(d::KW)
|
|||||||
xbins, ybins = maketuple(d[:bins])
|
xbins, ybins = maketuple(d[:bins])
|
||||||
if st == :hexb
|
if st == :hexb
|
||||||
Gadfly.Geom.hexbin(xbincount = xbins, ybincount = ybins)
|
Gadfly.Geom.hexbin(xbincount = xbins, ybincount = ybins)
|
||||||
elseif st == :hist2d
|
elseif st == :histogram2d
|
||||||
Gadfly.Geom.histogram2d(xbincount = xbins, ybincount = ybins)
|
Gadfly.Geom.histogram2d(xbincount = xbins, ybincount = ybins)
|
||||||
elseif st == :hist
|
elseif st == :histogram
|
||||||
Gadfly.Geom.histogram(bincount = xbins,
|
Gadfly.Geom.histogram(bincount = xbins,
|
||||||
orientation = isvertical(d) ? :vertical : :horizontal,
|
orientation = isvertical(d) ? :vertical : :horizontal,
|
||||||
position = d[:bar_position] == :stack ? :stack : :dodge)
|
position = d[:bar_position] == :stack ? :stack : :dodge)
|
||||||
@ -121,7 +121,7 @@ function getGadflyLineTheme(d::KW)
|
|||||||
fc = convertColor(getColor(d[:fillcolor]), d[:fillalpha])
|
fc = convertColor(getColor(d[:fillcolor]), d[:fillalpha])
|
||||||
|
|
||||||
Gadfly.Theme(;
|
Gadfly.Theme(;
|
||||||
default_color = (st in (:hist,:hist2d,:hexbin,:bar,:sticks) ? fc : lc),
|
default_color = (st in (:histogram,:histogram2d,:hexbin,:bar,:sticks) ? fc : lc),
|
||||||
line_width = (st == :sticks ? 1 : d[:linewidth]) * Gadfly.px,
|
line_width = (st == :sticks ? 1 : d[:linewidth]) * Gadfly.px,
|
||||||
# line_style = Gadfly.get_stroke_vector(d[:linestyle]),
|
# line_style = Gadfly.get_stroke_vector(d[:linestyle]),
|
||||||
lowlight_color = x->RGB(fc), # fill/ribbon
|
lowlight_color = x->RGB(fc), # fill/ribbon
|
||||||
@ -160,7 +160,7 @@ function addGadflyLine!(plt::Plot, numlayers::Int, d::KW, geoms...)
|
|||||||
addGadflyContColorScale(plt, d[:linecolor])
|
addGadflyContColorScale(plt, d[:linecolor])
|
||||||
end
|
end
|
||||||
|
|
||||||
kwargs[:x] = d[st == :hist ? :y : :x]
|
kwargs[:x] = d[st == :histogram ? :y : :x]
|
||||||
kwargs[:y] = d[:y]
|
kwargs[:y] = d[:y]
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -300,7 +300,7 @@ function addGadflySeries!(plt::Plot, d::KW)
|
|||||||
st = d[:seriestype]
|
st = d[:seriestype]
|
||||||
# if st == :ohlc
|
# if st == :ohlc
|
||||||
# error("Haven't re-implemented after refactoring")
|
# error("Haven't re-implemented after refactoring")
|
||||||
if st in (:hist2d, :hexbin) && (isa(d[:fillcolor], ColorGradient) || isa(d[:fillcolor], ColorFunction))
|
if st in (:histogram2d, :hexbin) && (isa(d[:fillcolor], ColorGradient) || isa(d[:fillcolor], ColorFunction))
|
||||||
push!(gplt.scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(d[:fillcolor], p))))
|
push!(gplt.scales, Gadfly.Scale.ContinuousColorScale(p -> RGB(getColorZ(d[:fillcolor], p))))
|
||||||
elseif st == :scatter && d[:markershape] == :none
|
elseif st == :scatter && d[:markershape] == :none
|
||||||
d[:markershape] = :ellipse
|
d[:markershape] = :ellipse
|
||||||
@ -311,7 +311,7 @@ function addGadflySeries!(plt::Plot, d::KW)
|
|||||||
prepend!(layers, addGadflyMarker!(plt, length(gplt.layers), d, plt.attr, smooth...))
|
prepend!(layers, addGadflyMarker!(plt, length(gplt.layers), d, plt.attr, smooth...))
|
||||||
end
|
end
|
||||||
|
|
||||||
st in (:hist2d, :hexbin, :contour) || addToGadflyLegend(plt, d)
|
st in (:histogram2d, :hexbin, :contour) || addToGadflyLegend(plt, d)
|
||||||
|
|
||||||
# now save the layers that apply to this series
|
# now save the layers that apply to this series
|
||||||
d[:gadflylayers] = layers
|
d[:gadflylayers] = layers
|
||||||
|
|||||||
@ -60,7 +60,7 @@ supportedArgs(::GLVisualizeBackend) = [
|
|||||||
# :levels,
|
# :levels,
|
||||||
]
|
]
|
||||||
supportedAxes(::GLVisualizeBackend) = [:auto, :left]
|
supportedAxes(::GLVisualizeBackend) = [:auto, :left]
|
||||||
supportedTypes(::GLVisualizeBackend) = [:surface] #, :path, :scatter ,:steppre, :steppost, :sticks, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :contour]
|
supportedTypes(::GLVisualizeBackend) = [:surface] #, :path, :scatter ,:steppre, :steppost, :sticks, :heatmap, :hexbin, :histogram, :bar, :hline, :vline, :contour]
|
||||||
supportedStyles(::GLVisualizeBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
|
supportedStyles(::GLVisualizeBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::GLVisualizeBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
supportedMarkers(::GLVisualizeBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
||||||
supportedScales(::GLVisualizeBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
|
supportedScales(::GLVisualizeBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
|
||||||
|
|||||||
@ -39,7 +39,7 @@ supportedArgs(::GRBackend) = [
|
|||||||
supportedAxes(::GRBackend) = _allAxes
|
supportedAxes(::GRBackend) = _allAxes
|
||||||
supportedTypes(::GRBackend) = [
|
supportedTypes(::GRBackend) = [
|
||||||
:path, :steppre, :steppost,
|
:path, :steppre, :steppost,
|
||||||
:scatter, :hist2d, :hexbin,
|
:scatter, :histogram2d, :hexbin,
|
||||||
:sticks,
|
:sticks,
|
||||||
:hline, :vline, :heatmap, :pie, :image, #:ohlc,
|
:hline, :vline, :heatmap, :pie, :image, #:ohlc,
|
||||||
:contour, :path3d, :scatter3d, :surface, :wireframe
|
:contour, :path3d, :scatter3d, :surface, :wireframe
|
||||||
@ -514,7 +514,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
axes_2d = true
|
axes_2d = true
|
||||||
for series in series_list(sp)
|
for series in series_list(sp)
|
||||||
st = ispolar(sp) ? :polar : series.d[:seriestype]
|
st = ispolar(sp) ? :polar : series.d[:seriestype]
|
||||||
if st in (:hist2d, :hexbin, :contour, :surface, :heatmap)
|
if st in (:histogram2d, :hexbin, :contour, :surface, :heatmap)
|
||||||
cmap = true
|
cmap = true
|
||||||
end
|
end
|
||||||
if st in (:pie, :polar, :surface, :wireframe, :path3d, :scatter3d)
|
if st in (:pie, :polar, :surface, :wireframe, :path3d, :scatter3d)
|
||||||
@ -542,9 +542,9 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
# end
|
# end
|
||||||
# if st == :bar
|
# if st == :bar
|
||||||
# x, y = 1:length(d[:y]), d[:y]
|
# x, y = 1:length(d[:y]), d[:y]
|
||||||
# elseif st in [:hist, :density]
|
# elseif st in [:histogram, :density]
|
||||||
# x, y = Base.hist(d[:y], d[:bins])
|
# x, y = Base.hist(d[:y], d[:bins])
|
||||||
# elseif st in [:hist2d, :hexbin]
|
# elseif st in [:histogram2d, :hexbin]
|
||||||
# E = zeros(length(d[:x]),2)
|
# E = zeros(length(d[:x]),2)
|
||||||
# E[:,1] = d[:x]
|
# E[:,1] = d[:x]
|
||||||
# E[:,2] = d[:y]
|
# E[:,2] = d[:y]
|
||||||
@ -743,7 +743,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
d = series.d
|
d = series.d
|
||||||
# idx = d[:series_plotindex]
|
# idx = d[:series_plotindex]
|
||||||
st = d[:seriestype]
|
st = d[:seriestype]
|
||||||
if st in (:hist2d, :hexbin, :contour, :surface, :wireframe, :heatmap)
|
if st in (:histogram2d, :hexbin, :contour, :surface, :wireframe, :heatmap)
|
||||||
# grad = isa(d[:fillcolor], ColorGradient) ? d[:fillcolor] : default_gradient()
|
# grad = isa(d[:fillcolor], ColorGradient) ? d[:fillcolor] : default_gradient()
|
||||||
# cs = [getColorZ(grad, z) for z in linspace(0, 1, 256)]
|
# cs = [getColorZ(grad, z) for z in linspace(0, 1, 256)]
|
||||||
# for (i, c) in enumerate(cs)
|
# for (i, c) in enumerate(cs)
|
||||||
@ -895,7 +895,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
# # end
|
# # end
|
||||||
|
|
||||||
# # TODO: use recipe
|
# # TODO: use recipe
|
||||||
# elseif st in [:hist, :density]
|
# elseif st in [:histogram, :density]
|
||||||
# edges, counts = Base.hist(d[:y], d[:bins])
|
# edges, counts = Base.hist(d[:y], d[:bins])
|
||||||
# gr_barplot(series, edges, counts)
|
# gr_barplot(series, edges, counts)
|
||||||
# # x, y = float(collect(h[1])), float(h[2])
|
# # x, y = float(collect(h[1])), float(h[2])
|
||||||
@ -919,7 +919,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# TODO: use recipe
|
# TODO: use recipe
|
||||||
elseif st in [:hist2d, :hexbin]
|
elseif st in [:histogram2d, :hexbin]
|
||||||
E = zeros(length(d[:x]),2)
|
E = zeros(length(d[:x]),2)
|
||||||
E[:,1] = d[:x]
|
E[:,1] = d[:x]
|
||||||
E[:,2] = d[:y]
|
E[:,2] = d[:y]
|
||||||
|
|||||||
@ -44,7 +44,7 @@ supportedArgs(::PGFPlotsBackend) = [
|
|||||||
# :match_dimensions,
|
# :match_dimensions,
|
||||||
]
|
]
|
||||||
supportedAxes(::PGFPlotsBackend) = [:auto, :left]
|
supportedAxes(::PGFPlotsBackend) = [:auto, :left]
|
||||||
supportedTypes(::PGFPlotsBackend) = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :hist2d, :ysticks, :xsticks, :contour]
|
supportedTypes(::PGFPlotsBackend) = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour]
|
||||||
supportedStyles(::PGFPlotsBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supportedStyles(::PGFPlotsBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape)
|
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon] #vcat(_allMarkers, Shape)
|
||||||
supportedScales(::PGFPlotsBackend) = [:identity, :ln, :log2, :log10] # :asinh, :sqrt]
|
supportedScales(::PGFPlotsBackend) = [:identity, :ln, :log2, :log10] # :asinh, :sqrt]
|
||||||
@ -184,7 +184,7 @@ function pgf_series(sp::Subplot, series::Series)
|
|||||||
PGFPlots.Linear3
|
PGFPlots.Linear3
|
||||||
elseif st == :scatter
|
elseif st == :scatter
|
||||||
PGFPlots.Scatter
|
PGFPlots.Scatter
|
||||||
elseif st == :hist2d
|
elseif st == :histogram2d
|
||||||
PGFPlots.Histogram2
|
PGFPlots.Histogram2
|
||||||
elseif st == :contour
|
elseif st == :contour
|
||||||
PGFPlots.Contour
|
PGFPlots.Contour
|
||||||
|
|||||||
@ -36,7 +36,7 @@ supportedArgs(::PlotlyBackend) = [
|
|||||||
|
|
||||||
supportedAxes(::PlotlyBackend) = [:auto, :left]
|
supportedAxes(::PlotlyBackend) = [:auto, :left]
|
||||||
supportedTypes(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
supportedTypes(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
||||||
:hist2d, :hist, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
:histogram2d, :histogram, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
||||||
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
|
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
|
||||||
supportedStyles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supportedStyles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::PlotlyBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
supportedMarkers(::PlotlyBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
||||||
@ -449,7 +449,7 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
d_out[:type] = "bar"
|
d_out[:type] = "bar"
|
||||||
d_out[:x], d_out[:y] = x, y
|
d_out[:x], d_out[:y] = x, y
|
||||||
|
|
||||||
elseif st == :hist2d
|
elseif st == :histogram2d
|
||||||
d_out[:type] = "histogram2d"
|
d_out[:type] = "histogram2d"
|
||||||
d_out[:x], d_out[:y] = x, y
|
d_out[:x], d_out[:y] = x, y
|
||||||
if isa(d[:bins], Tuple)
|
if isa(d[:bins], Tuple)
|
||||||
@ -460,13 +460,13 @@ function plotly_series(plt::Plot, series::Series)
|
|||||||
d_out[:nbinsx] = xbins
|
d_out[:nbinsx] = xbins
|
||||||
d_out[:nbinsy] = ybins
|
d_out[:nbinsy] = ybins
|
||||||
|
|
||||||
elseif st in (:hist, :density)
|
elseif st in (:histogram, :density)
|
||||||
d_out[:type] = "histogram"
|
d_out[:type] = "histogram"
|
||||||
isvert = isvertical(d)
|
isvert = isvertical(d)
|
||||||
d_out[isvert ? :x : :y] = y
|
d_out[isvert ? :x : :y] = y
|
||||||
d_out[isvert ? :nbinsx : :nbinsy] = d[:bins]
|
d_out[isvert ? :nbinsx : :nbinsy] = d[:bins]
|
||||||
if st == :density
|
if st == :density
|
||||||
d_out[:histnorm] = "probability density"
|
d_out[:histogramnorm] = "probability density"
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif st == :heatmap
|
elseif st == :heatmap
|
||||||
|
|||||||
@ -66,7 +66,7 @@ supportedArgs(::PlotlyJSBackend) = [
|
|||||||
]
|
]
|
||||||
supportedAxes(::PlotlyJSBackend) = [:auto, :left]
|
supportedAxes(::PlotlyJSBackend) = [:auto, :left]
|
||||||
supportedTypes(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
supportedTypes(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
|
||||||
:hist2d, :hist, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
:histogram2d, :histogram, :density, :bar, :contour, :surface, :path3d, :scatter3d,
|
||||||
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
|
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
|
||||||
supportedStyles(::PlotlyJSBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supportedStyles(::PlotlyJSBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::PlotlyJSBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
supportedMarkers(::PlotlyJSBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
|
||||||
|
|||||||
@ -40,7 +40,7 @@ supportedArgs(::PyPlotBackend) = [
|
|||||||
supportedAxes(::PyPlotBackend) = _allAxes
|
supportedAxes(::PyPlotBackend) = _allAxes
|
||||||
supportedTypes(::PyPlotBackend) = [
|
supportedTypes(::PyPlotBackend) = [
|
||||||
:none, :line, :path, :steppre, :steppost, :shape,
|
:none, :line, :path, :steppre, :steppost, :shape,
|
||||||
:scatter, :hist2d, :hexbin, :hist, :density,
|
:scatter, :histogram2d, :hexbin, :histogram, :density,
|
||||||
:bar, :sticks, #:box, :violin, :quiver,
|
:bar, :sticks, #:box, :violin, :quiver,
|
||||||
:hline, :vline, :heatmap, :pie, :image,
|
:hline, :vline, :heatmap, :pie, :image,
|
||||||
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
:contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe
|
||||||
@ -567,7 +567,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
end
|
end
|
||||||
|
|
||||||
if st == :hist
|
if st == :histogram
|
||||||
handle = ax[:hist](y;
|
handle = ax[:hist](y;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
@ -583,7 +583,7 @@ function _series_added(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
end
|
end
|
||||||
|
|
||||||
if st == :hist2d
|
if st == :histogram2d
|
||||||
handle = ax[:hist2d](x, y;
|
handle = ax[:hist2d](x, y;
|
||||||
label = d[:label],
|
label = d[:label],
|
||||||
zorder = plt.n,
|
zorder = plt.n,
|
||||||
@ -1146,13 +1146,13 @@ function addPyPlotLegend(plt::Plot, sp::Subplot, ax)
|
|||||||
# if get_subplot(series) === sp &&
|
# if get_subplot(series) === sp &&
|
||||||
# series.d[:label] != "" &&
|
# series.d[:label] != "" &&
|
||||||
# !(series.d[:seriestype] in (
|
# !(series.d[:seriestype] in (
|
||||||
# :hexbin,:hist2d,:hline,:vline,
|
# :hexbin,:histogram2d,:hline,:vline,
|
||||||
# :contour,:contour3d,:surface,:wireframe,
|
# :contour,:contour3d,:surface,:wireframe,
|
||||||
# :heatmap,:path3d,:scatter3d, :pie, :image))
|
# :heatmap,:path3d,:scatter3d, :pie, :image))
|
||||||
for series in series_list(sp)
|
for series in series_list(sp)
|
||||||
if should_add_to_legend(series)
|
if should_add_to_legend(series)
|
||||||
# add a line/marker and a label
|
# add a line/marker and a label
|
||||||
push!(handles, if series.d[:seriestype] == :hist
|
push!(handles, if series.d[:seriestype] == :histogram
|
||||||
PyPlot.plt[:Line2D]((0,1),(0,0), color=pyfillcolor(series.d), linewidth=4)
|
PyPlot.plt[:Line2D]((0,1),(0,0), color=pyfillcolor(series.d), linewidth=4)
|
||||||
else
|
else
|
||||||
series.d[:serieshandle][1]
|
series.d[:serieshandle][1]
|
||||||
|
|||||||
@ -44,7 +44,7 @@ supportedArgs(::QwtBackend) = [
|
|||||||
:xscale,
|
:xscale,
|
||||||
:yscale,
|
:yscale,
|
||||||
]
|
]
|
||||||
supportedTypes(::QwtBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :hist2d, :hexbin, :hist, :bar, :hline, :vline]
|
supportedTypes(::QwtBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :histogram2d, :hexbin, :histogram, :bar, :hline, :vline]
|
||||||
supportedMarkers(::QwtBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon]
|
supportedMarkers(::QwtBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon]
|
||||||
supportedScales(::QwtBackend) = [:identity, :log10]
|
supportedScales(::QwtBackend) = [:identity, :log10]
|
||||||
subplotSupported(::QwtBackend) = true
|
subplotSupported(::QwtBackend) = true
|
||||||
@ -109,7 +109,7 @@ function adjustQwtKeywords(plt::Plot{QwtBackend}, iscreating::Bool; kw...)
|
|||||||
|
|
||||||
elseif !iscreating && st == :bar
|
elseif !iscreating && st == :bar
|
||||||
d = barHack(; kw...)
|
d = barHack(; kw...)
|
||||||
elseif !iscreating && st == :hist
|
elseif !iscreating && st == :histogram
|
||||||
d = barHack(; histogramHack(; kw...)...)
|
d = barHack(; histogramHack(; kw...)...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ supportedArgs(::UnicodePlotsBackend) = [
|
|||||||
supportedAxes(::UnicodePlotsBackend) = [:auto, :left]
|
supportedAxes(::UnicodePlotsBackend) = [:auto, :left]
|
||||||
supportedTypes(::UnicodePlotsBackend) = [
|
supportedTypes(::UnicodePlotsBackend) = [
|
||||||
:path, :steppre, :steppost, :scatter,
|
:path, :steppre, :steppost, :scatter,
|
||||||
:hist2d, :hline, :vline
|
:histogram2d, :hline, :vline
|
||||||
]
|
]
|
||||||
supportedStyles(::UnicodePlotsBackend) = [:auto, :solid]
|
supportedStyles(::UnicodePlotsBackend) = [:auto, :solid]
|
||||||
supportedMarkers(::UnicodePlotsBackend) = [:none, :auto, :ellipse]
|
supportedMarkers(::UnicodePlotsBackend) = [:none, :auto, :ellipse]
|
||||||
@ -197,11 +197,11 @@ function addUnicodeSeries!(o, d::KW, addlegend::Bool, xlim, ylim)
|
|||||||
# UnicodePlots.barplot!(o, d[:x], d[:y])
|
# UnicodePlots.barplot!(o, d[:x], d[:y])
|
||||||
# return
|
# return
|
||||||
|
|
||||||
# elseif st == :hist
|
# elseif st == :histogram
|
||||||
# UnicodePlots.histogram!(o, d[:y], bins = d[:bins])
|
# UnicodePlots.histogram!(o, d[:y], bins = d[:bins])
|
||||||
# return
|
# return
|
||||||
|
|
||||||
elseif st == :hist2d
|
elseif st == :histogram2d
|
||||||
UnicodePlots.densityplot!(o, d[:x], d[:y])
|
UnicodePlots.densityplot!(o, d[:x], d[:y])
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ end
|
|||||||
# # TODO don't need these once the "bar" series recipe is done
|
# # TODO don't need these once the "bar" series recipe is done
|
||||||
# if d[:seriestype] in (:sticks, :bar)
|
# if d[:seriestype] in (:sticks, :bar)
|
||||||
# d = barHack(; d...)
|
# d = barHack(; d...)
|
||||||
# elseif d[:seriestype] == :hist
|
# elseif d[:seriestype] == :histogram
|
||||||
# d = barHack(; histogramHack(; d...)...)
|
# d = barHack(; histogramHack(; d...)...)
|
||||||
# end
|
# end
|
||||||
# # push!(plt.seriesargs, d)
|
# # push!(plt.seriesargs, d)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ supportedArgs(::WinstonBackend) = [
|
|||||||
# :z,
|
# :z,
|
||||||
]
|
]
|
||||||
supportedAxes(::WinstonBackend) = [:auto, :left]
|
supportedAxes(::WinstonBackend) = [:auto, :left]
|
||||||
supportedTypes(::WinstonBackend) = [:none, :line, :path, :sticks, :scatter, :hist, :bar]
|
supportedTypes(::WinstonBackend) = [:none, :line, :path, :sticks, :scatter, :histogram, :bar]
|
||||||
supportedStyles(::WinstonBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
supportedStyles(::WinstonBackend) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::WinstonBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
|
supportedMarkers(::WinstonBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
|
||||||
supportedScales(::WinstonBackend) = [:identity, :log10]
|
supportedScales(::WinstonBackend) = [:identity, :log10]
|
||||||
@ -150,7 +150,7 @@ function _series_added(plt::Plot{WinstonBackend}, series::Series)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## lintype :path, :step, :stepinverted, :sticks, :dots, :none, :hist2d, :hexbin, :hist, :bar
|
## lintype :path, :step, :stepinverted, :sticks, :dots, :none, :histogram2d, :hexbin, :histogram, :bar
|
||||||
if d[:seriestype] == :none
|
if d[:seriestype] == :none
|
||||||
Winston.add(wplt, Winston.Points(d[:x], d[:y]; copy_remove(e, :kind)..., color=getColor(d[:markercolor])))
|
Winston.add(wplt, Winston.Points(d[:x], d[:y]; copy_remove(e, :kind)..., color=getColor(d[:markercolor])))
|
||||||
|
|
||||||
@ -185,13 +185,13 @@ function _series_added(plt::Plot{WinstonBackend}, series::Series)
|
|||||||
# elseif d[:seriestype] == :dots
|
# elseif d[:seriestype] == :dots
|
||||||
# fn = Winston.XXX
|
# fn = Winston.XXX
|
||||||
|
|
||||||
# elseif d[:seriestype] == :hist2d
|
# elseif d[:seriestype] == :histogram2d
|
||||||
# fn = Winston.XXX
|
# fn = Winston.XXX
|
||||||
|
|
||||||
# elseif d[:seriestype] == :hexbin
|
# elseif d[:seriestype] == :hexbin
|
||||||
# fn = Winston.XXX
|
# fn = Winston.XXX
|
||||||
|
|
||||||
elseif d[:seriestype] == :hist
|
elseif d[:seriestype] == :histogram
|
||||||
hst = hist(d[:y], d[:bins])
|
hst = hist(d[:y], d[:bins])
|
||||||
Winston.add(wplt, Winston.Histogram(hst...; copy_remove(e, :bins)...))
|
Winston.add(wplt, Winston.Histogram(hst...; copy_remove(e, :bins)...))
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ function _series_added(plt::Plot{WinstonBackend}, series::Series)
|
|||||||
|
|
||||||
|
|
||||||
# optionally add a regression line
|
# optionally add a regression line
|
||||||
d[:smooth] && d[:seriestype] != :hist && addRegressionLineWinston(d, wplt)
|
d[:smooth] && d[:seriestype] != :histogram && addRegressionLineWinston(d, wplt)
|
||||||
|
|
||||||
# push!(plt.seriesargs, d)
|
# push!(plt.seriesargs, d)
|
||||||
# plt
|
# plt
|
||||||
|
|||||||
@ -233,8 +233,8 @@ function recompute_lengths(v)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
leftover = 1.0pct - tot
|
leftover = 1.0pct - tot
|
||||||
if leftover.value <= 0
|
if cnt > 1 && leftover.value <= 0
|
||||||
error("Not enough length left over in layout! v = $v, leftover = $leftover")
|
error("Not enough length left over in layout! v = $v, cnt = $cnt, leftover = $leftover")
|
||||||
end
|
end
|
||||||
|
|
||||||
# now fill in the blanks
|
# now fill in the blanks
|
||||||
|
|||||||
@ -396,7 +396,7 @@ end
|
|||||||
# error("gr_barplot: x must be same length as y (centers), or one more than y (edges).\n\t\tlength(x)=$(length(x)), length(y)=$(length(y))")
|
# error("gr_barplot: x must be same length as y (centers), or one more than y (edges).\n\t\tlength(x)=$(length(x)), length(y)=$(length(y))")
|
||||||
# end
|
# end
|
||||||
|
|
||||||
@recipe function f(::Type{Val{:hist}}, x, y, z)
|
@recipe function f(::Type{Val{:histogram}}, x, y, z)
|
||||||
edges, counts = Base.hist(y, d[:bins])
|
edges, counts = Base.hist(y, d[:bins])
|
||||||
d[:x] = edges
|
d[:x] = edges
|
||||||
d[:y] = counts
|
d[:y] = counts
|
||||||
|
|||||||
@ -37,7 +37,7 @@ series_list(sp::Subplot) = filter(series -> series.d[:subplot] === sp, sp.plt.se
|
|||||||
|
|
||||||
function should_add_to_legend(series::Series)
|
function should_add_to_legend(series::Series)
|
||||||
!(series.d[:label] == "" || series.d[:seriestype] in (
|
!(series.d[:label] == "" || series.d[:seriestype] in (
|
||||||
:hexbin,:hist2d,:hline,:vline,
|
:hexbin,:histogram2d,:hline,:vline,
|
||||||
:contour,:contour3d,:surface,:wireframe,
|
:contour,:contour3d,:surface,:wireframe,
|
||||||
:heatmap,:path3d,:scatter3d, :pie, :image
|
:heatmap,:path3d,:scatter3d, :pie, :image
|
||||||
))
|
))
|
||||||
|
|||||||
@ -336,7 +336,7 @@ allFunctions(arg) = trueOrAllTrue(a -> isa(a, Function), arg)
|
|||||||
"""
|
"""
|
||||||
Allows temporary setting of backend and defaults for Plots. Settings apply only for the `do` block. Example:
|
Allows temporary setting of backend and defaults for Plots. Settings apply only for the `do` block. Example:
|
||||||
```
|
```
|
||||||
with(:gadfly, size=(400,400), type=:hist) do
|
with(:gadfly, size=(400,400), type=:histogram) do
|
||||||
plot(rand(10))
|
plot(rand(10))
|
||||||
plot(rand(10))
|
plot(rand(10))
|
||||||
end
|
end
|
||||||
|
|||||||
@ -73,10 +73,10 @@ end
|
|||||||
facts("Axes") do
|
facts("Axes") do
|
||||||
axis = xaxis()
|
axis = xaxis()
|
||||||
@fact typeof(axis) --> Axis
|
@fact typeof(axis) --> Axis
|
||||||
@fact Plots.discrete_value!(axis, "HI") --> 0.5
|
@fact Plots.discrete_value!(axis, "HI") --> (0.5, 1)
|
||||||
@fact Plots.discrete_value!(axis, :yo) --> 1.5
|
@fact Plots.discrete_value!(axis, :yo) --> (1.5, 2)
|
||||||
@fact extrema(axis) --> (0.5,1.5)
|
@fact extrema(axis) --> (0.5,1.5)
|
||||||
@fact axis[:discrete_map] --> Dict{Any,Any}(:yo => 1.5, "HI" => 0.5)
|
@fact axis[:discrete_map] --> Dict{Any,Any}(:yo => 2, "HI" => 1)
|
||||||
|
|
||||||
Plots.discrete_value!(axis, ["x$i" for i=1:5])
|
Plots.discrete_value!(axis, ["x$i" for i=1:5])
|
||||||
Plots.discrete_value!(axis, ["x$i" for i=0:2])
|
Plots.discrete_value!(axis, ["x$i" for i=0:2])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user