-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axis visual tick density #2196
base: main
Are you sure you want to change the base?
Axis visual tick density #2196
Conversation
This likely has a pretty big overlap with #2016. That PR was going to try to match matplotlib's interface. FYI to @lukasz-migas |
vispy/visuals/axis.py
Outdated
@property | ||
def tick_density(self): | ||
return self._tick_density |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a docstring. I was wondering if there is a more semantic measure we could adopt, like distance between ticks in logical pixels. But I guess these are different for vertical/horizontal axis, so a relative value makes sense, I guess.
major = _get_ticks_talbot(domain[0], domain[1], n_inches, 2) | ||
major = _get_ticks_talbot(domain[0], domain[1], n_inches, self._tick_density) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since tick_density is 1 by default, should we multiply with 2 here to get the same results as before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since tick_density is 1 by default, should we multiply with 2 here to get the same results as before?
Oops.
vispy/visuals/axis.py
Outdated
@@ -286,11 +301,13 @@ class Ticker(object): | |||
---------- | |||
axis : instance of AxisVisual | |||
The AxisVisual to generate ticks for. | |||
tick_density: int, higher number more ticks/labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a float? If I want less ticks, can I do tick_density=0.5
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update this once I get home.
vispy/visuals/axis.py
Outdated
tick_density: int | ||
Higher number than 1 means more ticks/labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to be a float.
I could be wrong, but it looks like both this and #2016 don't use the MaxNLocator. Isn't the whole point of that class to do this type of density calculation? If we can match matplotlib interfaces a little bit that would probably be nice. |
Add a way to control the AxisVisual tick density