[Matplotlib-users] xtick label offsets

Matthew Bradley mbatr27 at gmail.com
Mon Jul 16 12:16:03 EDT 2018


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.

Matthew Bradley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180716/20be70e1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure_8_reproduced.png
Type: image/png
Size: 311923 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180716/20be70e1/attachment-0001.png>

More information about the Matplotlib-users mailing list