8
$\begingroup$

I am trying to remove the decimal point displayed on the y-axis ticks. At the very least, a zero should follow the decimal point. I have included a MWE below.

Plot[Exp[x], {x, -20, 20}, PlotRange -> {-10^6, 10^6}, Frame -> True, 
Axes -> False, FrameLabel -> {Style["x",16],Style["f(x)",16]},
FrameStyle -> Directive[Black,16,Thickness[0.003]],
FrameTicks -> {{{{0,0}, {10^6,ScientificForm[10^6.0]},{10^6/2,ScientificForm[10^6.0/2]}},None},{Automatic,None}}]

This code generates the following figure. Does the problem stem from the use of ScientificForm?

enter image description here

$\endgroup$

2 Answers 2

10
$\begingroup$

Maybe use NumberPoint

Plot[Exp[x], {x, -20, 20}, PlotRange -> {-10^6, 10^6}, Frame -> True, 
Axes -> False, FrameLabel -> {Style["x",16],Style["f(x)",16]},
FrameStyle -> Directive[Black,16,Thickness[0.003]],
FrameTicks -> {{{{0,0}, {10^6,ScientificForm[10^6.0,NumberPoint->""]}, 
{10^6/2,ScientificForm[10^6.0/2,NumberPoint->""]}},None},{Automatic,None}}]

enter image description here

$\endgroup$
6
$\begingroup$

A footnote to 1066's answer:

I suggest to use Table for better readability or if you want to add more y-ticks. And with BaseStyle you can shorten FrameLabel.

Plot[Exp[x], {x, -20, 20},
 BaseStyle -> 16,
 PlotRange -> {-10^6, 10^6},
 Frame -> True,
 Axes -> False,
 FrameLabel -> {"x", "f(x)"},
 FrameStyle -> Directive[Black, Thickness[0.003]],
 FrameTicks -> {
   {Table[{x, ScientificForm[x, NumberPoint -> ""]}, {x, {0, 10.^6, 10.^6/2}}], None},
   {Automatic, None}}]

enter image description here

$\endgroup$

Your Answer

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

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