Plotting with matplotlib looks blocky in notebook

Issue #765 resolved
Chris Richardson created an issue

At the moment, the behaviour of plot is like this:

mesh = UnitSquareMesh(4,4)
Q = FunctionSpace(mesh, "CG", 1)
F = Function(Q)
F.interpolate(Expression("cos(x[0])*sin(x[1])", degree=1))
plot(F)

plot0.png

or

plot(F, shading='gouraud')

plot1.png

or

plot(F, mode='contour')

plot2.png

I suggest changing the default to use plt.tricontourf(), with, say, 40 contour levels, to get:

plot3.png

Comments (10)

  1. Prof Garth Wells

    Agree, but let's target the 2016.2 release.

    Do we have an option for the number of levels?

  2. Jan Blechta

    I remind that me or Chris talked to matplotlib developer Jens Nielsen asking for linear shading of triangulations for, I think, tripcolor, which would be optimal for plotting P1 functions. But the result was not very helpful as I remember.

  3. Log in to comment