change strength of antialiasing in matplotlib

Question:

Is it possible to increase the antialiasing in matplotlib?
I can still see some aliasing in my data, I tried several backends and it is still there. The antialiasing flag of the lines is set.

Here you can see what I mean

enter image description here

It’s a sample taken from a Screenshot. It’s probably not the best example but I guess one can see the stairs in the line. It was taken with the wxagg backend.

I’m using matplotlib version 1.01 with Windows 7.

Update:
I don’t have the code which produced the previous picture anymore, but I still have the problem. Below is a simple code example which shows the aliasing.

import numpy as np
import matplotlib
matplotlib.use('wxAgg')
import matplotlib.pyplot as pl
print 'Backend:', pl.get_backend()

x = np.linspace(0,6,100)
y = np.sin(x)

for a in range(10):
    pl.plot( x, a/10.*x, linewidth=1)

pl.show()

It print’s Backend: WXAgg
And the resulting plot looks like the following.
aliasing

Especially the lower red curve shows clear aliasing.

Asked By: P3trus

||

Answers:

The picture you added to your question is already perfectly anti-aliased. It doesn’t get any better than this. Have a look at a zoomed version of the image:

Upscaled version of the image in question

Answered By: Simon

If you save the picture as a .svg file, you will have infinite precision. You can then edit this .svg with something like InkScape, and get how much precision/antialiasing as you like.

Answered By: François Landes
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.