I have a plot in which I'd like many ticks along the x-axis, yet only some of the ticks will have tick labels associated with them. However, I'd like the tick marks for those that have labels to be longer than those that don't.
I know that you can turn the x-axis MinorTicks on, but that won't let you control where those ticks are actually located. For example, if the x-axis signifies days, I want tick marks every 7 days but labels every 28 days.
Moreover, setting the XTickLength
only lets you set the length for every tick mark, and not selectively.
What is the best way to control the tick lengths while allowing you to specify exactly where the ticks should be?
As said by yuk in this SO answer on a similar question about tick labels:
I guess the same applies to tick marks, but it is probably trickier.
Another solution could be to overlay your original axis with a second one, as suggested by bdecaf.
The R2014b update of the graphics engine introduced the following very simple solution: