Blurry plots (in Jupyterlab and VSCode)

I tried to plot in Julia with the following code:

using Pkg; Pkg.activate(".")
using Plots; 
plot(0:0.1:2π, sin, 
    xlabel="Xlabel [units]", ylabel="Ylabel [units]")

But the figure looks blurry, in either Jupyterlab or VSCode.
By the way, if I switch to the pythonplot() backend, the figure looks fine.

I tried everything without a solution. (version: Julia v1.12.0; Plots v1.41.1)

Are you zoomed in more than 100% with your web browser? That can produce this effect.

No, it is not zoomed with browser.

With python kernel and matplotlib, one can run
%config InlineBackend.figure_format = 'retina'
to make the figures ‘clear’. I am wondering if there is a similar way in Julia & GR.

Perhaps too obvious, but have you tried increasing the dpi?
i.e. plot(0:0.1:2π, sin, xlabel="Xlabel [units]", ylabel="Ylabel [units]", dpi = 600)

Yes, increasing the dpi indeed works (dpi=300 or even 200 is enough).
But I am wondering if there is a method to make it ‘permanent’ so that one don’t need to write ‘dpi=300’ every time.

This looks relevant: Where is the right place to put default settings for Plots.jl - #3 by rafael.guerra

1 Like

Thank you so much!
I know there could be a startup.jl file, but I didn’t know about ‘PLOTS_DEFAULTS’. I thought something about dpi in the startup file would mess us with other backends (since pythonplot() backend works fine).