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 meta-issue #2424

Open
3 of 7 tasks
mkborregaard opened this issue Feb 29, 2020 · 3 comments
Open
3 of 7 tasks

Aspect ratio meta-issue #2424

mkborregaard opened this issue Feb 29, 2020 · 3 comments
Labels
meta vizcon Let's work on this at the vizcon!

Comments

@mkborregaard
Copy link
Member

mkborregaard commented Feb 29, 2020

Would be nice to work over and consider how aspect ratio works in Plots.
The main issue being the relationship between plot aspect ratio and data aspect, and how they behave in layouts.
Relevant issues:

@mkborregaard mkborregaard added the vizcon Let's work on this at the vizcon! label Feb 29, 2020
@rjpower4
Copy link

rjpower4 commented Dec 13, 2020

Does this merge assist in any way?

Apparently as of matplotlib 3.3.0, this will give correct equal aspect ratio in 3D (taken from here):

import numpy as np

xs, ys, zs = <your data>
ax = <your axes>

# Option 1: aspect ratio is 1:1:1 in data space
ax.set_box_aspect((np.ptp(xs), np.ptp(ys), np.ptp(zs)))

# Option 2: aspect ratio 1:1:1 in view space
ax.set_box_aspect((1, 1, 1))

@FelixBenning
Copy link

It seems like aspect_ratio=1 breaks layouts:

visualize_gd

losssurface = plot(-5:0.1:5, -5:0.1:5, f, st=:contour, title="Losssurface")
plot!(
	losssurface,
	decent_steps[1,:], 
	decent_steps[2,:],
	markershape=:circle,
	arrow=:arrow,
	label="Path of Gradient Decent",
	aspect_ratio=1
)
loss = plot(
	mapslices(f, decent_steps;dims=(1))', 
	st=:scatter, 
	label=missing, 
	title="Loss", 
	xlabel="Iteration",
)
plot(losssurface, loss, layout=grid(1,2, widths=[0.7,0.3]))

Without the aspect_ratio=1 the plots are well aligned

visualize_gd

using the keyword heights did not seem to have an effect, but I still might be missing some options

@toma-vlad
Copy link

It seems like aspect_ratio=1 breaks layouts:

visualize_gd

losssurface = plot(-5:0.1:5, -5:0.1:5, f, st=:contour, title="Losssurface")
plot!(
	losssurface,
	decent_steps[1,:], 
	decent_steps[2,:],
	markershape=:circle,
	arrow=:arrow,
	label="Path of Gradient Decent",
	aspect_ratio=1
)
loss = plot(
	mapslices(f, decent_steps;dims=(1))', 
	st=:scatter, 
	label=missing, 
	title="Loss", 
	xlabel="Iteration",
)
plot(losssurface, loss, layout=grid(1,2, widths=[0.7,0.3]))

Without the aspect_ratio=1 the plots are well aligned

visualize_gd

using the keyword heights did not seem to have an effect, but I still might be missing some options

I have had a similar issues, mine manifested whenever i was trying to look at the axes limits.

See #3479 (comment)

@t-bltg t-bltg added the meta label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta vizcon Let's work on this at the vizcon!
Projects
None yet
Development

No branches or pull requests

5 participants