FluidMotion » NaibsPages » News » Matplotlib for Sourceforge

Matplotlib for Sourceforge

18 May 2009 09:30

Matplotlib is a great python toolkit for plotting data

matplotlib-leaf

 

#!/usr/bin/env python #-*- coding: utf-8 -*-

import matplotlib
import numpy as np
from matplotlib.pyplot import figure, show, grid

width, height = matplotlib.rcParams['figure.figsize']
size = min(width, height)
fig = figure(figsize=(size, size))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')

theta = np.arange(0, 2*np.pi, np.pi/10000)
r = (1 + 0.9*np.cos(8*theta))*(1 + 0.1*np.cos(24*theta))*(0.9+0.05*np.cos(200*theta))*(1+np.sin(theta))

ax.plot(theta, r, color='#005f00', lw=2)
ax.set_rmax(4)
grid(True)

ax.set_title("Peace", fontsize=20)
show()
# vim: set et sts=4 sw=4 ts=4 tw=80:

Rating 4.7 (3 votes)