There is a way to increase the resolution when the plot is exported with export_png
(which @bigreddot says in his answer), that is setting width and height directly in the method:
export_png(p2, filename="plot.png", height=300, width=300)
The problem is that the axis and font size keep always the same size, no matter how big the plot is:
export_png(p2, filename="plot.png", height=1200, width=1200)
The possible solution right now is to update the axis attributes manually. I think that an easy fix would be to increase, in proportion, the size of the axis and fonts before exporting.
Also, if you want to save many canvas (each canvas element has a plot) at the same time you can use the JavaScript method canvas.toDataUrl()
to convert the canvas to png as base64. When you get all the images you can do whatever you want with them. These images have 96dpi and it cannot be changed, so if you want more resolution you will have to update the sizes of all the elements of the plot before the convertion as well: fonts, axis, plot size...
If you use the last approach you do not need to install selenium
and phantomjs
dependencies
Anyway if you wait for the 2.0 version you will get this for gridplots:
At bokeh 2.0, gridplot() will produce an instance of a single canvas GridPlot model. The old behavior will still be possible with an existing GridBox layout.
format code
, try surrounding the commands with backticks (`
) – Reenareenforce