13
$\begingroup$

In my problem, I need to plot a figure in a relatively small region of the $x$ axis, e.g.,

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

and the figure is displayed properly, but all the tick marks have the same label:

Mathematica graphics

Is there any clever way to get rid of this problem?

$\endgroup$
3
  • 2
    $\begingroup$ 欢迎来到Mathematica.SE! :-) Don't worry about image uploading, you'll soon have enough reputation to do it. Until then we'll help you. Please make sure to include the question in the body of the post as well (not only in the title). A little redundancy doens't help $\endgroup$
    – Szabolcs
    May 7, 2012 at 13:44
  • $\begingroup$ Oh great! I think U know well about Chinese language, SZabolcs. $\endgroup$
    – yulinlinyu
    May 11, 2012 at 1:26
  • $\begingroup$ Related: (3436) $\endgroup$
    – Mr.Wizard
    Oct 29, 2014 at 9:55

2 Answers 2

15
$\begingroup$

You can define your own function for FrameTicks :

ticks[min_, max_] := {#, NumberForm[#, 20]} & /@ 
  N[FindDivisions[{min, max}, 5]]

ListPlot[{RandomReal[#] + 10^4, 
    RandomReal[#]} & /@ (Range[100] 10^-10), Frame -> True, 
 FrameTicks -> {{Automatic, None}, {ticks, None}}]

Mathematica graphics

Just choose your own preferred presentation format of the given values...

ticks[min_, max_] := {#, Grid[{{min}, {"+"}, {# - min}}]} & /@ 
  N[FindDivisions[{min, max}, 5]]

ListPlot[{RandomReal[#] + 10^4, 
    RandomReal[#]} & /@ (Range[100] 10^-10), Frame -> True, 
 FrameTicks -> {{Automatic, None}, {ticks, None}},FrameStyle->Medium]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Excellent work!! $\endgroup$
    – yulinlinyu
    May 7, 2012 at 13:04
7
$\begingroup$
ListPlot[{RandomReal[#] + 10^4, RandomReal[#]} & /@ (Range[100] 10^-10), Frame -> True, 
          Axes -> False, FrameLabel -> {"x - 10^4", "y"}] /. 
          List[x_, y_] /; x > 10000 -> List[x - 10000, y]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ i'm sure it'a a way to solve it. $\endgroup$
    – yulinlinyu
    May 7, 2012 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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