1
$\begingroup$

Using the code below

yMin = 10^-11;
yMax = 1;
Show[
 LogPlot[
  Null, {i, 1, 200},
  Frame -> True,
  AspectRatio -> 1,
  PlotRange -> {{0, 200}, {yMin, yMax}},
  ImageSize -> Small
  ],
 Graphics[
  Text[Row[{"yMin=", yMin // N, "  yMax=", yMax // N}], 
   Scaled[{0.5, 0.5}]]]
 ]

I generated a series of plots with different values of yMax:

series of LogPlots

My Problem: I cannot get Mathematica to place a label at position yMax and one at position yMin. Mathematica places a label in only one of the two positions and leaves the other one orphan. Which corner gets the label shifts as yMax changes. I don't want to write my own tick marks manually. I want the y-Axis to be labelled as the x-Axis, with labels at the two ends.

This is with Mathematica 12.1.1 on Mac OS 10.15.6

$\endgroup$

1 Answer 1

1
$\begingroup$

You don't show the code that you used for the labels at yMin and yMax. You probably just need to include the options PlotRangeClipping and ImagePadding.

Clear["Global`*"]

Manipulate[
 LogPlot[Null, {i, 1, 200},
  Frame -> True,
  AspectRatio -> 1,
  PlotRange -> {{0, 200}, {yMin, yMax}},
  ImageSize -> Small,
  Epilog -> {Text[Row[{"yMin=", yMin // N, "  yMax=", yMax // N}],
     Scaled[{0.5, 0.5}]],
    Text["label at yMin", Scaled[{0.5, 0.0}]],
    Text["label at yMax", Scaled[{0.5, 1.0}]]},
  PlotRangeClipping -> False,
  ImagePadding -> {{Automatic, Automatic}, {Automatic, 10}}],
 {{yMin, 1.*^-11}, 1.*10^Range[-11, -6]},
 {{yMax, 100}, 10^Range[0, 6]}]

enter image description here

$\endgroup$
2
  • $\begingroup$ You could also use ... Text["label at yMin", {100, Log[yMin]}], Text["label at yMax", {100, Log[yMax]}], ... instead of the Scaled coordinates. $\endgroup$
    – Bob Hanlon
    Commented Sep 6, 2020 at 5:14
  • $\begingroup$ Maybe I need to explain my question better: As you see in your graph, you specified yMax100 but the highest tick label on the graph is 10. I want the number "100" printed as a tick label at the upper left corner just as 10^-11 is printed at the bottom left. $\endgroup$
    – Themis
    Commented Sep 6, 2020 at 11:15

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.