When I add a Line or a point to a ListLogPlot
using for example Show[plot,Graphics[Line[{{0,0.1},{100,0.1}}]
it does not appear where I put it but instead -Exp[#]&
gets applied to the y coordinates. So in this case the line appears around 0.905. How do I add graphics at the actual points I want to add them?
1 Answer
plot = ListLogPlot[Table[PartitionsQ[n], {n, 50}],
Joined -> True];
On a log plot the y coordinate cannot be zero. Whatever y value is intended, you need to take its log. For either vertical or horizontal lines, InfiniteLine
(introduced in version 10) is the easiest way to span the full plot.
Show[plot,
Graphics[{Red, InfiniteLine[{{1, Log[20]}, {10, Log[20]}}],
Green, InfiniteLine[{{30, 1}, {30, 10}}]}]]
-
$\begingroup$ I already edited the question to point out that 0.1 would be a better example I can also edit it in the main text if preferred. Note that the point stands for any number greater than 0. It is in my opinion a crazy choice of MMA to implement things this way and I would like a real work around, rather than applying Log to everything I might ever add to a plot. Note that if for example I want to add points at coordinates I picked (using
.
) I would have to first apply Log to them. That would be a major inconvenience. $\endgroup$– KvotheMar 4, 2021 at 13:49 -
$\begingroup$ To add points use
Point[{#[[1]], Log[#[[2]]]} & /@ points]
$\endgroup$ Mar 4, 2021 at 14:47
GridLines->{{}, {.1}}
$\endgroup$