Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mars0001
Copy link
Contributor

Add a way to control the AxisVisual tick density

@djhoese
Copy link
Member

djhoese commented Aug 25, 2021

This likely has a pretty big overlap with #2016. That PR was going to try to match matplotlib's interface. FYI to @lukasz-migas

Comment on lines 216 to 218
@property
def tick_density(self):
return self._tick_density
Copy link
Member

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.

Comment on lines -395 to +412
major = _get_ticks_talbot(domain[0], domain[1], n_inches, 2)
major = _get_ticks_talbot(domain[0], domain[1], n_inches, self._tick_density)
Copy link
Member

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?

Copy link
Contributor Author

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.

@@ -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
Copy link
Member

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?

Copy link
Contributor Author

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.

Comment on lines 63 to 64
tick_density: int
Higher number than 1 means more ticks/labels
Copy link
Member

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.

@djhoese
Copy link
Member

djhoese commented Aug 26, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants