Search code examples
pythonsvgmatplotlibpngbokeh

Bokeh change quality export plot


I am trying to export some grid into either png or svg but with svg option—as the doc states-the plots are exported as multiple files. So the only option is png. (For some reason if I use the toolbar, I only get the first plot and not the other).

But the quality of the png is terrible. Is there an option to set dpi or whatever? Even I you try to save graphs on the official documentation, you obtain poor quality.

I really like Bokeh and found it nicer to use that any other libs but this quality export is critical for me (publication purpose).


Solution

  • In recent versions of Bokeh the export_png accepts width and height parameters that you can set as arbitrarily large as you like, e.g:

    export_png(p, "plot.png", width=2400, height=1000)