Beau
Beau

Reputation: 447

Bokeh plots won't draw rectangle glyphs

Higher level functions like scatter work fine, but when I try to draw a primitive glyph the plot is empty: (in ipython notebook)

import bokeh
import bokeh.plotting as bplot

bplot.reset_output()
bplot.output_notebook()
bplot.figure(x_range=[0,1],
             y_range=[0,1])
bplot.rect(0.5,0.5,0.2,0.2)
bplot.show()

gives an empty plot :/

Upvotes: 0

Views: 912

Answers (1)

Damian Avila
Damian Avila

Reputation: 775

Try this:

import bokeh
import bokeh.plotting as bplot

bplot.reset_output()
bplot.output_notebook()
bplot.figure(x_range=[0,1],
             y_range=[0,1])
bplot.rect([0.5], [0.5], [0.2], [0.2])
bplot.show()

From the docstrings:

x (str or list[float])...

So, you need to provide a list with the specific points... very useful if you want to plot several rects ;-)

Upvotes: 1

Related Questions