Example of one figure with two axesΒΆ

For a more detailed example, see:

A simple example:

>>> from pyclaw.data import ClawPlotData
>>> from pyclaw.plotting import plotframe
>>> plotdata = ClawPlotData()
>>> plotdata.outdir = 'example-acoustics-1d'
>>> plotfigure = plotdata.new_plotfigure(name='Solution', figno=1)
>>> plotfigure.kwargs = {'figsize':[11,3]}
>>> # Pressure:
>>> plotaxes = plotfigure.new_plotaxes(name='Pressure')
>>> plotaxes.axescmd = 'subplot(1,2,1)'
>>> plotitem = plotaxes.new_plotitem(name='Pressure',plot_type='1d')
>>> plotitem.plot_var = 0       # q[0] is the pressure
>>> plotitem.plotstyle = 'o-'
>>> plotitem.color = 'b'
>>> # Velocity:
>>> plotaxes = plotfigure.new_plotaxes(name='Velocity')
>>> plotaxes.axescmd = 'subplot(1,2,2)'
>>> plotitem = plotaxes.new_plotitem(name='Velocity',plot_type='1d')
>>> plotitem.plot_var = 1       # q[1] is the velocity
>>> plotitem.plotstyle = '+-'
>>> plotitem.color = 'r'
>>> # plot one frame:
>>> plotdata.plotframe(4)
(Source code)

Output

_images/1-plotexamples_multiaxes.png

(PNG, PDF)

Previous topic

Example of a single figure with two items

Next topic

Sample figure

This Page