Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we specify bokeh exported png file size / resolution?

With Python Bokeh export_png function, we can export an object to png file. However, I cannot find any way to specify the resulted png file size / resolution.

I found that I used the same code and got different png files in Windows and Linux. In Windows, the resolution is much lower.

I understand we can use export_svgs() to have better figure file. But compared with export_png(), export_svgs() has many limitations. We cannot use export_svgs() on div, column or row objects.

like image 549
Xuefei Avatar asked Sep 06 '25 07:09

Xuefei


1 Answers

In recent enough versions, export_png accepts width and height parameters:

https://docs.bokeh.org/en/latest/docs/reference/io.html#bokeh.io.export_png

If they are not available in your current install then you will need to update your Bokeh installation to something newer.

like image 64
bigreddot Avatar answered Sep 07 '25 23:09

bigreddot