Increase DPI of Matplotlib .show() in Jupyter Notebook

前端 未结 2 1312
情歌与酒
情歌与酒 2020-12-13 19:07

I\'m using Matplotlib in a Jupyter Notebook to display an image of a map. The code looks like this:

%matplotlib inline

imgpath = \'./map.png\'

import matplo         


        
相关标签:
2条回答
  • 2020-12-13 19:19

    If your screen has Retina display, add the following line after %matplotlib inline (or somewhere else before plotting) in your notebook

    %config InlineBackend.figure_format = 'retina'
    

    This will increase the display resolution of your plots within the Jupyter Notebook.

    0 讨论(0)
  • 2020-12-13 19:24

    Add this at the beginning of the notebook:

    import matplotlib as mpl
    mpl.rcParams['figure.dpi'] = 300
    

    That's it !

    0 讨论(0)
提交回复
热议问题