I have plotted some logarithmic curves using LogLogPlot.

In this case, I wanted to add two vertical lines to the plot; I used Epilog, but it seems that it does not work with LogLogPlot. Instead, I used GridLines. But now, the problem is that I cannot allocate two colors for my lines. Only the first color works.

Why is that?

 GridLines -> {{1, 8}, None}, 
 GridLinesStyle -> {{Directive[Black, Dashed]}, {Directive[Red}}

Here is an example: I want to add several vertical lines in different colors. enter image description here

  • $\begingroup$ Please create a minimal example and draw by hand (if necessary) the output that you are looking for. $\endgroup$
    – Syed
    Commented Feb 20 at 14:35
  • $\begingroup$ @Syed thanks. I edited that $\endgroup$
    – lia
    Commented Feb 20 at 14:44

1 Answer 1

LogLogPlot[{Log[x]^x, x^x}, {x, 0.1, 10}, PlotLabels -> "Expressions",
  GridLines -> {{{1, 
     Directive@{AbsoluteThickness[2], Green, Dashed}}, {8, 
     Directive@{Opacity[1], AbsoluteThickness[2], Red, Dashed}}}, None}

enter image description here


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.