Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
5  
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? –  tkott Apr 10 '12 at 2:42
    
Please post it as an answer and accept it. –  belisarius Apr 10 '12 at 11:52
    
I can accept it only in 2 days apparently. Didn't know if it was ok to answer your own question... –  tkott Apr 10 '12 at 13:10
    
Yes, it is OK in these cases. –  belisarius Apr 10 '12 at 14:44
add comment

1 Answer

up vote 6 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.