fix contours (#2692)
* fix 2d-contour * fix filled contours (colorbar is off) * activate fixed examples
This commit is contained in:
parent
1963cee94a
commit
219465d599
@ -288,7 +288,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
extra_series = wraptuple(pop!(extra_series_opt,:add))
|
||||
end
|
||||
series_opt = merge(series_opt, PGFPlotsX.Options(extra_series_opt...))
|
||||
if RecipesPipeline.is3d(series) || st == :heatmap
|
||||
if RecipesPipeline.is3d(series) || st in (:heatmap, :contour)
|
||||
series_func = PGFPlotsX.Plot3
|
||||
else
|
||||
series_func = PGFPlotsX.Plot
|
||||
@ -297,7 +297,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
!isfilledcontour(series) && series[:ribbon] === nothing
|
||||
push!(series_opt, "area legend" => nothing)
|
||||
end
|
||||
if st == :heatmap
|
||||
if st in (:heatmap, :contour)
|
||||
push!(axis.options, "view" => "{0}{90}")
|
||||
end
|
||||
# treat segments
|
||||
@ -342,12 +342,13 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
||||
end
|
||||
segment_opt = merge(segment_opt, pgfx_marker(opt, i))
|
||||
end
|
||||
if st == :shape || isfilledcontour(series)
|
||||
if st == :shape
|
||||
segment_opt = merge(segment_opt, pgfx_fillstyle(opt, i))
|
||||
end
|
||||
# add fillrange
|
||||
if sf !== nothing &&
|
||||
!isfilledcontour(series) && series[:ribbon] === nothing
|
||||
!isfilledcontour(series) &&
|
||||
series[:ribbon] === nothing
|
||||
if sf isa Number || sf isa AVec
|
||||
pgfx_fillrange_series!(
|
||||
axis,
|
||||
@ -596,8 +597,8 @@ function pgfx_series_coordinates!(
|
||||
xs, ys, zs = collect(args)
|
||||
push!(
|
||||
segment_opt,
|
||||
"contour filled" => PGFPlotsX.Options("labels" => opt[:contour_labels]),
|
||||
"point meta" => "explicit",
|
||||
"contour filled" => PGFPlotsX.Options(), # labels not supported
|
||||
"patch type" => "bilinear",
|
||||
"shader" => "flat",
|
||||
)
|
||||
if opt[:levels] isa Number
|
||||
@ -606,17 +607,7 @@ function pgfx_series_coordinates!(
|
||||
push!(segment_opt["contour filled"], "levels" => opt[:levels])
|
||||
end
|
||||
|
||||
cs = join(
|
||||
[
|
||||
join(["($x, $y) [$(zs[j, i])]" for (j, x) in enumerate(xs)], " ") for (i, y) in enumerate(ys)
|
||||
],
|
||||
"\n\n",
|
||||
)
|
||||
"""
|
||||
coordinates {
|
||||
$cs
|
||||
};
|
||||
"""
|
||||
PGFPlotsX.Coordinates(args...)
|
||||
end
|
||||
##
|
||||
pgfx_get_linestyle(k) = get(
|
||||
|
||||
@ -998,13 +998,11 @@ _backend_skips = Dict(
|
||||
6, # images
|
||||
10, # histogram2d
|
||||
16, # pgfplots thinks the upper panel is too small
|
||||
22, # contourf
|
||||
25, # @df
|
||||
30, # @df
|
||||
31, # animation
|
||||
32, # spy
|
||||
38, # histogram2d
|
||||
45, # wireframe
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@ -487,7 +487,7 @@ end
|
||||
hascolorbar(series::Series) = colorbar_style(series) !== nothing
|
||||
hascolorbar(sp::Subplot) = sp[:colorbar] != :none && any(hascolorbar(s) for s in series_list(sp))
|
||||
|
||||
iscontour(series::Series) = series[:seriestype] == :contour
|
||||
iscontour(series::Series) = series[:seriestype] in (:contour, :contour3d)
|
||||
isfilledcontour(series::Series) = iscontour(series) && series[:fillrange] !== nothing
|
||||
|
||||
function contour_levels(series::Series, clims)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user