Dear All,
Please consider the snippet at the end of the email.
Admittedly, I am still quite cumbersome with the matplotlib pipeline
(I am a bit unsure about how to manipulate objects and their
properties).
The snippet below produces two plots. I have some questions
(1) for both plots: how do I add some text to the plot(possibly in
latex) in a specified position and fine-tune its properties (size,
bold etc...)?
(2) Last generated plot: I would like to have arrows like in the
previous plot, just rotated by 90 degrees so that they hit the red
areas at the north and south poles. However, this does not look
possible right now without shortening the arrows (there is not enough
vertical space; somehow the whole aspect ratio of the plot+boundary is
not 1). Any suggestions about how to fix this?

Many thanks


Lorenzo


####################################################################################33

 #!/usr/bin/env python
"""
See pcolor_demo2 for a much faster way of generating pcolor plots
"""
from __future__ import division
from pylab import *

def func3(x,y):
  return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)


def func4(x,y):
  theta=arcsin(y)
  return cos(theta)

def func5(x,y):

  return abs(sin(y))

def func6(x,y):

  return abs(cos(y))


# make these smaller to increase the resolution
dx, dy = 0.05, 0.05

# x = arange(-1.0, 1.0, dx)
# y = arange(-1.0, 1.0, dy)

x = arange(-pi/2., pi/2., dx)
y = arange(-pi/2., pi/2., dy)


X,Y = meshgrid(x, y)

Z = func6(X, Y)

# print "Z is, ", Z


ini=pi/2.+0.5

ax = subplot(111)
ax.axis('off')



im = imshow(Z,cmap=cm.jet, extent=(-pi/2., pi/2., -pi/2., pi/2.))
im.set_interpolation('bilinear')

im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData))

annotate("", xy=(-pi/2., 0), xytext=(-ini, 0), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., .2), xytext=(-ini, .2), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.2), xytext=(-ini, -.2), arrowprops=dict(fc="g"))

annotate("", xy=(-pi/2., .4), xytext=(-ini, .4), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.4), xytext=(-ini, -.4), arrowprops=dict(fc="g"))


annotate("", xy=(-pi/2., .6), xytext=(-ini, .6), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.6), xytext=(-ini, -.6), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., .8), xytext=(-ini, .8), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -.8), xytext=(-ini, -.8), arrowprops=dict(fc="g"))


annotate("", xy=(-pi/2., 1), xytext=(-ini, 1), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -1), xytext=(-ini, -1), arrowprops=dict(fc="g"))

annotate("", xy=(-pi/2., 1.2), xytext=(-ini, 1.2), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -1.2), xytext=(-ini, -1.2), arrowprops=dict(fc="g"))

annotate("", xy=(-pi/2., 1.4), xytext=(-ini, 1.4), arrowprops=dict(fc="g"))
annotate("", xy=(-pi/2., -1.4), xytext=(-ini, -1.4), arrowprops=dict(fc="g"))



annotate("", xy=(pi/2., 0), xytext=(ini, 0), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., .2), xytext=(ini, .2), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.2), xytext=(ini, -.2), arrowprops=dict(fc="g"))

annotate("", xy=(pi/2., .4), xytext=(ini, .4), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.4), xytext=(ini, -.4), arrowprops=dict(fc="g"))


annotate("", xy=(pi/2., .6), xytext=(ini, .6), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.6), xytext=(ini, -.6), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., .8), xytext=(ini, .8), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -.8), xytext=(ini, -.8), arrowprops=dict(fc="g"))


annotate("", xy=(pi/2., 1), xytext=(ini, 1), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -1), xytext=(ini, -1), arrowprops=dict(fc="g"))

annotate("", xy=(pi/2., 1.2), xytext=(ini, 1.2), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -1.2), xytext=(ini, -1.2), arrowprops=dict(fc="g"))

annotate("", xy=(pi/2., 1.4), xytext=(ini, 1.4), arrowprops=dict(fc="g"))
annotate("", xy=(pi/2., -1.4), xytext=(ini, -1.4), arrowprops=dict(fc="g"))



savefig("first-plot.pdf")

clf()



Z = func5(X, Y)


ax = subplot(111,aspect='equal')
ax.axis('off')



im = imshow(Z,cmap=cm.jet, extent=(-pi/2., pi/2., -pi/2., pi/2.))
im.set_interpolation('bilinear')

im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData))

annotate("", xy=(pi/2., 0), xytext=(ini, 0), arrowprops=dict(fc="g"))

annotate("", xy=(0., -1.6), xytext=(ini, 0), arrowprops=dict(fc="g"))





savefig("second-plot.pdf")

clf()

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to