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

Misaligned plots when plotting with UnicodePlots.jl using BrailleCanvas (Take 2) #2445

Closed
pankgeorg opened this issue Jan 17, 2023 · 9 comments
Assignees

Comments

@pankgeorg
Copy link
Collaborator

pankgeorg commented Jan 17, 2023

Issue still persists for raw character output.

Raw output:

           ┌────────────────────────────────────────┐       
         1 │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠚⠉⡏⠓⡄⠀⠀⡠⠚⠉⠉⠲⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ sin(x)
           │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⠁⠀⠀⡇⠀⠈⢆⡜⠁⠀⠀⠀⠀⠙⢄⠀⠀⠀⠀⠀⠀⠀⠀│ cos(x)
           │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠁⠀⠀⠀⡇⠀⠀⡸⡆⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠃⠀⠀⠀⠀⡇⠀⢰⠁⠘⡄⠀⠀⠀⠀⠀⠀⠘⡄⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠏⠀⠀⠀⠀⠀⡇⢀⠇⠀⠀⠱⡀⠀⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀⠀⠀⠀⡇⡎⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⢇⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⠁⠀⠀⠀⠀⠀⠀⡿⠀⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠘⡄⠀⠀⠀⠀│
   f(x)    │⠤⠤⠤⠤⣤⠤⠤⠤⠤⠤⠤⢤⠧⠤⠤⠤⠤⠤⠤⢤⡧⠤⠤⠤⠤⠤⠤⠼⡤⠤⠤⠤⠤⠤⠤⠵⠤⠤⠤⠤│
           │⠀⠀⠀⠀⠸⡄⠀⠀⠀⠀⠀⡜⠀⠀⠀⠀⠀⠀⠀⡎⡇⠀⠀⠀⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⣰⠁⠀⠀⠀⠀⠀⠀⡸⠀⡇⠀⠀⠀⠀⠀⠀⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⢇⠀⠀⢠⠇⠀⠀⠀⠀⠀⠀⢠⠃⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⠘⡄⢀⡞⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⠀⠸⡜⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢣⠀⠀⠀⠀⠀⠀⠀⠀│
           │⠀⠀⠀⠀⠀⠀⢀⡜⠑⣄⠀⠀⠀⠀⢀⡜⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢣⡀⠀⠀⠀⠀⠀⠀│
        -1 │⠀⠀⠀⠀⣀⡠⠎⠀⠀⠈⠦⣀⣀⡤⠊⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠱⢄⡀⠀⠀⠀⠀│
           └────────────────────────────────────────┘
           ⠀-4⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀4⠀
           ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀x⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

VSCode:
image

Originally posted by @expikr in #870 (comment)

@pankgeorg pankgeorg self-assigned this Jan 17, 2023
@pankgeorg
Copy link
Collaborator Author

@expikr can you also paste a screenshot? Thanks!

@cormullion
Copy link
Contributor

Font for ‘raw output’ looks like SF Mono or similar - you could try a different font?

@expikr
Copy link

expikr commented Jan 17, 2023

the "raw output" is just a plaintext codeblock, you can copy it from your browser.

@expikr
Copy link

expikr commented Jan 17, 2023

image

image

image

image

image

@pankgeorg
Copy link
Collaborator Author

The UnicodePlots are not quaranteed to work in every display. If you copy/paste the text, it will only work with some fonts, but definitely not with all

Do you use this feature from Pluto? I don't see Pluto in the screenshots.

Pluto's only promise is that it should work inside the pluto viewer. Is that what you expect and does not work?

@expikr
Copy link

expikr commented Jan 17, 2023

Ah, I wasn't aware of it being designed only for very specific environments, perhaps I missed it but the product messaging doesn't make it immediately clear that it is not meant to be universal.

At least, the intuitive expectation at a glance would lead people to think that it's a sharable output, otherwise why would anyone want to use it over actual images?

EDIT: ahh, just realized that this isn't the repository for UnicodePlots.jl itself.

@pankgeorg
Copy link
Collaborator Author

It is sharable but you need to take extra care to select a font in your editor that supports all the Unicode characters with the same width. For issues with UnicodePlots itself, you can file an issue here.

I'm going to close this issue now, feel free to reach out if you find other things going wrong with Pluto and its plots renderer!

Thanks!

@cormullion
Copy link
Contributor

cormullion commented Jan 17, 2023

I think it's also something to do with ANSI escape sequences that Terminal emulators can handle but other text environments can't.

@fonsp
Copy link
Owner

fonsp commented Jan 17, 2023

I think it's also something to do with ANSI escape sequences that Terminal emulators can handle but other text environments can't.

In that case, it would be helpful to write the output directly to a text file and share that, without copy/pasting. Something like:

write("output.txt", repr(MIME"text/plain"(), lineplot(...)))

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

No branches or pull requests

4 participants