Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8411689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:29:07+00:00 2026-06-10T00:29:07+00:00

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

  • 0

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 manipulate the axes of a ellipse, pyplot returns:

auto

which is less than useful. What methods would you suggest for plotting a circle on a pyplot plot with unequal axes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:29:09+00:00Added an answer on June 10, 2026 at 12:29 am

    It really does depend what you want it for.

    The problem with defining a circle in data coordinates when aspect ratio is auto, is that you will be able to resize the figure (or its window), and the data scales will stretch nicely. Unfortunately, this would also mean that your circle is no longer a circle, but an ellipse.

    There are several ways of addressing this. Firstly, and most simply, you could fix your aspect ratio and then put a circle on the plot in data coordinates:

    import matplotlib.pyplot as plt
    import numpy as np
    
    
    fig = plt.figure()
    ax = plt.axes()
    
    ax.set_aspect(1)
    theta = np.linspace(-np.pi, np.pi, 200)
    plt.plot(np.sin(theta), np.cos(theta))
    
    plt.show()
    

    data coords circle

    With this, you will be able to zoom and pan around as per usual, but the shape will always be a circle.

    If you just want to put a circle on a figure, independent of the data coordinates, such that panning and zooming of an axes did not effect the position and zoom on the circle, then you could do something like:

    import matplotlib.patches as mpatches
    import matplotlib.pyplot as plt
    import numpy as np
    
    
    fig = plt.figure()
    ax = plt.axes()
    patch = mpatches.Circle((325, 245), 180, alpha=0.5, transform=None)
    fig.artists.append(patch)
    
    
    plt.show()
    

    device coordinates circle

    This is fairly advanced mpl, but even so, I think it is fairly readable.

    HTH,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several file with the following format: lat,lon,value. I would like to plot
I have a dataset with labels which I would like to plot with points
I would like to plot a simple graphic. I have a dat set with
I got a 2d array of data which i would like to plot as
I have a distance sequence, which I would like to plot of a line
I have a large real 1-d data set called r. I would like plot:
I would like to plot a heatmap on a table imported from MATLAB. The
I would like to plot a vertical line (I'd prefer any orientation, but I'd
I would like to plot implicit equations (of the form f(x, y)=g(x, y) eg.
I would like to plot y1 and y2 in the same plot. x <-

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.