1
$\begingroup$

as the title says, I would like to find a way to keep the minor ticks after I change the unit/scale of an axis. For example:

a = 3.77551;
b = -3717;
p = p /. Solve[Log[p] == (a + b/t), p][[1]]
Plot[p, {t, 0, 1000}, Frame -> True, GridLines -> Automatic]

enter image description here

And modifying the ticks:

Plot[p, {t, 0, 1000}, Frame -> True,
 GridLines -> {{-273, -23, 227, 477, 727} + 273, {100, 75, 50, 25, 0}/
    100},
 FrameTicks -> {{Table[{i, ToString[ 100 i]}, {i, 0, 1, 1/4}], 
    Automatic},
   {Table[{i, ToString[ i - 273]}, {i, 0, 1000, 250}], Automatic}}]

enter image description here

I would like to find a way to include the minor ticks when I change the scale as well as possibly an easier way (shorter/more efficient) to realign the GridLines.

Thank you.

$\endgroup$
3
$\begingroup$

Rather than muddle through the syntax for creating your own tick marks, here's a method to do this using the undocumented function Charting`FindTicks which has been used here before. The way this function works is you feed it the original range your data goes over, and the new range you want the scaled values to range over. Then I use a helper function to strip the ticks of their labels,

ticksWithoutLabels[or_, vi_] := Select[
   Charting`FindTicks[or, vi][##],
   (Length@# > 2 &)] &

Plot[p,{t,0,1000},
    GridLines->{Range[-1000,1000,200]+273, Range[0,1,.2]},
    Frame->True,
    FrameTicks->{
        {Charting`FindTicks[{0,1},{0,1000}],
        ticksWithoutLabels[{0,1},{0,1000}]},
        {Charting`FindTicks[{0,1000},{0-273,1000-273}],
        ticksWithoutLabels[{0,1000},{0-273,1000-273}]}
}]

Mathematica graphics

You do still have to write the GridLines specifications using the original scale though.

$\endgroup$
1
  • $\begingroup$ Thank you very much, you've been a huge help. $\endgroup$ – Siggi Jan 12 '17 at 21:41

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.