rely on recipe for histogram2d

This commit is contained in:
Simon Christ 2019-11-24 18:03:08 +01:00
parent 8cb32b1f14
commit e2a4b0eb30
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 =
[:path, :scatter, :straightline,
:path3d, :scatter3d, :surface, :wireframe,
:heatmap, :contour, :contour3d, :histogram2d,
:heatmap, :contour, :contour3d,
:shape,
:steppre, :stepmid, :steppost, :ysticks, :xsticks]
const _pgfplotsx_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]

View File

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