Bokeh Circle does not fit into square?

Viewed 1247

I am plotting some geometry using bokeh and came across this. I am plotting a rectangle with equal sides (i.e. a square), and in that square, plotting a circle with diameter = width of the square. The circle should tangent to the square at edges, but it is not.

here is the code:

from bokeh.plotting import output_notebook, figure, show
output_notebook()

p = figure(width=500, height=500)

p.rect(0, 0, 300, 300, line_color='black')
p.circle(x=0, y=0, radius=150, line_color='black', 
         fill_color='grey',  radius_units='data')

p.axis.minor_tick_out = 0

show(p)

Which results in this:

enter image description here

Is there anything I am doing wrong or could change to make the circle fit exactly in the square?

Thanks in advance, Randall

Here's another case - just drawing a circle:

p = figure(width=500, height=500, x_range=(-150, 150), y_range=(-150, 150))
p.circle(x=0, y=0, radius=150, line_color='black', 
         fill_color='grey', radius_units='data')
show(p)

radius of the circle is 150 in the x direction, but not the y-direction.

enter image description here

5 Answers
Related