Years ago I observed a similar behaviour with gnuplot. This behaviour appears if you use line join style 'miter' and if your data is very fine spaced with small noise. Then in the figure the noise appears much larger than it actually is. Limited output precision for representing the plot data in the different backends may also both increase or attenuate the observed noise. Best solution: use round line join style. I would propose to make this the default.
I attached a script that shows this behaviour, and some images, pdf with Acrobat Reader. Agg does not show this noise, unless you render the figure with high resolution (here 1000dpi), and even then the noise is smaller. Perhaps Agg does some optimization/rounding? Difficult to tell which backend shows the correct behaviour, which might be not the preferred one.
x = linspace(0,0.02, 1001) + random(1001)*1e-5
x[-1] = 1
y = ones_like(x)
y[:500:2] = 1 + random(250)*1e-4
plot(x,y, solid_joinstyle = 'miter')
plot(x,y+0.05, solid_joinstyle = 'round')
Michael Droettboom schrieb:
testnoise.py (258 Bytes)
Also -- for mtcoder:
Can you send us the script that generates your plot?
Also, if you set your backend to Cairo, and then generate the pdf, to you get the same result?
Michael Droettboom wrote:
There's something funny going on with line caps, maybe? It looks like the corners aren't getting capped in the same way as Agg does.
I've created screenshots of Jesse's pdf file in acrobat and evince.
Any thought, Jouni?
John Hunter wrote:
On Thu, Dec 11, 2008 at 11:16 PM, mtcoder <jberwald@...287...> wrote:
testode.rk45.a0.99.eps1e-07.pdf . This comes from a completely deterministic
ode. But is looks like I've added a tiny amount of noise.
On a technical note, I'm running Ubuntu 8.04, python2.5.1, matplotlib0.91.2
(with GTKAgg backend).
(Hopefully I didn't miss a similar question--and solution--elsewhere in the
My guess is that you may be seeing the antialiasing of your pdf
renderer. matplotlib has a pretty good antialiasing renderer for the
screen display (antigrain) but your mileage may vary for your pdf
renderer. Since pdf is a vector output, we have no control over the
renderering. What pdf viewer are you using? The best way for us to
see what you are seeing is to take a PNG screenshot of your PDF file
displayed in your viewer and then post the PNG. Ie, here is what I am
seeing in the Preview app: the fuzziness is from the antialiasing, but
I am used to seeing this.