# multiplot.py: Show how to make a mosaic of plots using subplot()
#               programmatically. The plots also illustrate the many
#               line styles and data tokens.

# Import modules
from numpy import *
from pylab import *

# Set up times, as an independent coordinate
t = arange(0.0, 3.0, 0.05)
# Our test function
s = sin(2*pi*t)

# Plotting options that we will step through, one by one
# Line/point styles: A list of character strings
styles = ('-', '--', ':', '.', 'o', '^', 'v', '<', '>', 's', '+')
# Colors: Also, a list of character strings
colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k')

# Create the mosaic of plots
#
axisNum = 0
for row in range(5):
    for col in range(4):
        axisNum += 1          # A little shorthand for: axisNum = axisNum + 1
        subplot(5,4,axisNum)  # A 5 x 4 mosaic, give each plot a distinct label
        style = styles[axisNum % len(styles) ] # Rotate through the styles
        color = colors[axisNum % len(colors) ] # Rotate through the colors
        plot(t,s, style + color)               # Plot!

# Uncomment line below to save this figure at 300 dots per inch resolution
#savefig('multiplot', dpi=300)

# Show the plot in a window
#
show()
