Is there a way to determine if the labels and ticks overlap?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have been making some plots in various formats. Sometimes the labels and the ticks start to overlap when I re-position everything. Is there a simple way of determining if they overlap, so a simple function that provides true/false?
I know how to change to position of the axis and the labels, so I do not need to know that. I only want to know if they overlap without looking at them myself.
2 Commenti
dpb
il 12 Giu 2014
There is no 'collision' property between objects in handle graphics, no.
You could write something that looks at the positions and tries to judge based on those values and font sizes and all, but I don't know of any way to return the extent of labels and axes text directly.
Adam Danz
il 24 Mag 2021
I've been playing around with this recently and thought I'd share my $0.02.
Predicting tick label overlap involves a lot of variables including but limited to
- Length of tick labels
- Number of tick labels
- Interval between tick labels
- Font size
- Font name
- Figure size
- Axes size
- Viewing angle of the axes
Matlab r2021a include a feature that auto-rotates tick labels if the labes are close to overlapping. Starting with this release you could detect auto-rotation from 0-degrees in the X|Y|ZTickLabelRotation axis-properties which would indicate that the tick labels might be overlapping if oriented at 0 deg, although the auto-rotation probably eliminates the need to detect this in the first place.
Note that tick label angles will adjust when tick labels are close to overlapping with little space between them, not only when there is an overlap.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Axis Labels in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!