
I found a bug within image_url regarding how it resizes images.
When using a PNG image, it will work fine with any width and height you give it, displaying the picture like one would imagine.
However, when using an SVG file, it will always keep the ratio 1:1. When you have an SVG that contains a square, image_url will always display it as one, even if you set ‘w=1., h=2.’, which should produce a rectangle.
Code for an MRE:
from bokeh.plotting import figure, show
from bokeh.io import output_notebook
output_notebook()
plot = figure(x_range=(0,100), y_range=(0,100))
plot.background_fill_color = "red"
plot.image_url(url=['test.png'], x=25, y=25, w=25, h=10)
plot.image_url(url=['test.svg'], x=75, y=75, w=25, h=10)
show(plot)
Results in:
test.png and test.svg both contain a green square of dimensions 100x100 (or anything else that is square). The PNG file is the export of the SVG file. The viewing area of the SVG file is set to contain exactly the square.


