I am trying to add some polygons to the wedge but I got a problem
when I calculate the position of the edge of the circle I get wrong coodinates and the circle seem to be confusing it doesn’t follow the y axis the radius in my case is 0.95 but in the figure it is around 0.7 in the y axis and 0.95 in the x axis
this is how I am getting the edge coordinates
def get_x_y(df,radius,text_offset=0,arc=0):
ang = 0
x =
y =
for d in df:
##d is the angle and ang is the cumulative angle
x.append((radius - text_offset) * cos(ang + d/2))
y.append((radius - text_offset) * sin(ang + d/2) + 1)
The low level canvas primitives that draw circles/wedges always draw physical circles (i.e. circular in terms of square pixels). That means if the "data" aspect ratio of your x- and y- ranges does not match up with pixel aspect ratio of the plot on the screen, you get the situation you describe, where the radius does not match up in both dimensions. To deal with this, you should pass:
match_aspect=True
To your call to "figure". This will cause Bokeh to automatically adjust the x- and y- data range extents so that the data and screen aspect ratios are always matched (i.e. so circles measure the same radius in all directions). Note that you have to use default "auto ranging" for this to function. If you explicitly set range start/end yourself, bokeh assumes you know what you are doing and know what you want, and will use your values as given (i.e. it will ignore match_aspect if you set your own values).
I am trying to add some polygons to the wedge but I got a problem
when I calculate the position of the edge of the circle I get wrong coodinates and the circle seem to be confusing it doesn't follow the y axis the radius in my case is 0.95 but in the figure it is around 0.7 in the y axis and 0.95 in the x axis
<bokeh.png>
this is how I am getting the edge coordinates
def get_x_y(df,radius,text_offset=0,arc=0):
ang = 0
x =
y =
for d in df:
##d is the angle and ang is the cumulative angle
x.append((radius - text_offset) * cos(ang + d/2))
y.append((radius - text_offset) * sin(ang + d/2) + 1)