Not a major problem, but for some reason, Mathematica outputs unevaluated diagonal sections in what should be a step plot:
Plot[{PrimePi[x]}, {x, 0, 200}]
Incidentally, I am using v 8.0.1.0 on a Windows 32-bit OS.
Answer
For this kind of plot DiscretePlot
is probably the best choice:
DiscretePlot[PrimePi[x], {x, 0, 200}, Filling -> None]
If you want to have perfect vertical lines joining the steps, ListPlot
would be a good alternative:
t1 = Table[{x, PrimePi[x]}, {x, 0, 200}];
t2 = Table[{x + 1, PrimePi[x]}, {x, 0, 200}];
ListPlot[Riffle[t1, t2], Joined -> True]
Comments
Post a Comment