Skip to content

added ChoiceLocator#8

Open
Sreekanth-M8 wants to merge 1 commit intor3kste:mainfrom
Sreekanth-M8:ChoiceLocator
Open

added ChoiceLocator#8
Sreekanth-M8 wants to merge 1 commit intor3kste:mainfrom
Sreekanth-M8:ChoiceLocator

Conversation

@Sreekanth-M8
Copy link
Collaborator

PR summary

added ChoiceLocator as per 20012

PR checklist

Copy link
Owner

@r3kste r3kste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sreekanth-M8 This looks good. As discussed, you can go ahead condense this solution to put as a comment to ask for initial feedback. There is just one minor comment about radial locator.

Copy link
Owner

@r3kste r3kste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran test_polar.py and left some comments about the failing tests.

  1. For Theta Tick, there is one test failing: lib/matplotlib/tests/test_polar.py::test_polar_theta_limits.

  2. For Radial Tick, there are a lot of tests failing.

As mentioned below, it would be better if we stick with only changing Theta ticks in this PR (as that is what the issue also expects).

def __init__(self, base=None, choices=None):
if choices is None:
choices = [
np.arange(-360, 360, 30.0),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 30 degree steps as first priority causes a lot of tests in test_polar.py to fail. It looks like the previous behavior was to use 45 degree intervals. So, it would be better to remove 30 degree intervals.

Suggested change
np.arange(-360, 360, 30.0),

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous behavior uses 45 degree intervals only for full circle. for other arcs with angles (< 360),
30 degree intervals are also used. I think adding a check for full circle might be better.

Comment on lines +751 to +767
def get_tick_space(self):
ends = mtransforms.Bbox.unit().transformed(
self.axes.transAxes - self.get_figure(root=False).dpi_scale_trans)
thetamin, thetamax = self.axes._realViewLim.intervalx
rmin, rmax = self.axes._realViewLim.intervaly
rorigin = self.axes.get_rorigin()
radius = min(ends.height, ends.width) * 72
actual_ratio = rmax / (rmax - rorigin)
if abs(thetamax - thetamin) > np.pi / 2:
radius /=2
# Having a spacing of at least 3 just looks good
size = self._get_tick_label_size('y') * 3
if size > 0:
return int(np.floor(radius * actual_ratio / size))
else:
return 2**31 - 1

Copy link
Owner

@r3kste r3kste Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the behavior of radial ticks causes a lot of tests to fail.

Now that I think about it, the issue doesn't really expect us to change Radial Ticks. It only mentions about the issue with Theta ticks. So I think it would be better if we stick to just Theta Ticks for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants