dfrankow
dfrankow

Reputation: 21459

How to get high-resolution plots in a Jupyter notebook using the R kernel?

Using SVG in a Jupyter notebook with R kernel mangles the text. See here and here. The workaround is to use PNG. It's a bit blurry. In Python, you can ask the PNG renderer to use more dots per inch with

 InlineBackend.figure_format = 'retina'

See for example trick 15 here.

How can I get higher resolution plots using the R kernel? SVG workaround? PNG renderer settings?

Edit: I'm using ggplot in R.

Edit 2: I found repr.plot defaults here, including res, which looks to be dots per inch (dpi). However, when I raise the res from 120 to 300, the plot gets bigger, despite me setting height and width.

Edit 3: I filed this issue. There are suggestions for how to fix it in the code, but no workarounds.

Upvotes: 16

Views: 2831

Answers (1)

GMfatcat
GMfatcat

Reputation: 11

I have recently discover that packages : plotly can work well on creating ggplot images

try the plot_ly() function to save png pics

here is a demo using plot_ly

hope this can help!

Upvotes: 1

Related Questions