This example shows the use of two plot items, one to plot a red line and the second to plot blue squares.
>>> from pyclaw.data import ClawPlotData >>> from pyclaw.plotting import plotframe>>> plotdata = ClawPlotData() >>> plotdata.outdir = 'example-acoustics-1d'>>> # Figure: >>> plotfigure = plotdata.new_plotfigure(name='Solution', figno=1) >>> plotfigure.kwargs = {'figsize':[5,3]}>>> # Axes: >>> plotaxes = plotfigure.new_plotaxes(name='Pressure')>>> plotitem = plotaxes.new_plotitem(name='Pressure line', plot_type='1d') >>> plotitem.plot_var = 0 # q[0] is the pressure >>> plotitem.plotstyle = '-' >>> plotitem.color = '#ff0000' # could use 'r' or 'red' or '[1,0,0]'>>> plotitem = plotaxes.new_plotitem(name='Pressure points', plot_type='1d') >>> plotitem.plot_var = 0 # q[0] is the pressure >>> plotitem.plotstyle = 's' # squares >>> plotitem.color = 'b'>>> # plot one frame: >>> plotdata.plotframe(4)
(Source code)