2
$\begingroup$

How do I add a vertical thick line to my ListLogLogPlot? I tried with the following code (a minimal non working example), but I get an error (the plot becomes pink)

 tab=Table[{j,j^2},{j,1,1000,10}]
 tab1=Table[{j,j^1/2},{j,1,1000,10}]
 ListLogLogPlot[{tab1, tab}, GridLines -> {{790,Thick}, {1}}]

I also tried with Epilog as written in this question: it gives no error, but it doesn't plot any vetical line.

I use Mathematica 10

$\endgroup$
  • 2
    $\begingroup$ Plot[Sin[x], {x, 0, 10}, Epilog -> {Thickness[0.03], InfiniteLine[{3, 0}, {0, 1}]}] $\endgroup$ – Szabolcs Jul 13 '18 at 11:15
5
$\begingroup$

An easy solution is to add the option GridLinesStyle

ListLogLogPlot[{tab1, tab}, GridLines -> {{ 790 }, {1}}, 
GridLinesStyle -> { Thick, None} ]

enter image description here

| improve this answer | |
$\endgroup$
6
$\begingroup$

For the first one, you're missing a pair of brackets. The format is {xlist, ylist} where xlist is in the form {{x1, style}, {x2, style}...}. A lot of brackets, admittedly.

tab = Table[{j, j^2}, {j, 1, 1000, 10}];
tab1 = Table[{j, j^1/2}, {j, 1, 1000, 10}];
ListLogLogPlot[{tab1, tab}, GridLines -> {
   {{790, Thick}},
   {}
   }]

Mathematica graphics

For the Epilog attempt, I'm guessing that you probably did not take the logarithm of the x value. It should be done like this:

ListLogLogPlot[{tab1, tab}, Epilog -> {
   Thick,
   InfiniteLine[{{Log@700, 0}, {Log@700, 1}}]
   }]

Mathematica graphics

The labels are placed on a logarithmic scale, but the underlying coordinate system is still linear. That is why we have to take the logarithm of our coordinates to get the expected result when using ListLogLogPlot.

| improve this answer | |
$\endgroup$

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.