7
$\begingroup$

This question already has an answer here:

I am making ListLogLog plots with polygons in the Prolog and lines in the Epilog, and I want to know how to make sure that the polygons and lines are being plotted consistently. One method that I know gives me lines with the right shape is to have

ListLogLogPlot[
 PlotRange -> {{.01, 10}, {10^-10, 10^-5}},
 AspectRatio -> 1,
 FrameTicks -> {
   {
    Automatic
    ,
    Automatic},
   {Automatic
    ,
    Automatic}},
 Prolog -> {
   Style[Polygon[Log[PLSND]], Lighter[Gray, .45], Opacity[1]]
   },
 Epilog -> {Style[Polygon[Log[10^Data]]]}]

PLSND is a list of points given in (x,y), while Data is a list of points given in (Log10[x], Log10[y]).

My concern is that the PLSND and Data lines/polygons will be plotted with incorrect scaling relative to any other lists I give in the standard format. I have tried using Log10 instead of Log, or Log[Exp[Data]], but neither of these substitutions displays a line on my graph.

$\endgroup$

marked as duplicate by Kuba May 23 '17 at 10:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Keep in mind that when you post a minimal working example it will be easier for others to provide a solution. E.g. why do we have to make up PLSND and DATA? $\endgroup$ – Kuba Dec 22 '15 at 8:04
11
$\begingroup$
data = Table[PartitionsQ[n], {n, 50}];
epilog = {EdgeForm@Thick, FaceForm@None, Rectangle[{20, 500}, {40, 2000}]};

ListPlot[data, Epilog -> epilog]

ListLogPlot[data, 
 Epilog -> (epilog /. {x_, y_?NumericQ} :> {x, Log[y]})]

ListLogLogPlot[data, 
 Epilog -> (epilog /. {x_, y_?NumericQ} :> Log@{x, y})]

enter image description here

Closely related topics:

$\endgroup$
  • $\begingroup$ Thank you, this confirms that the polygons scale properly, but why is it that just applying Log to the particular coordinates rather than Log10 gives the correct result? $\endgroup$ – Jordan Dec 22 '15 at 8:09
  • $\begingroup$ @Jordan Log is a natural logarithm, it is used for those plots. $\endgroup$ – Kuba Dec 22 '15 at 8:10
  • $\begingroup$ Why not NumericQ instead of NumberQ? $\endgroup$ – kirma Dec 22 '15 at 8:37
  • $\begingroup$ @kirma without any specific reason, will replace it to make it more general. $\endgroup$ – Kuba Dec 22 '15 at 8:39

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