plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.06k stars 2.54k forks source link

add new omit_first_ticklabels and omit_last_ticklabels property to axes #4675

Open gvwilson opened 2 months ago

gvwilson commented 2 months ago

We would like to make use of an omit_first_ticklabels and 'omit_last_ticklabels' property on the axes. The property should allow to hide the first X or last X ticklabels, which would otherwise appear. This can be used to create cleaner and more refined print charts in scenarios, where the last or first label is not desirable or to close to the outer border of the chart to look visually appealing.

The same effect could be achieved with the new labelalias property by replacing the last or first label with an empty string, but the proposed method would be more intuitive and would also work well for automated data-updates, which might influence the range.

The new properties should take integers as input.

gvwilson commented 2 months ago

Just to make sure we've explored our options, I wonder if labeldomain would be better for unknown ranges, so rather than "omit the first label" you could say "show no label on the first 10% of the axis."

gvwilson commented 2 months ago

Granted, that would be an option. If it is significantly easier for you to implement, I can discuss it with the users as an alternative.

We're thinking from the perspective of a graphical user interface, where the user can click the outer ticks away. Here it is a bit more intuitive to remove one tick per click, but we could also make it a text field into which the user can enter a percentage. It feels a bit less elegant to me though.

It would be great, if we could implement this property once for ticks and once for ticklabels.