Hello, So maybe a couple of images can help. Using the code
#!/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)
# 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,Y = meshgrid(x, y)
Z = func4(X, Y)
print "Z is, ", Z
ax = subplot(111)
im = imshow(Z, cmap=cm.jet)
#im.set_interpolation('nearest')
#im.set_interpolation('bicubic')
im.set_interpolation('bilinear')
#ax.set_image_extent(-3, 3, -3, 3)
show()
I can get the attached image.png, but what I am really after is
image2.png (the same quantity plotted on a circular domain!). How can
I achieve that (without using scissors on an existing image?).
This is what I meant from start.
Cheers
Lorenzo
2009/4/3 Jae-Joon Lee <[email protected]>:
> I'm afraid that I'm still confused and there seems to be not much
> thing I can help..
>
> You're considering a circle, but you already have your function in a
> cartesian coordinate. I'm not sure why you can't just plot in a
> cartesian coordinate? (in other words, what is wrong with your
> original script?)
>
> There is an "set_image_extent" call in your original script (although
> commented out). Maybe what you're trying to do is simply
>
> im = imshow(Z, cmap=cm.jet, extent=(-3, 3, -3, 3))
>
> I'm not sure it would be relevant, but if you have your function or
> data in (r, theta) coordinate, one simple way is just to use the
> polar axes with pcolormesh method.
>
> n_theta, n_r = 100, 50
> theta = np.linspace(0, 2*np.pi, n_theta+1)
> r = np.linspace(0., 1., n_r + 1)
> data = np.arange(0., n_theta*n_r).reshape(n_r, n_theta)
> ax=subplot(1,1,1, projection="polar", aspect=1.)
> ax.pcolormesh(theta, r, data)
>
>
>
> -JJ
>
--
Life is what happens to you while you're busy making other plans.
<<attachment: image.png>>
<<attachment: image2.png>>
------------------------------------------------------------------------------
_______________________________________________ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
