Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aspect_ratio=:equal in 3d plots doesn't always work? #1949

Open
JMmontilla opened this issue Mar 11, 2019 · 5 comments · May be fixed by #4148
Open

aspect_ratio=:equal in 3d plots doesn't always work? #1949

JMmontilla opened this issue Mar 11, 2019 · 5 comments · May be fixed by #4148
Labels
enhancement improving existing functionality

Comments

@JMmontilla
Copy link

JMmontilla commented Mar 11, 2019

I have been trying to plot spheres but there are cases when the aspect_ratio=:equal command just doesn't work, example:

using Plots
function plotCC(pos, rad, n = 16) # Function to spheres
    u = collect(range(0,stop=2,length=n));
    v = collect(range(0,stop=1,length=n));
    x = pos * ones(n) * ones(n)' + rad * cospi.(u) * sinpi.(v)';
    y = rad * sinpi.(u) * sinpi.(v)';
    z = rad * repeat(cospi.(v)',outer=[n, 1])
    surface!(x,y,z, aspect_ratio=:equal)
end
plotlyjs(dpi=1500)
x = -15:0.1:10
y = -2:0.1:2
plot(x,y,(x,y) -> sin(x)*cos(y)*0.5, linetype=:surface, aspect_ratio=:equal, color=:magma)
plotCC(1,2,32)
plotCC(-15,3,32)
gui()

which will give me this:
no_AspectRatio

but if I plot the second sphere with rad=5 then this is the result:
AspectRatio

Is this some kind of limitation of Plots.jl ? It looks like it is deciding not to do aspect_ratio=:equal just because the data is too stretched, but I need to plot it with equally scaled axis (or the spheres won't look like it). Any advise?

@rjpower4
Copy link

This is a huge issue IMO and largely ignored by many plotting libraries. Without proper equal aspect ratio figures, many use cases revolving around movement through three dimensional space lose all physical intuition. Has there been any progress on this?

I know this is something that is not available in matplotlib, plotly, etc. natively. Is there a way for us to get around that limitation?

@airspaced-nk5
Copy link

Thanks @JMmontilla for laying out this issue in detail. Along with @rjpower4 I'd like to know if there has been any progress here. I've been getting into Julia recently for physical applications and having equal axis scaling in all three dimensions is very important to me.

I'm using the Plots Plotly backend for its interactivity and ability to render multiple plots in-browser, and I'm interested in either a native feature addition or some sort of workaround I can code up. Any advice is appreciated. Thanks!

@Boomer91
Copy link

+1

@songhanzhang
Copy link

songhanzhang commented Jan 10, 2022

aspect_ratio

I have the same issue (see above). Has it been solved?

@uchiiii
Copy link

uchiiii commented Jan 24, 2022

+1

@BeastyBlacksmith BeastyBlacksmith linked a pull request Mar 23, 2022 that will close this issue
@t-bltg t-bltg added the enhancement improving existing functionality label Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants