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

  • SEARCH
  • Home
  • 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 7582027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:20:19+00:00 2026-05-30T18:20:19+00:00

I have the following Python code which I am using to plot a filled

  • 0

I have the following Python code which I am using to plot a filled contour plot:

  def plot_polar_contour(values, azimuths, zeniths):
  theta = np.radians(azimuths)
  zeniths = np.array(zeniths)

  values = np.array(values)
  values = values.reshape(len(azimuths), len(zeniths))

  r, theta = np.meshgrid(zeniths, np.radians(azimuths))
  fig, ax = subplots(subplot_kw=dict(projection='polar'))
  ax.set_theta_zero_location("N")
  ax.set_theta_direction(-1)
  cax = ax.contourf(theta, r, values, 30)
  autumn()
  cb = fig.colorbar(cax)
  cb.set_label("Pixel reflectance")
  show()

This gives me a plot like:

enter image description here

However, when I add the line ax.plot(0, 30, 'p') just before show() I get the following:

enter image description here

It seems that just adding that one point (which is well within the original axis range) screws up the axis range on the radius axis.

Is this by design, or is this a bug? What would you suggest doing to fix it? Do I need to manually adjust the axis ranges, or is there a way to stop the extra plot command doing this?

  • 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-05-30T18:20:20+00:00Added an answer on May 30, 2026 at 6:20 pm

    If the axis auto-scaling mode isn’t explicitly specified, plot will use “loose” autoscaling and contourf will use “tight” autoscaling.

    The same things happens for non-polar axes. E.g.

    import matplotlib.pyplot as plt
    import numpy as np
    
    plt.imshow(np.random.random((10,10)))
    plt.plot([7], [7], 'ro')
    plt.show()
    

    You have a number of options.

    1. Explicitly call ax.axis('image') or ax.axis('tight') at some point in the code.
    2. Pass in scalex=False and scaley=False as keyword arguments to plot.
    3. Manually set the axis limits.

    The easiest and most readable is to just explicitly call ax.axis('tight'), i.m.o.

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

Sidebar

Related Questions

I have the following python code using the twisted API. def function(self,filename): def results(result):
I am using the following code which I have found online def c_int_binary_search(seq,t): #
I have the following Python code: cursor.execute("INSERT INTO table VALUES var1, var2, var3,") where
I have the following code in Python: def point_to_index(point): if point not in points:
I have the following code (using Python 2.7): # shared command line options, like
I have the following python code which pushes data to db: cursor.execute(INSERT INTO +
I have opened a shelve using the following code: #!/usr/bin/python import shelve #Module:Shelve is
I have the following Python code: import xml.dom.minidom import xml.parsers.expat try: domTree = ml.dom.minidom.parse(myXMLFileName)
I have the following Python 2.6 program and YAML definition (using PyYAML ): import
In python I have the following function: def is_a_nice_element(element, parameter): #do something return True

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.