Feel free to 'save and run', pass along, or ignore.
This was my valentine's day present today.
I hope the bandwidth amuses more than it annoys...

Jules

#----------------------------------
# hohumheart.py

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon

# force square figure and square axes looks better for polar, IMO
width, height = mpl.rcParams['figure.figsize']
size = min(width, height)
# make a square figure
fig = plt.figure(figsize=(size, size))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#ffffff')

ax.set_rmax(2.0)
ax.set_xticks([])
ax.set_yticks([])
plt.grid(False)

theta = np.linspace(0,1,100)*np.pi*2
r = 1*(1-np.cos(theta))

ncards = 5
step = 2*np.pi/ncards
for ii in range(ncards):
        tr = np.column_stack((theta+ii*step, r))
        cpatch = Polygon(tr)
        cpatch.set_facecolor('r')
        cpatch.set_edgecolor('k')
        cpatch.set_alpha(0.5)
        ax.add_patch(cpatch)

ax.set_title("I $\heartsuit$ you", fontsize=20)
plt.show()

#-----------------------

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to