3
$\begingroup$

I'm trying to plot a set of points, Mathematica create the plot with the right range but it doesn't show all the digits (only shows up to six digits):

ListPlot[Table[{taillebase, 
   eigenvaluess[taillebase, λ][[1]]}, {taillebase, 31, 36}], 
 AxesLabel -> {HoldForm[Taille Base], HoldForm[Energie]}, 
 PlotLabel -> None, LabelStyle -> {GrayLevel[0]}, 
 PlotRange -> {0.8037705, 0.8037715}]

enter image description here

What can I do to have the range I indicated in the function {0.8037705, 0.8037715} on the Y axe instead of this truncated version?

Edit:

The method given by @george2079 works fine up to seven digits precision, if I try to go higher than that I get this problem:

ListPlot[Table[{wp, 
   En /. FindRoot[solfonpai2f[wp][En][3], {En, 0}]}, {wp, 20, 24, 1}],
  AxesLabel -> {HoldForm["Working Precision"], HoldForm["Energy"]}, 
 PlotLabel -> None, LabelStyle -> {GrayLevel[0]}, 
 PlotRange -> {0.80377060, 0.80377070}, 
 Ticks -> {Automatic, {#, NumberForm[N@#, {10, 9}]} & /@ 
    FindDivisions[{0.80377060, 0.80377070}, 10]}, 
 BaseStyle -> {PrintPrecision -> 10}]

enter image description here

Any idea how could I solve it?

$\endgroup$
  • 3
    $\begingroup$ Add BaseStyle -> {PrintPrecision -> 7} to your ListPlot options. $\endgroup$ – Carl Woll Apr 17 '17 at 17:41
  • 2
    $\begingroup$ A good question should provide all expression for reproducing. $\endgroup$ – yode Apr 17 '17 at 18:18
  • $\begingroup$ @CarlWoll I tried BaseStyle -> {PrintPrecision -> 7} but it doesn't seem to work, I keep getting the same result. $\endgroup$ – user5615 Apr 17 '17 at 19:22
  • $\begingroup$ Sorry, I guess my suggestion only works in M11. $\endgroup$ – Carl Woll Apr 20 '17 at 1:00
  • $\begingroup$ I'm using Mathematica 11, it works fine up to 7 digits, but if I do 8 or higher ie. BaseStyle -> {PrintPrecision -> 8} , it ignores it. $\endgroup$ – user5615 Apr 21 '17 at 18:14
2
$\begingroup$

Amplifying on my comments. The following should just work:

plot = ListPlot[
    Table[{x, x}, {x,31,36}],
    AxesLabel->{HoldForm[Taille Base],HoldForm[Energie]},
    PlotLabel->None,LabelStyle->{GrayLevel[0]},
    BaseStyle->{PrintPrecision->11},
    PlotRange->{0.80377, 0.80377001}
]

enter image description here

For some reason ListPlot can't believe that you really want such a small plot range, and so it changes the requested PlotRange to something more "reasonable":

Options[plot, PlotRange]

{PlotRange -> {{31., 36.}, {0, 1.60754}}}

The workaround is to use Show:

Show[plot, AxesOrigin->{31, .80377}, PlotRange->{{31, 36}, {.80377, .80377001}}]

enter image description here

Note that is unnecessary to specify explicit Ticks, the automatic behavior is just fine.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Lovely, thanks for taking the time to figure this out. $\endgroup$ – user5615 Aug 18 '17 at 15:49
0
$\begingroup$
ListPlot[RandomVariate[NormalDistribution[0.803771, 10^-6], 40], 
 PlotRange -> {0.8037705, 0.8037715}, 
 Ticks -> {Automatic, {#, NumberForm[N@#, {10, 7}]} & /@ 
    FindDivisions[{0.8037705, .8037715}, 8]}]

enter image description here

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ The method given works fine up to seven digits precision, if I try to go higher than that I get this problem mentioned in the edit, any idea how to get around it? @george2079 $\endgroup$ – user5615 Apr 19 '17 at 22:58
  • 1
    $\begingroup$ It looks like ListPlot thinks that the vertical range is too small, and so it changes it to something "reasonable". Try using Show[plot, PlotRange->{0.80377060, 0.80377070}, AxesOrigin->{0, .8037706}] $\endgroup$ – Carl Woll Apr 20 '17 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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