Repository: matplotlib/matplotlib

Issue:
[Bug]: Inner border is not rendered correctly when using log-scale and polar projection.
### 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

```Python
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](https://github.com/user-attachments/assets/e6e9d156-0c7f-4f39-aeca-551639ade884)

### Expected outcome

![Image](https://github.com/user-attachments/assets/d5768df8-c1ed-4fae-832b-ad226d7e515e)

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


Discussion:
You have to call ax.set_rmin() as well 
```Phyton
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](https://github.com/user-attachments/assets/3359f060-6b47-4559-8c95-86f3fc846dac)

```Phyton
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](https://github.com/user-attachments/assets/fefd73cb-09c0-4f38-85bc-8e678fa890e8)

ax.set_rmin() won't give me the correct result, also the same if I switch the order of rmin and rorigin.
You are not being clear on what is "correct" here. The above looks correct to me.  
@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.
@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](https://github.com/user-attachments/assets/f8af5614-613b-4da5-b767-b9ebcdc0739a)
I see.  Thanks - that does seem to be a bug - not sure what is causing that. 

Possibly the logic here needs to account for the axis scale

https://github.com/matplotlib/matplotlib/blob/8b8272945441b74d5dd7b5815c88a49608b8926d/lib/matplotlib/spines.py#L273-L275
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](https://github.com/user-attachments/assets/7500af11-9139-4d9f-a00d-c363d2c39a89)

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



Patch:
diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py
index 948b3a6e704f..8fdb31b4256e 100644
--- a/lib/matplotlib/projections/polar.py
+++ b/lib/matplotlib/projections/polar.py
@@ -817,6 +817,10 @@ def _init_axis(self):
         self.xaxis = ThetaAxis(self, clear=False)
         self.yaxis = RadialAxis(self, clear=False)
         self.spines['polar'].register_axis(self.yaxis)
+        inner_spine = self.spines.get('inner', None)
+        if inner_spine is not None:
+            # Subclasses may not have inner spine.
+            inner_spine.register_axis(self.yaxis)
 
     def _set_lim_and_transforms(self):
         # A view limit where the minimum radius can be locked if the user
@@ -961,7 +965,9 @@ def draw(self, renderer):
         thetamin, thetamax = np.rad2deg(self._realViewLim.intervalx)
         if thetamin > thetamax:
             thetamin, thetamax = thetamax, thetamin
-        rmin, rmax = ((self._realViewLim.intervaly - self.get_rorigin()) *
+        rscale_tr = self.yaxis.get_transform()
+        rmin, rmax = ((rscale_tr.transform(self._realViewLim.intervaly) -
+                       rscale_tr.transform(self.get_rorigin())) *
                       self.get_rsign())
         if isinstance(self.patch, mpatches.Wedge):
             # Backwards-compatibility: Any subclassed Axes might override the
diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py
index 7e77a393f2a2..9732a2f3347a 100644
--- a/lib/matplotlib/spines.py
+++ b/lib/matplotlib/spines.py
@@ -265,11 +265,17 @@ def _adjust_location(self):
                 self._path = mpath.Path.arc(np.rad2deg(low), np.rad2deg(high))
 
                 if self.spine_type == 'bottom':
-                    rmin, rmax = self.axes.viewLim.intervaly
+                    if self.axis is None:
+                        tr = mtransforms.IdentityTransform()
+                    else:
+                        tr = self.axis.get_transform()
+                    rmin, rmax = tr.transform(self.axes.viewLim.intervaly)
                     try:
                         rorigin = self.axes.get_rorigin()
                     except AttributeError:
                         rorigin = rmin
+                    else:
+                        rorigin = tr.transform(rorigin)
                     scaled_diameter = (rmin - rorigin) / (rmax - rorigin)
                     self._height = scaled_diameter
                     self._width = scaled_diameter


Test patch:
diff --git a/lib/matplotlib/tests/test_polar.py b/lib/matplotlib/tests/test_polar.py
index 31e8cdd89a21..c0bf72b89eb0 100644
--- a/lib/matplotlib/tests/test_polar.py
+++ b/lib/matplotlib/tests/test_polar.py
@@ -482,6 +482,26 @@ def test_polar_log():
     ax.plot(np.linspace(0, 2 * np.pi, n), np.logspace(0, 2, n))
 
 
+@check_figures_equal()
+def test_polar_log_rorigin(fig_ref, fig_test):
+    # Test that equivalent linear and log radial settings give the same axes patch
+    # and spines.
+    ax_ref = fig_ref.add_subplot(projection='polar', facecolor='red')
+    ax_ref.set_rlim(0, 2)
+    ax_ref.set_rorigin(-3)
+    ax_ref.set_rticks(np.linspace(0, 2, 5))
+
+    ax_test = fig_test.add_subplot(projection='polar', facecolor='red')
+    ax_test.set_rscale('log')
+    ax_test.set_rlim(1, 100)
+    ax_test.set_rorigin(10**-3)
+    ax_test.set_rticks(np.logspace(0, 2, 5))
+
+    for ax in ax_ref, ax_test:
+        # Radial tick labels should be the only difference, so turn them off.
+        ax.tick_params(labelleft=False)
+
+
 def test_polar_neg_theta_lims():
     fig = plt.figure()
     ax = fig.add_subplot(projection='polar')
diff --git a/lib/matplotlib/tests/test_spines.py b/lib/matplotlib/tests/test_spines.py
index 353aede00298..d6ddcabb6878 100644
--- a/lib/matplotlib/tests/test_spines.py
+++ b/lib/matplotlib/tests/test_spines.py
@@ -154,3 +154,15 @@ def test_spines_black_axes():
     ax.set_xticks([])
     ax.set_yticks([])
     ax.set_facecolor((0, 0, 0))
+
+
+def test_arc_spine_inner_no_axis():
+    # Backcompat: smoke test that inner arc spine does not need a registered
+    # axis in order to be drawn
+    fig = plt.figure()
+    ax = fig.add_subplot(projection="polar")
+    inner_spine = ax.spines["inner"]
+    inner_spine.register_axis(None)
+    assert ax.spines["inner"].axis is None
+
+    fig.draw_without_rendering()