···
2014-02-15 0:13 GMT+02:00 Benjamin Root <ben.root@…1304…>:
I rolled a 20 today for necromancer, so I am going to do a thread resurrection. Given recent improvements in matplotlib, we should definitely make this web-enabled. That way, we can share our nerdiness with our non-nerdy significant others.
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Happy Valentine’s day!
Ben
On Mon, Feb 14, 2011 at 8:25 PM, Paul Ivanov <pivanov314@…287…> wrote:
jules hummon, on 2011-02-14 07:23, wrote:
Feel free to ‘save and run’, pass along, or ignore.
This was my valentine’s day present today.
Thank you for sharing! I took the liberty of livening it up for
my sweetheart.
#---------------------------------------------------
hohumheartbeat.py - a more lively 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’)
ax2 = fig.add_axes([0.45, .9, 0.1, 0.1], polar=True, axisbg=‘#ffffff’)
ax.set_rmax(2.0)
ax2.set_rmax(4.0)
ax2.spines[‘polar’].set_visible(False)
ax2.patch.set_alpha(.3)
for a in ax,ax2:
a.set_xticks()
a.set_yticks()
ax.grid(False)
theta = np.linspace(0,1,100)np.pi2
r = 1*(1-np.cos(theta))
ncards = 5
step = 2*np.pi/ncards
pdict = dict(fc=‘r’,ec=‘k’, alpha=.5)
for ii in range(ncards):
tr = np.column_stack((theta+ii*step, r))
ax.add_patch(Polygon(tr, **pdict))
from WolframMath “Heart Curve”
r2 = 2 - 2*np.sin(theta)
r2 += np.sin(theta) * np.sqrt(np.abs(np.cos(theta))) / (np.sin(theta)+1.4)
tr2 = np.column_stack((theta, r2))
ax2.add_patch(Polygon(tr2,**pdict)) # heart
kwargs = dict(transform=ax2.transAxes, va=‘center’, fontsize=20)
ax2.text(0,.45,“I”,ha=‘right’,**kwargs)
ax2.text(1,.4,“you”,ha=‘left’,**kwargs)
beat = np.tan(np.linspace(0, np.pi*2, 100))
beat[0:20] = beat[60:80]
beat[-20:] = beat[20:40]
beat -= beat.min()
beat /= beat.max()
i=0; beatlen = len(beat)-1;
def heartbeat(e):
global i;
i = (i+1) % (beatlen)
y = beat[i]
ax2.set_rmax(y*4. + 4.)
ax2.draw(ax.figure.canvas.get_renderer())
ax2.figure.canvas.blit(ax2.bbox)
#plt.draw() #use if the last two lines cause trouble
even your mouse movements make my heart skip a bit!
cid = ax.figure.canvas.mpl_connect(‘idle_event’, heartbeat)
print “ax.figure.canvas.mpl_disconnect(%d)” %cid
print “#run the line above to ‘flatline’ (stop heartbeat)”
plt.show()
best,
–
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk1Z1gcACgkQe+cmRQ8+KPccQACgiCFswsMAqJObseb8yn2dHLR3
UuwAn0xb2MeaQJffHt70/u8T1j6lmuCJ
=0hq/
-----END PGP SIGNATURE-----
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