`UnicodePlots` can't well display on Windows10 command-line interface

Write the following code in a Julia script and double click it on Win10:

using UnicodePlots: lineplot, scatterplot, barplot

lineplot(randn(10)) |> display
scatterplot(randn(10)) |> display
barplot([1:10;], rand(10)) |> display

readline()

The command-line interface shows:

Here’s what I see:

Or to put differently: this is a font issue, not a Windows issue. Make sure to use the Windows Terminal (or some other terminal that’s not cmd, I use WezTerm and a font that has the glyphs you need (I use JuliaMono).

2 Likes

Thanks, that’s really a very nice solution!

But what if I want to send the script to someone else to run? After all, I can’t expect others to use the same terminal and font as me. In other words, how to change the font of the default Windows terminal, especially set it directly using Julia code?

I mean you probably could write a script that downloads and installs WezTerm and JuliaMono and edits the WezTerm conduit file but that’s taking things a little far. Ultimately people have to use reasonably modern setups if they want reasonable unicode display, so the best you can do is probably warn them in advance that they’ll need this.

2 Likes

Well, I see. Thanks a lot! :handshake: :handshake:

Not just “a little” :wink:. If someone sent me a script that started installing and configuring system software, I’d be less than amused. (In fact, I’d consider it malware, despite their possible best intentions).

Please never do anything like that. Just give some helpful instructions in a README on how your user should set up their system.

2 Likes

:grinning: Thanks for your kind suggestion! :handshake: :handshake:

I’ve tried to install the JuliaMono series fonts and set the font of the Windows’ default command-line interface to be JuliaMono, but it still couldn’t display the unicode plots. Must the font be used together with WezTerm? Can’t I expect unicode plots to display properly in Windows’ default command line terminal? (Although it works well in vscode)

See also known-issues.

And the related issues:
Plots don't look good on windows powershell · Issue #110 · JuliaPlots/UnicodePlots.jl · GitHub, or
Default canvas shows question marks only (windows) · Issue #44 · JuliaPlots/UnicodePlots.jl · GitHub.

1 Like

Windows default terminal at least in Windows 10 is pretty horrible, and I think in Win 11 has been replaced by the windows Terminal, which you should probably also use in win 10

2 Likes