[Matplotlib-users] xtick label offsets
jklymak at uvic.ca
Mon Jul 16 12:48:36 EDT 2018
I’d just use `ax.text` for this. If you are fussy about the y-position of the labels then you can fetch the y-coordinate of one of the x-ticks.
> On 16 Jul 2018, at 09:16, Matthew Bradley <mbatr27 at gmail.com> wrote:
> I'm working on offsetting xticks and xtick labels that are calculated and set by a function. In some cases the positions of the calculated xticks overlap (such as in the attached png) and I want to space them apart instead of making them visible by rotating the label text. I've tried adding an additional tick mark and setting the label of the additional tick mark to be the value I want, and set the labels of the overlapping tick marks to be blank text. This gets the labels where I want them but then I can't get rid of the extra tickmarks introduced. I've looked through the online documentation for Tick and XTick instances and can't find a command that affects only the tickmark, and doesn't make both the tickmark and the label disappear.
> Is there a way to make a single tickmark go away and keep its label visible?
> Alternatively is there a way to adjust the x position of xtick labels by a certain amount using something like texts set_x() function?
> If anyone more familiar with text and tick properties knows a way to do this then please let me know! Otherwise I will look into using figure annotations to brute force it to look the way I want it to.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matplotlib-users