set projection for 3dquivers (#3544)
* set projection for 3dquivers * fix test
This commit is contained in:
parent
4723c513be
commit
d51059f0e9
@ -313,7 +313,7 @@ function _prepare_subplot(plt::Plot{T}, plotattributes::AKW) where {T}
|
|||||||
st = _override_seriestype_check(plotattributes, st)
|
st = _override_seriestype_check(plotattributes, st)
|
||||||
|
|
||||||
# change to a 3d projection for this subplot?
|
# change to a 3d projection for this subplot?
|
||||||
if RecipesPipeline.needs_3d_axes(st)
|
if RecipesPipeline.needs_3d_axes(st) || (st == :quiver && plotattributes[:z] !== nothing)
|
||||||
sp.attr[:projection] = "3d"
|
sp.attr[:projection] = "3d"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ function _override_seriestype_check(plotattributes::AKW, st::Symbol)
|
|||||||
# do we want to override the series type?
|
# do we want to override the series type?
|
||||||
if !RecipesPipeline.is3d(st) && !(st in (:contour, :contour3d, :quiver))
|
if !RecipesPipeline.is3d(st) && !(st in (:contour, :contour3d, :quiver))
|
||||||
z = plotattributes[:z]
|
z = plotattributes[:z]
|
||||||
if !isa(z, Nothing) &&
|
if z !== nothing &&
|
||||||
(size(plotattributes[:x]) == size(plotattributes[:y]) == size(z))
|
(size(plotattributes[:x]) == size(plotattributes[:y]) == size(z))
|
||||||
st = (st == :scatter ? :scatter3d : :path3d)
|
st = (st == :scatter ? :scatter3d : :path3d)
|
||||||
plotattributes[:seriestype] = st
|
plotattributes[:seriestype] = st
|
||||||
|
|||||||
@ -36,3 +36,8 @@ end
|
|||||||
pl = plot(1:5, xlims=:symmetric, widen = false)
|
pl = plot(1:5, xlims=:symmetric, widen = false)
|
||||||
@test Plots.xlims(pl) == (-5, 5)
|
@test Plots.xlims(pl) == (-5, 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@testset "3D Axis" begin
|
||||||
|
ql = quiver([1, 2], [2, 1], [3, 4], quiver = ([1, -1], [0, 0], [1, -0.5]), arrow=true)
|
||||||
|
@test ql[1][:projection] == "3d"
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user