4
$\begingroup$

I have looked into previous questions about forcing scientific notation frame ticks and even I do the same thing my plot still has the wrong ticks.

Instead of 1/1000 I want to have $10^{-3}$.

enter image description here

RegionPlot[{Subscript[C, WW] + Subscript[C, BB] < 0}, {Subscript[C, 
  WW], -1.1*10^(-3), 1.1*10^(-3)}, {Subscript[C, BB], -1.1*10^(-3), 
  1.1*10^(-3)}, PlotPoints -> 50, 
 PlotRange -> {{-1.1* 10^(-3), 1.1*10^(-3)}, {-1.1*10^(-3), 
    1.1*10^(-3)}}, 
 FrameTicks -> {{#, ScientificForm@#} & /@ 
    Range[-10^-3, 10^-3, 10^-3], {#, ScientificForm@#} & /@ 
    Range[-10^-3, 10^-3, 10^-3]}, ImageSize -> 450]
$\endgroup$
2
$\begingroup$

You can fix this by writing you expression for the FrameTicks option is a much simpler way. To get the ScientificForm to format your limits correctly, you should note the use of 10.^-3 in place of 10^-3.

Plot[x, {x, -1.1*^-3, 1.1*^-3},
  Frame -> True,
  FrameTicks -> ConstantArray[{#, ScientificForm @ #} & /@ 10.^-3 {-1, 0, 1}, 2], 
  ImageSize -> 450]

plot

Update

The above plot doesn't print .001 as 1.*10^(-3) because, by default, numbers that can show all their significant digits when printed at normal output width are not printed in exponent form. However, we can suppress the default behavior. Like so:

tickF = 
  {#, 
   ScientificForm[#, 
     NumberFormat -> (Function[{m, b, e}, If [e == "", m, Row[{m, "×", 10^e}]]])]} &;

Plot[x, {x, -1.1*^-3, 1.1*^-3}, 
  Frame -> True, 
  FrameTicks -> ConstantArray[tickF /@ (10.^-3 {-1, 0, 1}), 2], 
  ImageSize -> 450]

plot

$\endgroup$
1
$\begingroup$

Need .s after each 10 to make ScientificForm working.

RegionPlot[{Subscript[C, WW] + Subscript[C, BB] < 0}, {Subscript[C, 
   WW], -1.1*10^(-3), 1.1*10^(-3)}, {Subscript[C, BB], -1.1*10^(-3), 
  1.1*10^(-3)},
 PlotPoints -> 50, 
 PlotRange -> {{-1.1*10^(-3), 1.1*10^(-3)}, {-1.1*10^(-3), 
    1.1*10^(-3)}}, 
 FrameTicks -> {{#, ScientificForm@#} & /@ 
    Range[-10.^-3, 10^-3, 10.^-3], {#, ScientificForm@#} & /@ 
    Range[-10.^-3, 10^-3, 10.^-3]},
 ImageSize -> 450]

enter image description here

or

RegionPlot[{Subscript[C, WW] + Subscript[C, BB] < 0}, {Subscript[C, 
   WW], -1.1*10^(-3), 1.1*10^(-3)}, {Subscript[C, BB], -1.1*10^(-3), 
  1.1*10^(-3)},
 PlotPoints -> 50, 
 PlotRange -> {{-1.1*10^(-3), 1.1*10^(-3)}, {-1.1*10^(-3), 
    1.1*10^(-3)}}, 
 FrameTicks -> {{#, 
      If[# == 0, 0, 
         ScientificForm[#, 
          NumberFormat -> (Superscript[#2, #3] &)]] &@#} & /@ 
    Range[-10.^-3, 10^-3, 
     10.^-3], {#, 
      If[# == 0, 0, 
         ScientificForm[#, 
          NumberFormat -> (Superscript[#2, #3] &)]] &@#} & /@ 
    Range[-10.^-3, 10^-3, 10.^-3]},
 ImageSize -> 450]

enter image description here

$\endgroup$

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.