# Using the "Automatic" values in FrameTicks

In here, I have asked a question about the use of Tick (FrameTicks).

An extension to the question is,

x1 = Range[0, 10, 1];
y1 = Sin[x1];

(* This gives the automatic points of x-axis values,2,4,6,8 *)

(* This takes too many values for x-axis (bottom one)  *)
ListLinePlot[
FrameTicks -> {
{Automatic, Automatic},
},
Mesh -> Full,
Frame -> True
]


How do I use the automatic ticks (2,4,6,8) and Exp[] those values instead of the whole list of xlst?

• @MikeHoneychurch This is just a toy example. What I am actually plotting is more complicated to pre determine the values. Dec 9 '14 at 20:51
• Say for a particular dataset, i first need to plot (guess) from 0 to 100 with 20 points. If the graph is good, I would want to plot more points in the interval. If the graph is not good, I would want to use less points. Also, when I Exp[], the values a "longer", they occupy more space. So I want to find a lazy way to deal with it. For the actual problem, the y values come from NMaximize, so it's a trial and error process for plot. (to determine the ranges of interest). Dec 9 '14 at 21:03

You can use FindDivisions:

divs = FindDivisions[Through@{Min, Max}@x1, 5]
(* {0,2,4,6,8,10} *)

FrameTicks -> {{Automatic, Automatic}, {Thread[{divs, Exp[divs] // N}], x1}},
Mesh -> Full,  Frame -> True]


Or, post-process the frame ticks to change the labels:

xticks = (FrameTicks /. AbsoluteOptions[llpa, FrameTicks])[[1]] /.
{x_, x_, y___} :> {x, Exp[x], y};

Note: AbsoluteOptions does not always work as expected.
• @Chen, i posted an alternative method using AbsoluteOptions to get the FrameTicks. Although it seems to work here, AbsoluteOptions is known to be unrealiable in general.