4

Hopefully this is a simple question. I'm trying to overlay some text on top of a LogLogPlot using Epilog and Text. However, I'm struggling with the coordinates that Text seems to be using for placement. For example:

LogLogPlot[x + Sin[2x], {x, 1, 1000},
  Epilog -> Style[Text["x+sin(2x)", {5, 5}], 14]]

places the label "x+sin(x)" at roughly {x,y}={150,150} on the plot's coordinate system, and not {5,5} as in the input. However, if I change the LogLogPlot to just Plot, the label will get placed at {5,5} (or wherever I specify). What's going on?

How it looks right now:

graph

C. E.
  • 70,533
  • 6
  • 140
  • 264
user1748343
  • 43
  • 1
  • 1
  • 4
  • 1
    You have to use Log on the coordinates, this works: LogLogPlot[x + Sin[2 x], {x, 1, 1000}, Epilog -> Style[Text["x+sin(2x)", {Log[5], Log[5]}], 14]] – C. E. Jul 31 '13 at 22:01
  • @Anon You just beat me. If you want, I'll delete my answer and let you answer. ? – Michael E2 Jul 31 '13 at 22:03
  • 1
    @MichaelE2 I only beat you to it because I was too lazy to create that image. Your answer deserved to get accepted :) – C. E. Aug 01 '13 at 06:53

1 Answers1

9

Apparently the Epilog is processed after the coordinate remapping. Log[{150., 150.}] ~ {5., 5.}. Try this if you want the label at {5, 5}:

LogLogPlot[x + Sin[2 x], {x, 1, 1000}, 
 Epilog -> Style[Text["x+sin(2x)", Log@{5, 5}], 14]]

Mathematica graphics

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • 1
    I love those four-character fixes! – Mr.Wizard Jul 31 '13 at 22:05
  • 1
    That works perfectly... interesting, though, that while the log scales are in base 10, you must supply the log base e of the coordinates. – user1748343 Jul 31 '13 at 22:06
  • @user1748343 If you want to see what's being used, select the graphics, and execute the menu item Cell > Show Expression. It'll be long. But search for CoordinatesToolOptions. You'll see the functions used. – Michael E2 Jul 31 '13 at 22:11
  • 2
    There's no need to search for it; just use Options[(*graphic*), CoordinatesToolOptions] – Mr.Wizard Jul 31 '13 at 22:25
  • slightly related: http://mathematica.stackexchange.com/questions/27109/how-to-draw-a-circle-in-a-graph-with-log-y-scale – Jonie Jul 31 '13 at 23:55