1

I'm trying to plot the solution of an ODE and I would like to have the ticks in powers of ten. Although, this happes automatically from Mathematica for small orders, such as 10^(-6), it doesn't happen for orders of 10^(-5) and smaller. I tried to fix it in FrameTicks, but it shows as a fraction. The code is the following:

y =.;Sol = NDSolve[{D[y[x], x] == -4*10^(-2)*(y[x] - 10)*y[x], 
y[0] == 0.00999}, {y}, {x, 0, 0.000125}];
Plot1 = Plot[Evaluate[y[x] /. First[Sol]], {x, 0, tend},MaxRecursion -> 15, PlotPoints -> {200000, 100000}, Mesh -> False,AxesLabel -> {x, y}, PlotRange -> All, PlotStyle -> Green,FrameLabel -> {Style["x", FontFamily -> "MS Serif",FontSize -> 22],Style["y", FontFamily -> "MS Serif", FontSize -> 22]},RotateLabel -> True,Frame -> {{Automatic, False}, {Automatic,False}}];

Show[Plot1, PlotRange -> {{0, 0.000125}, {0.00999, 0.01}}, MaxRecursion -> 1000, PlotPoints -> {200000, 100000},AspectRatio -> 1, AxesOrigin -> {0, 0}, RotateLabel -> True,LabelStyle -> {20, GrayLevel[0]},FrameTicks -> {{{0, 0.00999, 0.009992, 0.009994, 0.009996, 0.009998,0.01}, None},{{0, 0.0000625, 0.000125}, None}}]

enter image description here

Is there a way to fix the tics in the plot?

Vicky
  • 85
  • 5
  • Do you mean like LogPlot[] or LogLogPlot[]? There's only one power of ten that's showing for y: Do you want only one tick mark? [Or, wild guess, do you want the ticks in scientific notation?) – Michael E2 Sep 25 '21 at 17:14
  • 1
    Possibly related: https://mathematica.stackexchange.com/questions/5369/about-the-number-format-in-ticks – Michael E2 Sep 25 '21 at 17:19
  • I was hoping to have something like 1.25*10^(-4) in the x-axis and 9.99*10^(-3)in the y-axis. Is this possible? – Vicky Sep 25 '21 at 17:28
  • 1
    This Q&A uses FrameTicks -> {{{#, ScientificForm@#} & /@ {0, 0.00999, 0.009992, 0.009994, 0.009996, 0.009998, 0.01}, None}, {{#, ScientificForm@#} & /@ {0, 0.0000625, 0.000125}, None}} – Michael E2 Sep 25 '21 at 18:12
  • That's perfect! Thank you very much! – Vicky Sep 25 '21 at 19:17
  • Do you possibly know how can I force the origin to be in the left-bottom corner of the plot instead of starting a bit higher and righter? Sometimes it does it automatically and some others not with no obvious reason (at least to me). – Vicky Sep 25 '21 at 19:24
  • Have you seen the option AxesOrigin? – Michael E2 Sep 25 '21 at 19:26
  • Yes, I've tried it already. In the code I've posted I have AxesOrigin -> {0, 0}. I just tried AxesOrigin -> {0, 0.00999}, but I get the same. I have a nb file that it is fine. I copied and pasted it and changed some parameters and then I got the spaces. – Vicky Sep 25 '21 at 20:07
  • It seems to be the PlotRange. Must be defined in both Plot1 and Show (instead of having PlotRange -> All in Plot1). Thank you for your help anyway! – Vicky Sep 25 '21 at 20:22
  • Why do not you plot, say, y-0.00999 at the y-axis and x-0.0000625 at the y-axis? Then the numbers at the ticks, would be much easier to see. – Alexei Boulbitch Sep 25 '21 at 20:56

0 Answers0