plot circle on unequal axes with pyplot

前端 未结 3 427
一个人的身影
一个人的身影 2021-01-11 17:17

I would like to plot a circle on an auto-scaled pyplot-generated graphic. When I run

ax.get_aspect()

hoping for a value with which I could

3条回答
  •  难免孤独
    2021-01-11 17:50

    This question is more than one year old, but I too just had this question. I needed to add circles to a matplotlib plot and I wanted to be able to specify the circle's location in the plot using data coordinates, and I didn't want the circle radius to change with panning/zooming (or worse the circle turning into an ellipse).

    The best and most simple solution that I've found is simply plot a curve with a single point and include a circle marker:

    ax.plot(center_x,center_y,'bo',fillstyle='none',markersize=5)
    

    which gives a nice, fixed-size blue circle with no fill!

提交回复
热议问题