9
$\begingroup$

UPDATE

While the self-posted answer below (TickLabelStyle->TraditionalForm) works for most things, it also has the following effect: Integers are given periods in the label. That is, if the ticks would be at {1,2,3,4}, the labels are given as {"1.","2.","3.","4."} instead of the more pleasing {"1","2","3","4"}. Is there a better form or formatting function to use in this case?


I'm using the CustomTicks package from LevelScheme, and am having problems with displaying things when the range is very small ($10^{-11}$). For example, with default Mathematica:

ListPlot[{RandomReal[#], RandomReal[#]} & /@ (Range[100] 10^-10), Frame -> True, Axes -> False] 

Gives

Mathematica graphics

While the equivalent, reproducible CustomTicks equivalent is:

ListPlot[{RandomReal[#], RandomReal[#]} & /@ (Range[100] 10^-10), Frame -> True, Axes -> False, FrameTicks -> {LinTicks, LinTicks, StripTickLabels@LinTicks, StripTickLabels@LinTicks}] 

which gives:

Mathematica graphics

Erk. I must be missing something from the documentation, but I can't seem to find the right options. I want to eventually set more options for LinTicks (such as Tick length, etc), but this is a minimal example, and once this is solved, I can work on adding those options.

I can also double check that the range is set correctly by doing things slightly more by hand:

In[11]:= data = {RandomReal[#], RandomReal[#]} & /@ (Range[100] 10^-10); xRange = {Min@data[[All, 1]], Max@data[[All, 1]]} yRange = {Min@data[[All, 2]], Max@data[[All, 2]]} Out[12]= {3.82894*10^-11, 9.18792*10^-9} Out[13]= {5.96584*10^-12, 9.54224*10^-9} In[14]:= ticks = FrameTicks -> { LinTicks[xRange[[1]], xRange[[2]], MajorTickLength -> {0, 0.015}, MinorTickLength -> {0, 0.005}], LinTicks[yRange[[1]], yRange[[2]], MajorTickLength -> {0, 0.015}, MinorTickLength -> {0, 0.005}], StripTickLabels@LinTicks[xRange[[1]], xRange[[2]]], StripTickLabels@LinTicks[yRange[[1]], yRange[[2]]] } 

Output omitted, but the range from LinTicks is correct. The x axis is $2\times 10^{-9}$ to $9\times 10^{-9}$, so they should output fine.

ListPlot[data, Frame -> True, Axes -> False, ticks] 

Gives

Mathematica graphics

Any ideas?

$\endgroup$
3
  • 5
    $\begingroup$ damn it, I of course found an answer as soon as I posted: use the option TickLabelFunction->TraditionalForm for the LinTicks. I'm wondering if that breaks anything else... anyone have any insight? $\endgroup$ Commented Apr 10, 2012 at 2:42
  • $\begingroup$ I can accept it only in 2 days apparently. Didn't know if it was ok to answer your own question... $\endgroup$ Commented Apr 10, 2012 at 13:10
  • $\begingroup$ Yes, it is OK in these cases. $\endgroup$ Commented Apr 10, 2012 at 14:44

1 Answer 1

7
$\begingroup$

As soon as I posted, I realized I could check whether there were any options for LinTicks that might be useful:

Options@LinTicks // TableForm 

Scanning that list, I saw:

TickLabelFunction -> Automatic 

On a hunch, I added

TickLabelFunction -> TraditionalForm 

To the ticks definition from the question, and things worked:

Mathematica graphics

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.