On Sun, Jan 29, 2012 at 10:10 PM, C M <cmpython@gmail.com> wrote:


On Wed, Jan 4, 2012 at 2:19 PM, Benjamin Root <ben.root@ou.edu> wrote:


On Wednesday, January 4, 2012, jeffsp <jeffsp@gmail.com> wrote:
>
> plt.tight_layout(), sweet
>
> it still makes the labels too close to read, even if they don't overlap.
> that is, they're just a continuous string of numbers with no whitespace
> between.
>
> it does clean up the rest of the plot really nicely, though, without having
> to continually dick around with subplots_adjust
>
>

Well, it is a new feature with plenty of room for improvements.  Maybe some sort of mindist parameter would be useful to establish a minimum distance between text objects?

Ben Root


Something like that sounds good.  If there were a way to make it the default that labels would never overlap (but that default could be toggled for those who, somehow, want to not be able to read their labels?), that strikes me as best.

In the meantime, what are other ways to do this?


Just to clarify, I don't think improvements to `tight_layout` will fix your issues with tick layout; `tight_layout` adjusts the subplot spacing, not the spacing of tick labels. 

If you just want to prevent overlap in the static case, you can just set the tick labels yourself, e.g. `plt.xticks([1, 2, 3])`. If you want something automatic and dynamic, ...

I believe this is actually a pretty difficult problem to solve in the general case. I've implemented a hacky attempt here, but it leaves out a lot of common use cases (e.g. subplots) and doesn't account for spacing between the axes and figure.

-Tony