Re: [Matplotlib-users] custom symbols for scatter

2009-04-27 Thread Ryan May
On Mon, Apr 27, 2009 at 7:50 AM, Juan Fiol fi...@yahoo.com wrote:

 Hi, I am trying to put a sphere (rather than circles or disks) as markers
 for a
 plot. I am a newbiew so I tried the poor man approach: I plotted several
 circles
 one over the other for each point to mimic a sphere (looking it from very
 far).
 It kind of worked, except that all are not exactly the same and they
 distort
 when I change the aspect ratio of the plot. I am attaching two figures
 to show what I mean.
 I looked around in the mailing list and searched all over the web but did
 not
 find nothing mentioned. Any help is appreciated.


Can you post a self-contained version of your code so that we can see
exactly how you make the spheres?  You can just use random/hardcoded numbers
for the data in the plot.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
--
Crystal Reports #45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] custom symbols for scatter

2009-04-27 Thread Juan Fiol

Hi, thanks Ryan for the interest. Here is a short script to produce the data. 
The method also breaks if I change too much the radius of the sphere or the 
size at which they are plotted.

I am using:
Python 2.5.4
Matplotlib 0.98.5.2

Regards,
Code follows:
###
#!/usr/bin/env python
from matplotlib import pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
NN=9

xmin=0.1
xmax=3.5
x= np.arange(xmin,xmax,.10)
y=np.square(np.sin(x))

# Creamos la figura  
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_yscale('log')

# Sphere radius (also radius and centers for all inner circles)
radio=.1
rads= radio*(1. - np.arange(0,NN)/(1.*NN))
dl= np.array([(radio-r) for r in rads])*radio

ylimits=(0.01,1.2)


for x1,y1 in zip(x,y):
  ax.scatter(x1*(1+dl),y1+(y1*dl), cmap=plt.cm.Blues, c=rads,s=2500*rads, 
edgecolors='none')

ax.set_xlim(xmin,xmax)
ax.set_ylim(ylimits)

plt.show()
###


--- On Mon, 4/27/09, Ryan May rma...@gmail.com wrote:

 From: Ryan May rma...@gmail.com
 Subject: Re: [Matplotlib-users] custom symbols for scatter
 To: fi...@yahoo.com
 Cc: matplotlib-users@lists.sourceforge.net
 Date: Monday, April 27, 2009, 5:04 PM
 On Mon, Apr 27, 2009 at 7:50 AM, Juan Fiol
 fi...@yahoo.com wrote:
 
  Hi, I am trying to put a sphere (rather than circles
 or disks) as markers
  for a
  plot. I am a newbiew so I tried the poor man approach:
 I plotted several
  circles
  one over the other for each point to mimic a sphere
 (looking it from very
  far).
  It kind of worked, except that all are not exactly the
 same and they
  distort
  when I change the aspect ratio of the plot. I am
 attaching two figures
  to show what I mean.
  I looked around in the mailing list and searched all
 over the web but did
  not
  find nothing mentioned. Any help is appreciated.
 
 
 Can you post a self-contained version of your code so that
 we can see
 exactly how you make the spheres?  You can just use
 random/hardcoded numbers
 for the data in the plot.
 
 Ryan
 
 -- 
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma


  

--
Crystal Reports #45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] custom symbols for scatter

2009-04-27 Thread Jouni K . Seppänen
Juan Fiol fi...@yahoo.com writes:

 Hi, I am trying to put a sphere (rather than circles or disks) as
 markers for a plot.

One approach could be to make a PatchCollection of suitable patches -
see 

http://matplotlib.sourceforge.net/examples/api/patch_collection.html

for an example of PatchCollection, and

http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html

for a fairly complicated user-defined Patch. Matplotlib doesn't do any
gradient fills yet, so you're a little limited in drawing the sphere.

Another option is to make a bitmap drawing of a sphere in e.g. Gimp and
put multiple copies of it at various coordinates, but I don't think this
is well-supported currently.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Crystal Reports #45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] custom symbols for scatter

2009-04-27 Thread Juan Fiol

Thanks Jouni, my first try was to make a PNG in gimp and use imread/imshow but 
it did not work with Log scale.

I think that the best approach would be to create an object (may be a patch) 
with the sphere and put it in the plots but I do not know how to do it and will 
not have the time to investigate it for a couple of weeks.

Thanks, for your reply



  

--
Crystal Reports #45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users