Plot

The plot module aims to provide a consistent interface to various plotting backends. At this point matplotlib and vtk are supported.

class nutils.plot.BasePlot(name, ndigits=0, index=None)[source]

base class for plotting objects

class nutils.plot.PyPlot(name, imgtype=None, ndigits=3, index=None, **kwargs)[source]

matplotlib figure

save(name)[source]

save images

mesh(points, colors=None, edgecolors='k', edgewidth=None, triangulate='delaunay', setxylim=True, **kwargs)[source]

plot elemtwise mesh

polycol(verts, facecolors='none', **kwargs)[source]

add polycollection

slope_triangle(x, y, fillcolor='0.9', edgecolor='k', xoffset=0, yoffset=0.1, slopefmt='{0:.1f}')[source]

Draw slope triangle for supplied y(x) - x, y: coordinates - xoffset, yoffset: distance graph & triangle (points) - fillcolor, edgecolor: triangle style - slopefmt: format string for slope number

slope_trend(x, y, lt='k-', xoffset=0.1, slopefmt='{0:.1f}')[source]

Draw slope triangle for supplied y(x) - x, y: coordinates - slopefmt: format string for slope number

rectangle(x0, w, h, fc='none', ec='none', **kwargs)[source]
griddata(xlim, ylim, data)[source]

plot griddata

cspy(A, **kwargs)[source]

Like pyplot.spy, but coloring acc to 10^log of absolute values, where [0, inf, nan] show up in blue.

class nutils.plot.DataFile(name, index=None, ndigits=0, mode='w')[source]

data file

class nutils.plot.VTKFile(name, index=None, ndigits=0, ascii=False)[source]

vtk file

unstructuredgrid(points, npars=None)[source]

add unstructured grid

celldataarray(name, data)[source]

add cell array

pointdataarray(name, data)[source]

add cell array

nutils.plot.writevtu(name, topo, coords, pointdata={}, celldata={}, ascii=False, superelements=False, maxrefine=3, ndigits=0, ischeme='gauss1', **kwargs)[source]

write vtu from coords function

class nutils.plot.Pylab(title, name='graph{0:03x}')[source]

matplotlib figure

class nutils.plot.PylabAxis(ax, title)[source]

matplotlib axis augmented with nutils-specific functions

add_mesh(coords, topology, deform=0, color=None, edgecolors='none', linewidth=1, xmargin=0, ymargin=0, aspect='equal', cbar='vertical', title=None, ischeme='gauss2', cscheme='contour3', clim=None, frame=True, colormap=None)[source]

plot mesh

add_quiver(coords, topology, quiver, sample='uniform3', scale=None)[source]

quiver builder

add_graph(xfun, yfun, topology, sample='contour10', logx=False, logy=False, **kwargs)[source]

plot graph of function on 1d topology

add_convplot(x, y, drop=0.8, shift=1.1, slope=True, **kwargs)[source]

Convergence plot including slope triangle (below graph) for supplied y(x), drop = distance graph & triangle, shift = distance triangle & text.

nutils.plot.preview(coords, topology, cscheme='contour8')[source]

preview function