ehyG
ehyG

Reputation: 145

Ipython Bokeh Scatter Plot Marker Size after Zoom

When using bokeh scatter function with the code below:

import numpy as np
import bokeh.plotting as bpl
bpl.output_notebook()
x=np.linspace(-np.pi,np.pi,100)
y=np.sin(x)
bpl.scatter(x,y)
bpl.show()

I can use the wheel zoom and box zoom tools to zoom into the plot, and the markers keep a fixed display size. If instead I explicitly set the marker (glyph) size, like in the following code

import numpy as np
import bokeh.plotting as bpl
bpl.output_notebook()
x=np.linspace(-np.pi,np.pi,100)
y=np.sin(x)
bpl.scatter(x,y,radius=y/10)
bpl.show()

the marker size scales accordingly to the zoom scale. How can I set explicitly the marker size and keep at the same time a fixed display size independently of the zoom scale, as it is the standard behavior of mpl3d?

Upvotes: 2

Views: 1144

Answers (1)

bigreddot
bigreddot

Reputation: 34568

You need to give the plot a size instead of a radius. By default, size is in screen space units, and radius is in data space units.

Upvotes: 6

Related Questions