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

Equal axis on visualization #424

Open
jon-wurtz opened this issue Aug 23, 2023 · 7 comments
Open

Equal axis on visualization #424

jon-wurtz opened this issue Aug 23, 2023 · 7 comments
Labels
backlog design notes and backlogs
Milestone

Comments

@jon-wurtz
Copy link

A handy new functionality! One small request: Can the axis be set as equal, so spatial distances in X and Y are reproduced in the plot. In the screenshot below, the X and Y extent are the same but this is not clear due to the plot stretching.

I would also be careful with fonts and localizations with these sorts of plots QuEraComputing/Bloqade.jl#557

image

@kaihsin
Copy link
Collaborator

kaihsin commented Aug 23, 2023

I think its possible to set them to be "approximately looks the same", if manually set plot_size(width=2*x, height=x) considering a character is display in height:width ~ 2:1 in terminal on screen? @johnzl-777

@johnzl-777
Copy link
Collaborator

@jon-wurtz makes a reasonable point about the fonts/localizations. I'm led to believe there should be a way to programmatically check if a users terminal supports unicode or if it doesn't, in which case I could replace the unicode dot marker with a single character (say, an ASCII period or something less exciting).

@kaihsin I'm hesitant to tamper with plot_size like that, I've fixed it to 80 x 24 with #415 (80x24 being the standard dimensions most terminals usually are by default). There might be another setting in plotext for scaling

@jon-wurtz
Copy link
Author

Why not add matplotlib as a dependency and have it draw the atom positions with whatever settings the user has set?

@johnzl-777
Copy link
Collaborator

Does matplotlib have terminal plotting capabilities? The whole point of this feature was just to give users a quick and dirty way of seeing the atom positions.

For a truly nice plot @kaihsin 's work with Bokeh gives a nice interactive visualization in the browser 😃

@kaihsin
Copy link
Collaborator

kaihsin commented Aug 23, 2023

@jon-wurtz makes a reasonable point about the fonts/localizations. I'm led to believe there should be a way to programmatically check if a users terminal supports unicode or if it doesn't, in which case I could replace the unicode dot marker with a single character (say, an ASCII period or something less exciting).

@johnzl-777 ,FYI if you are pursue this: I did the auto detect of unicode in the tree printing unicode_enabled = sys.stdout.encoding.lower().startswith("utf")

@kaihsin I'm hesitant to tamper with plot_size like that, I've fixed it to 80 x 24 with #415 (80x24 being the standard dimensions most terminals usually are by default). There might be another setting in plotext for scaling

I see. I was thinking just fix the "ratio" of width/height = 2, so the plot looks like square. But tbh I think terminal is just for quick check. If user want better display, maybe just do show??

@weinbe58
Copy link
Member

having equal sizes for x and y axes won't fix the issue of distortion. This only fixes the issue for a square lattice or a lattice that is bounded by a square region fixing the x and y bounds. In order to avoid distortion one would need to add padding to the x or y axes in general.

@weinbe58 weinbe58 added the backlog design notes and backlogs label Aug 24, 2023
@weinbe58 weinbe58 added this to the public-beta-1 milestone Aug 24, 2023
@johnzl-777
Copy link
Collaborator

I agree with @weinbe58 here.

@johnzl-777 ,FYI if you are pursue this: I did the auto detect of unicode in the tree printing unicode_enabled = sys.stdout.encoding.lower().startswith("utf")

This is perfect @kaihsin , I'll probably go ahead and add this as a feature!

I see. I was thinking just fix the "ratio" of width/height = 2, so the plot looks like square. But tbh I think terminal is just for quick check. If user want better display, maybe just do show??

Yes, I would agree with just using show. In my eyes the lattice pprint is just meant as a sanity check of sorts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog design notes and backlogs
Projects
None yet
Development

No branches or pull requests

4 participants