1
$\begingroup$
rp = 2*10^3;
ro = 1.88*10^8;
h[p_] := p (rp/ro)^2;
listh = Table[{p, h[p]}, {p, 1, 100000}];
ListLogPlot[listh, PlotTheme -> "Detailed", LabelStyle -> Black, FrameStyle -> {Black, 10},PlotRange -> All]

This code plots the graph seen below enter image description here I just wanted to change the frameticks in the horizontal axis like 2x10^4, 4x10^4, 6x10^4, 8x10^4, 1x10^5. How is this possible?

$\endgroup$
1
  • $\begingroup$ Related: (5369) $\endgroup$
    – Mr.Wizard
    Commented Mar 8, 2020 at 16:03

2 Answers 2

1
$\begingroup$

It's possible to define and use a custom ticks function as follows:

ticksfn =
  {#, ScientificForm[N@#, NumberPoint -> ""]} & /@ 
     FindDivisions[{#, #2}, 6] &;

rp = 2*10^3;
ro = 1.88*10^8;
h[p_] := p (rp/ro)^2;
listh = Table[{p, h[p]}, {p, 1, 100000}];
plot = ListLogPlot[listh, PlotTheme -> "Detailed", LabelStyle -> Black, 
  FrameStyle -> {Black, 10}, PlotRange -> All, 
  FrameTicks -> {{Automatic, None}, {ticksfn, None}}]

enter image description here

More complete with the sub-ticks, but possibly version specific (here for v10.1):

ticksfn =
  Map[Replace[{v_, n_} :> {v, ScientificForm[N@v, NumberPoint -> ""]}]]@*
    Charting`FindTicks[# &, # &];

enter image description here

$\endgroup$
0
$\begingroup$

Try this:

[`rp = 2*10^3;
ro = 1.88*10^8;
h[p_] := p (rp/ro)^2;
listh = Table[{p, h[p]}, {p, 1, 100000}];
ListLogPlot[listh, PlotTheme -> "Detailed", LabelStyle -> Black, 
 FrameStyle -> {Black, 10}, PlotRange -> All, 
 FrameTicks -> {{Automatic, 
    None}, {{{20000, 
      Style["2×\!\(\*SuperscriptBox[\(10\), \(4\)]\)", 12, 
       Black]}, {40000, 
      Style["4×\!\(\*SuperscriptBox[\(10\), \(4\)]\)", 12, 
       Black]}, {60000, 
      Style["6×\!\(\*SuperscriptBox[\(10\), \(4\)]\)", 12, 
       Black]}, {80000, 
      Style["8×\!\(\*SuperscriptBox[\(10\), \(4\)]\)", 12, 
       Black]}}, None}}]`]

enter image description here

Have fun!

$\endgroup$
1
  • $\begingroup$ Thank you very much. $\endgroup$
    – Haliki
    Commented Feb 12, 2020 at 7:57

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.