1

I am using the following code in python to visualize a circle with radius = 1 (using Bokeh). However, when I show the circle, it seems like the circle is distorted. As you can see in the plot below, the circle reaches x=+1 and x=-1 on the x-axis as expected, but on the y-axis it gets close to y=-1 and y=+1 but does not reach there, and it's more like 0.95 or something... I cannot understand the source of this issue in the code!

I have tried setting the aspect ratio but did not help, also tried match_aspect=True with no luck...

Code (running in jupyter notebook):

from bokeh.io import output_notebook, output_file, show
from bokeh.models import Circle
from bokeh.plotting import figure

# Create the figure with an aspect ratio of 1
p = figure(width=500, height=500, x_range=(-1.2, 1.2), y_range=(-1.2, 1.2),
           tools='tap', title='Distorted Circle!', aspect_ratio=1, match_aspect=True)

# Plot the circle
circle = Circle(x=0, y=0, radius=1, fill_color='lightblue', line_color='black')
p.add_glyph(circle)

output_notebook()
show(p, match_aspect=True)

Resulting visualization:

enter image description here

ameerosein
  • 523
  • 3
  • 16

0 Answers0