Open jon-wurtz opened 1 year ago
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
@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
Why not add matplotlib as a dependency and have it draw the atom positions with whatever settings the user has set?
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 😃
@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 inplotext
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??
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.
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.
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 https://github.com/QuEraComputing/Bloqade.jl/issues/557