Skip to content

[Bug]: Inner border is not rendered correctly when using log-scale and polar projection. #30179

Closed

Description

@tillboehringer

Bug summary

When changing to a log-scale on a polar plot and changing the radial origin. The inner border is not in the correct place, it stays in the centre.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

angles = np.radians(np.linspace(15, 145, 10))
r = np.logspace(-30, -28, len(angles))

fig = plt.figure()
ax = plt.axes(projection='polar')

ax.scatter(angles, r)

ax.set_theta_zero_location('N')
ax.set_theta_direction(-1)
ax.set_rscale('log')
ax.set_thetamin(15)
ax.set_thetamax(145)

ax.set_rorigin(10**-33)

Actual outcome

Image

Expected outcome

Image

The inner Border should look like this one.

Additional information

No response

Operating system

OS/X

Matplotlib Version

3.10.3

Matplotlib Backend

backend_inline

Python version

3.13.2

Jupyter version

No response

Installation

pip

Activity

  1. jklymak commented on Jun 15, 2025

    @jklymak
    Member

    You have to call ax.set_rmin() as well

  2. tillboehringer commented on Jun 15, 2025

    @tillboehringer
    Author
    angles = np.radians(np.linspace(15, 145, 10))
    r = np.logspace(-30, -28, len(angles))
    
    fig = plt.figure()
    ax = plt.axes(projection='polar')
    
    ax.scatter(angles, r)
    
    ax.set_theta_zero_location('N')
    ax.set_theta_direction(-1)
    ax.set_rscale('log')
    ax.set_thetamin(15)
    ax.set_thetamax(145)
    
    ax.set_rmin(10**-33)
    ax.set_rorigin(10**-33)
    

    Image

    angles = np.radians(np.linspace(15, 145, 10))
    r = np.logspace(-30, -28, len(angles))
    
    fig = plt.figure()
    ax = plt.axes(projection='polar')
    
    ax.scatter(angles, r)
    
    ax.set_theta_zero_location('N')
    ax.set_theta_direction(-1)
    ax.set_rscale('log')
    ax.set_thetamin(15)
    ax.set_thetamax(145)
    
    ax.set_rmin(10**-30)
    ax.set_rorigin(10**-33)
    

    Image

    ax.set_rmin() won't give me the correct result, also the same if I switch the order of rmin and rorigin.

  3. jklymak commented on Jun 15, 2025

    @jklymak
    Member

    You are not being clear on what is "correct" here. The above looks correct to me.

  4. rcomer commented on Jun 15, 2025

    @rcomer
    Member

    @jklymak I think they mean the inner spine is in the wrong place - it’s all bunched up at the origin but should be at rmin.

  5. tillboehringer commented on Jun 15, 2025

    @tillboehringer
    Author

    @jklymak yes maybe I was not clear enough. I still want there to be a radial offset, so there is an inner border like in the plot under "Expected outcome" in the initial issue statement.

    I attached a plot with the marked border, that is missing in the other plots, in red.

    image

  6. jklymak commented on Jun 16, 2025

    @jklymak
    Member

    I see. Thanks - that does seem to be a bug - not sure what is causing that.

  7. rcomer commented on Jun 19, 2025

    @rcomer
    Member

    Possibly the logic here needs to account for the axis scale

    scaled_diameter = (rmin - rorigin) / (rmax - rorigin)
    self._height = scaled_diameter
    self._width = scaled_diameter

  8. QuLogic commented on Jun 20, 2025

    @QuLogic
    Member

    If you set the colour of the Axes, you can see that the Axes patch is also too big:

    import numpy as np
    import matplotlib.pyplot as plt
    
    angles = np.radians(np.linspace(15, 145, 10))
    r = np.logspace(0, 2, len(angles))
    
    fig = plt.figure()
    ax = plt.axes(projection='polar', facecolor='red')
    
    ax.scatter(angles, r)
    
    ax.set_rscale('log')
    ax.set_rorigin(10**-3)
    
    plt.show()
    

    Image

    The inner spine location is actually set by the Axes wedge, so the place to fix the problem is in there somewhere.

  9. added this to the v3.10.4 milestone on Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions