# Increasing the length of frame ticks

I know that I can manually adjust the frame tick length using FrameTickStyle. However, is there a way to globally increase the tick length?

• What algorithm do you have in mind for increasing the tick length? How would it handle the production of major and minor ticks? FrameTicks does accept a generating function on righthand side of it rule. I think the best you can do is write a generating function includes code for producing ticks long enough to satisfy you. Sep 13, 2019 at 1:57

You can use the internal function ChartingScaledTicks (it takes the option TicksLength):

tickFunc = ChartingScaledTicks[{Identity, Identity},
TicksLength -> {.05, .02}][##] &;

Plot[
x^2,
{x, 0, 5},
Axes -> False,
Frame -> True,
FrameTicks -> {{tickFunc , Automatic}, {tickFunc , Automatic}}
]


Alternatively, to have the setting apply to all subsequent calls to Plot, you can set the option TicksLength globally:

SetOptions[ChartingScaledTicks, TicksLength -> {.05, .02}];


and use the setting {{All, Automatic}, {All, Automatic}} for FrameTicks:

Plot[
x^2,
{x, 0, 5},
Axes -> False,
Frame -> True, FrameTicks -> {{All, Automatic},{All, Automatic}}
]


same picture

Plot[
Sin[x],
{x, 0, 5},
Axes -> False,
Frame -> True, FrameTicks -> {{All, Automatic},{All, Automatic}}
]


• Awesome! Thanks kglr, this is exactly what I am looking for. However, where can I find documentation for functions such as ChartingScaledTicks?? Sep 13, 2019 at 21:43
• @baker, ChartingScaledTicks is not documented. You can use Needs["GeneralUtilities"]; PrintDefinitions[ChartingScaledTicks] to see its definition.
– kglr
Sep 13, 2019 at 21:49
• @kglr this comment is more valuable than I can express!!! I feel there should be a general answer to show the usage of this function, even if it is undocumented (because it is undocumented!). Apr 20, 2020 at 14:44
• This appears to not work for ListPlot. On the other hand, it seems to work without needing to set FrameTicks -> {{All, Automatic},{All, Automatic}} for ListLogPlot, ListLogLogPlot and the Plot counterparts.
– Alex
Apr 2 at 21:20

Honestly, I'm a little amazed that plot ticks didn't get a little bit of TLC during this last big update. I'm a little hopeful that it's on their list, but I'm not going to hold my breath.

The best way I've found to do this somewhat easily, is to download and install one of Mark Caprio's packages, either SciDraw or CustomTicks(http://library.wolfram.com/infocenter/MathSource/5599/). Once installed in the directory appropriate for your system (the guide provides instructions), you can do something like this:

<<CustomTicks
SetOptions[LinTicks, TickLengthScale -> 2];
Plot[
x^2,
{x, 0, 5},
Axes -> False,
Frame -> True,
FrameTicks -> {{LinTicks, StripTickLabels[LinTicks]},
{LinTicks, StripTickLabels[LinTicks]}}
]


I admit that this requires a bit of extra work the first time, but I set it up once back when I first got Mathematica 10, and haven't had to worry about it since. Plus, CustomTicks has a number of other useful features for ticks such as easily switching from inner ticks to outer ticks.

The other approach is to create your own function for generating ticks. It works, but it's cumbersome, and there are often unforeseen edge cases (well, there are for me, but perhaps others have better foresight).

ticks[min_, max_, stepsz_, majdivs_, baselength_,
insideticks_?BooleanQ, labels_?BooleanQ] :=
Table[
{i, If[Mod[i - min, majdivs] == 0 \[And] labels, ToString[Round@i], ""],
If[insideticks, #, Reverse[#]] &[{If[Mod[i - min, majdivs] == 0, 2
baselength, baselength], 0}]},
{i, min, max, stepsz}
]

Plot[
x^2,
{x, 0, 10},
Axes -> False,
Frame -> True,
FrameTicks -> {{Automatic, Automatic},
{ticks[1, 9, 0.2, 2, 0.02, True, True],
ticks[1, 9, 2/10, 2, 0.02, True, False]}}
]