aspect ratio 3d

This commit is contained in:
Simon Christ 2022-02-04 18:01:24 +01:00
parent 2a7d2d710e
commit 7d26ba527b

View File

@ -642,8 +642,9 @@ function axis_limits(
!has_user_lims &&
consider_aspect &&
letter in (:x, :y) &&
!(sp[:aspect_ratio] in (:none, :auto) || RecipesPipeline.is3d(:sp))
sp[:aspect_ratio] in (:none, :auto)
)
if !RecipesPipeline.is3d(:sp)
aspect_ratio = isa(sp[:aspect_ratio], Number) ? sp[:aspect_ratio] : 1
plot_ratio = height(plotarea(sp)) / width(plotarea(sp))
dist = amax - amin
@ -665,8 +666,31 @@ function axis_limits(
amin = center + factor * (amin - center)
amax = center + factor * (amax - center)
end
else
end
end
if RecipesPipeline.is3d(:sp)
xs = sp[1][:x]
ys = sp[1][:y]
zs = sp[1][:z]
x12, y12, z12 = extrema(xs), extrema(ys), extrema(zs)
d = maximum([diff([x12...]),diff([y12...]),diff([z12...])])[1] / 2
xm, ym, zm = mean(x12), mean(y12), mean(z12)
amin = if letter == :x
xm-d
elseif letter == :y
ym-d
elseif letter ==:z
zm-d
end
amax = if letter == :x
xm+d
elseif letter == :y
ym+d
elseif letter ==:z
zm+d
end
end
return amin, amax
end