filled contours are difficult

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

View File

@ -151,7 +151,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
else
series_func = PGFPlotsX.Plot
end
if series[:fillrange] !== nothing
if series[:fillrange] !== nothing && st != :contour
series_opt = merge(series_opt, pgfx_fillstyle(opt))
push!(series_opt, "area legend" => nothing)
end
@ -160,13 +160,25 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
push!(series_opt, _pgfx_series_extrastyle[st] => nothing)
end
if st == :contour
if !isfilledcontour(series)
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(
# merge(series_opt, surface_opt),
surface_opt,
PGFPlotsX.Table(Contour.contours(args...))
PGFPlotsX.Table(Contour.contours(args..., opt[:levels]))
)
push!(axis, surface_plot)
else

View File

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