add 3dquiver to pgfplotsx (#3146)

* add 3dquiver to pgfplotsx

* fix 3d quiver

* remove skip from examples
This commit is contained in:
Simon Christ 2020-11-13 11:54:46 +01:00 committed by GitHub
parent 5861b1f11f
commit a955ded5c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 15 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,18 @@ function pgfx_add_series!(::Val{:quiver}, axis, series_opt, series, series_func,
)
x = opt[:x]
y = opt[:y]
z = opt[:z]
if z !== nothing
push!(series_opt["quiver"], "w" => "\\thisrow{w}")
table = PGFPlotsX.Table([
:x => x,
:y => y,
:z => z,
:u => opt[:quiver][1],
:v => opt[:quiver][2],
:w => opt[:quiver][3],
])
else
table = PGFPlotsX.Table([
:x => x,
:y => y,
@ -594,6 +606,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

@ -1120,7 +1120,6 @@ _backend_skips = Dict(
32, # spy
49, # polar heatmap
51, # image with custom axes
52, # 3d quiver
],
)

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))