Reputation: 75
I am looking through the documentation of matplotlib for the purpose of adding a tick that separate the axes
http://matplotlib.org/api/axes_api.html
I've already have label that associate with a list of ticks
axes._setXTicks(ticks, labels, **kwargs)
so I want a thicker line for the additional tick, something like this would be great
axes._setXTicks([0, 5, 7, 10, 15], ["0","5", "thicker tick", "10", "15], **kwargs)
although I want the thicker tick line to be actually a tick that is wider but without labels
Is this possible.
I've tried looking through the document but the closest thing I found is
axes.axvline(7, *args, **kwargs)
which adds a line through the entire graph in the xth position (7 in this case), although I only wanted a thicker tick
Thanks
Upvotes: 0
Views: 65
Reputation: 24278
You're almost there. Just use the additional arguments ymin
and ymax
of axvline
to set the tick length:
ymin, ymax = axes.get_ylim()
axes.axvline(7, ymin=ymin, ymax=ymin + 0.05*(ymax - ymin))
Note that I calculate the tick length automatically to be 5% of the axes height. This can of course be adjusted. Also, the axvline
function takes more arguments to set e.g. the line width.
Upvotes: 2