add 3dquiver to pgfplotsx

This commit is contained in:
Simon Christ 2020-11-13 11:00:55 +01:00
parent 5861b1f11f
commit 4066950ecc
2 changed files with 20 additions and 8 deletions

View File

@ -282,7 +282,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
)
extra_series, extra_series_opt = pgfx_split_extra_opts(series[:extra_kwargs])
series_opt = merge(series_opt, PGFPlotsX.Options(extra_series_opt...))
if RecipesPipeline.is3d(series) || st in (:heatmap, :contour)
if RecipesPipeline.is3d(series) || st in (:heatmap, :contour) || (st == :quiver && opt[:z] !== nothing)
series_func = PGFPlotsX.Plot3
else
series_func = PGFPlotsX.Plot
@ -587,6 +587,17 @@ function pgfx_add_series!(::Val{:quiver}, axis, series_opt, series, series_func,
)
x = opt[:x]
y = opt[:y]
if is3d(series)
push!(series_opt["quiver"], "w" => "\\thisrow{w}")
table = PGFPlotsX.Table([
:x => x,
:y => y,
:z => opt[:z],
:u => opt[:quiver][1],
:v => opt[:quiver][2],
:w => opt[:quiver][3],
])
else
table = PGFPlotsX.Table([
:x => x,
:y => y,
@ -594,6 +605,7 @@ function pgfx_add_series!(::Val{:quiver}, axis, series_opt, series, series_func,
:v => opt[:quiver][2],
])
end
end
series_plot = series_func(series_opt, table)
push!(axis, series_plot)
pgfx_add_legend!(axis, series, opt)

View File

@ -316,7 +316,7 @@ end
function _override_seriestype_check(plotattributes::AKW, st::Symbol)
# do we want to override the series type?
if !RecipesPipeline.is3d(st) && !(st in (:contour, :contour3d))
if !RecipesPipeline.is3d(st) && !(st in (:contour, :contour3d, :quiver))
z = plotattributes[:z]
if !isa(z, Nothing) &&
(size(plotattributes[:x]) == size(plotattributes[:y]) == size(z))