2
$\begingroup$

I'm trying to put an arrow to denote a point on a Plot

ListPlot[{Transpose[{temp1, lum1}], Transpose[{temp2, lum2}], 
  Transpose[{temp3, lum3}], Transpose[{temp4, lum4}]}, 
 PlotStyle -> {Hue[First@#2/12], Hue[First@#2/15], Hue[First@#2/18], 
   Hue[First@#2/21]}, 
 Epilog -> {Arrow[{{4.2, 3.6}, {4.4, 3.6}}], 
   Text["text", {4.4, 3.6}, {4.4, 4}]}, 
 ScalingFunctions -> {"Reverse", Identity}, PlotRange -> Full, 
 PlotTheme -> "Detailed", 
 FrameTicksStyle -> Directive[FontSize -> 22], 
 PlotStyle -> {Automatic, Green}, AxesLabel -> Automatic, 
 Frame -> True, 
 FrameLabel -> {Style["Temperatura Log T [K]", FontSize -> 22, Bold], 
   Style["Luminosidad Log L [\!\(\*SubscriptBox[\(L\), \(sol\)]\)]", 
    FontSize -> 22, Bold]}, ImageSize -> Large]

but Epilog seems to not be working properly. The output is

enter image description here

while I'd expect to see an arrow pointing to the yellow point at (4.4,3.6)

$\endgroup$
6
  • 2
    $\begingroup$ does Epilog -> {Arrow[{{-4.2, 3.6}, {-4.4, 3.6}}], Text["text", {-4.4, 3.6}]} give what you need? $\endgroup$
    – kglr
    Oct 12, 2020 at 3:02
  • $\begingroup$ Previous question scaling functions not compatible with epilog in listplot may be relevant $\endgroup$
    – LouisB
    Oct 12, 2020 at 3:09
  • $\begingroup$ Actually @kglr advise did part of the job. Now the arrow is visible but not the text. $\endgroup$
    – nuwe
    Oct 12, 2020 at 3:10
  • $\begingroup$ make sure you use Text["text", {-4.4, 3.6}] not Text["text", {-4.4, 3.6}, {-4.4,4}] or Text["text", {-4.4, 3.6}, {4.4,4}] $\endgroup$
    – kglr
    Oct 12, 2020 at 3:38
  • 1
    $\begingroup$ Text[Style["ZAMS", FontSize -> Scaled[.05]], Offset[{5, 2}, {-4.4, 3.6}], {Left, Bottom}]? $\endgroup$
    – kglr
    Oct 12, 2020 at 5:32

1 Answer 1

2
$\begingroup$
SeedRandom[1]
data = RandomReal[{3.5, 4.4}, {100, 2}];

ListPlot[data, Frame -> True, 
 ScalingFunctions -> {"Reverse", Identity},
 PlotRangeClipping -> False, 
 Epilog -> {Arrow[{{-4.2, 3.6}, {-4.4, 3.6}}], 
   Text[Style["text", FontSize -> Scaled[.05]], {-4.4, 3.6}, {Left, Bottom}]}]

enter image description here

Text[Style["text", FontSize -> Scaled[.05]], {-4.4, 3.6}, {-1, -1}] gives the same picture.

You can also use Offset[{xprinterpoints, yprinterpoints}, {xpos,ypos}] in the second argument of Text to specify the position. Using

  Text[Style["text", FontSize -> Scaled[.05]], Offset[{15, 5}, {-4.4, 3.6}], {-1, - 1}]

above, we get

enter image description here

Using

Text[Style["text", FontSize -> Scaled[.05]], Offset[{15, -5}, {-4.4, 3.6}], {-1, 1}]

gives

enter image description here

and

Text[Style["text", FontSize -> Scaled[.05]], Offset[{-25, 0}, {-4.4, 3.6}], {-1, -1}]

gives

enter image description here

$\endgroup$

Your Answer

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

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