filled contours are difficult

This commit is contained in:
Simon Christ 2019-11-21 15:07:48 +01:00
parent e3a166f04c
commit 567d3688e8
2 changed files with 17 additions and 5 deletions

View File

@ -151,7 +151,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
else else
series_func = PGFPlotsX.Plot series_func = PGFPlotsX.Plot
end end
if series[:fillrange] !== nothing if series[:fillrange] !== nothing && st != :contour
series_opt = merge(series_opt, pgfx_fillstyle(opt)) series_opt = merge(series_opt, pgfx_fillstyle(opt))
push!(series_opt, "area legend" => nothing) push!(series_opt, "area legend" => nothing)
end end
@ -160,13 +160,25 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
push!(series_opt, _pgfx_series_extrastyle[st] => nothing) push!(series_opt, _pgfx_series_extrastyle[st] => nothing)
end end
if st == :contour if st == :contour
if !isfilledcontour(series)
surface_opt = PGFPlotsX.Options( surface_opt = PGFPlotsX.Options(
"contour prepared" => nothing "contour prepared" => PGFPlotsX.Options(
) "labels" => opt[:contour_labels],
)
)
else
error("PGFPlotsX backend does not support filled contours at the moment.")
surface_opt = PGFPlotsX.Options(
"contour filled" => PGFPlotsX.Options(
# "levels" => opt[:levels],
# "labels" => opt[:contour_labels],
)
)
end
surface_plot = series_func( surface_plot = series_func(
# merge(series_opt, surface_opt), # merge(series_opt, surface_opt),
surface_opt, surface_opt,
PGFPlotsX.Table(Contour.contours(args...)) PGFPlotsX.Table(Contour.contours(args..., opt[:levels]))
) )
push!(axis, surface_plot) push!(axis, surface_plot)
else else

View File

@ -88,6 +88,6 @@ end
p2 = contour(x, y, Z) p2 = contour(x, y, Z)
p1 = contour(x, y, f, fill=true) p1 = contour(x, y, f, fill=true)
plot(p1, p2) plot(p1, p2)
# TODO: totally broken, also errors for pgfplots # TODO: filled contours
end # testset end # testset
end # testset end # testset