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.

The figure below is made by MATLAB. However, the scientific form of numbers in FrameTicks that how MATLAB deals with is quite different from that of Mathematica.

MATLAB plots with nice ticks

By default, I plot the second figure based on the same data in a Mathematica way. Mathematica plots However, what is messy in the second figure is the overused ZERO in the vertical axis. So my first question is how to transform the number on the FrameTicks into some suitable scientific form. Well, after we transform them into scientific form, my second question arises: how to make the plot in the MATLAB way? For example, if one of the frame ticks is 2*10^-4, I hope to put only 2 on the vertical axis and 10^-4 on the left top of the figure (Like the first one in the second column in the first figure). I think we can test the idea based on

Plot[10^5 * Sin[x], {x, 0, 10}, Frame -> True]

I think I can solve this problem in a stupid way: multiply/divide every number on the frame ticks by some number x, then place a graphics object of text which writes x to the left top side of the figure. But really what I need is a general way to do that. Any help will be appreciated.

share|improve this question
1  
There are many related questions around, search for ticks + number. You should also provide your Mathematica code used to generate your graphics - seems like some scaling issue is involved. –  Yves Klett Apr 22 '13 at 9:21
    
Thanks. However, I have tried searching for solution, still no better way to be implememt. Well, I should paste my code. But how about testing our ideas on the simple example I mentioned before the last paragraph. Thanks friend. –  Life Apr 22 '13 at 10:09
    
Please do post your code (as minimal working example), because things like Grid etc. may be playing a part as well. –  Yves Klett Apr 22 '13 at 11:31
add comment

2 Answers 2

You can probably get close to what you want with some fiddling. Make the ticks to your satisfaction:

leftticks = Table[{k,NumberForm[k,ExponentFunction->(If[-2<#<2,Null,#]&)]},
   {k, -10^5, 10^5,50000.}]
rightticks = Table[{k,k/10^5},{k, -10^5, 10^5, 10.0^5/2}]

Then put them into the Plot function.

Labeled[
   Plot[10^5 Sin[x],{x,0,10},
     Frame -> True,
     FrameTicks->{{leftticks, rightticks}, {Automatic,None}}],
  {"*10^5", "1.2"}, {{Top,Right}}]

image

Perhaps the flexibility compensates for the fiddliness...

share|improve this answer
add comment

You should post your source code for doing the fancy plots.. Yet, working from your suggested example, TickLabelFunction is an option from the LevelScheme package that does the trick. Get the package here.

Run it:

<< LevelScheme`

And then use the TickLabelFunction to label your plot. Notice how you are not labeling the axes, but the frame. You go from this:

Plot[10^5*Sin[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{LinTicks[-1*^5, 1*^5, 5*^4, 4, 
     MajorTickStyle -> Thickness[0.005], 
     MinorTickStyle -> Thickness[0.005]], 
    None}, {LinTicks[0, 10, 2, 4, MajorTickStyle -> Thickness[0.005], 
     MinorTickStyle -> Thickness[0.005]], None}}]

enter image description here

To this

Plot[10^5*Sin[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{LinTicks[-1*^5, 1*^5, 5*^4, 4, 
     MajorTickStyle -> Thickness[0.005], 
     MinorTickStyle -> Thickness[0.005], 
     TickLabelFunction -> Function[x, N[x 1*^-5]]], 
    None}, {LinTicks[0, 10, 2, 4, MajorTickStyle -> Thickness[0.005], 
     MinorTickStyle -> Thickness[0.005]], None}}]

enter image description here

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.