rely on recipe for histogram2d

This commit is contained in:
Simon Christ 2019-11-24 18:03:08 +01:00
parent 95a29f9cbe
commit 35e24fef2a
2 changed files with 14 additions and 15 deletions

View File

@ -708,7 +708,7 @@ const _pgfplotsx_attr = merge_with_base_supported([
const _pgfplotsx_seriestype = const _pgfplotsx_seriestype =
[:path, :scatter, :straightline, [:path, :scatter, :straightline,
:path3d, :scatter3d, :surface, :wireframe, :path3d, :scatter3d, :surface, :wireframe,
:heatmap, :contour, :contour3d, :histogram2d, :heatmap, :contour, :contour3d,
:shape, :shape,
:steppre, :stepmid, :steppost, :ysticks, :xsticks] :steppre, :stepmid, :steppost, :ysticks, :xsticks]
const _pgfplotsx_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] const _pgfplotsx_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]

View File

@ -1,5 +1,4 @@
using Contour: Contour using Contour: Contour
# PGFPlotsX.print_tex(io::IO, data::ColorGradient) = write(io, pgfx_colormap(data))
Base.@kwdef mutable struct PGFPlotsXPlot Base.@kwdef mutable struct PGFPlotsXPlot
is_created::Bool = false is_created::Bool = false
was_shown::Bool = false was_shown::Bool = false
@ -250,7 +249,8 @@ end
else else
opt[:x], opt[:y] opt[:x], opt[:y]
end end
seg_args = if st in (:contour, :contour3d, :heatmap, :filledcontour) seg_args = if st in (:contour, :contour3d, :filledcontour)
args args
else else
(arg[rng] for arg in args) (arg[rng] for arg in args)
@ -278,10 +278,12 @@ end
function pgfx_series_coordinates!(st_val::Val{:heatmap}, segment_opt, opt, args) function pgfx_series_coordinates!(st_val::Val{:heatmap}, segment_opt, opt, args)
push!(segment_opt, push!(segment_opt,
"surf" => nothing, "surf" => nothing,
"mesh/rows" => length(opt[:x]) "mesh/rows" => length(opt[:x]),
"mesh/cols" => length(opt[:y])
) )
return PGFPlotsX.Table(args...) return PGFPlotsX.Table(args...)
end end
function pgfx_series_coordinates!(st_val::Val{:stepre}, segment_opt, opt, args) function pgfx_series_coordinates!(st_val::Val{:stepre}, segment_opt, opt, args)
push!( segment_opt, "const plot mark right" => nothing ) push!( segment_opt, "const plot mark right" => nothing )
return PGFPlotsX.Coordinates(args...) return PGFPlotsX.Coordinates(args...)
@ -354,9 +356,9 @@ function pgfx_series_coordinates!(st_val::Val{:filledcontour}, segment_opt, opt,
join(["($x, $y) [$(zs[j, i])]" for (j, x) in enumerate(xs)], " ") for (i, y) in enumerate(ys)], "\n\n" join(["($x, $y) [$(zs[j, i])]" for (j, x) in enumerate(xs)], " ") for (i, y) in enumerate(ys)], "\n\n"
) )
""" """
coordinates { coordinates {
$cs $cs
}; };
""" """
end end
## ##
@ -590,14 +592,11 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
end end
# limits # limits
# TODO: support zlims lims = ispolar(sp) && letter == :x ? rad2deg.(axis_limits(sp, :x)) : axis_limits(sp, letter)
if letter != :z push!( opt,
lims = ispolar(sp) && letter == :x ? rad2deg.(axis_limits(sp, :x)) : axis_limits(sp, letter) string(letter,:min) => lims[1],
push!( opt, string(letter,:max) => lims[2]
string(letter,:min) => lims[1], )
string(letter,:max) => lims[2]
)
end
if !(axis[:ticks] in (nothing, false, :none, :native)) && framestyle != :none if !(axis[:ticks] in (nothing, false, :none, :native)) && framestyle != :none
ticks = get_ticks(sp, axis) ticks = get_ticks(sp, axis)