[yt-users] SphereCallback

Stephen Skory stephenskory at yahoo.com
Sat Sep 18 20:09:15 PDT 2010


Hi Brian,

>Hello everyone, could someone tell me how to plot a sphere in a color other than 
>
>black?  I've got this much working:
>p.modify['sphere']((x,y,z), radius, )
>to plot a sphere at x, y, z of radius radius, but I cannot seem to succeed in 
>changing the color.


It's not obvious how to do this. You need to make a dict with the properties of 
the circle you want, taken from here:

http://matplotlib.sourceforge.net/api/artist_api.html?highlight=circle#matplotlib.patches.Circle

(if broken above)
http://tinyurl.com/2vtbwqr

Here's example of a session where I made the attached image.

In [1]: pf = load("data0111")

In [2]: pc = PlotCollection(pf)
yt         INFO       2010-09-18 21:04:13,555 Getting the binary hierarchy
yt         INFO       2010-09-18 21:04:13,569 Finished with binary hierarchy 
reading
yt.lagos   INFO       2010-09-18 21:04:13,842 Max Value is 2.81423e-26 at 
0.5100097656250000 0.4914550781250000 0.5051269531250000 in grid EnzoGrid_0060 
at level 4 (8, 8, 10)
yt         INFO       2010-09-18 21:04:13,842 Created plot collection with 
default plot-center = [0.510009765625, 0.491455078125, 0.505126953125]

In [3]: pc.add_projection("Density", 0)
Out[3]: <yt.raven.PlotTypes.ProjectionPlot object at 0x5e6dad0>

In [4]: d = {'facecolor':'blue', 'edgecolor':'green', 'fill':True}

In [5]: pc.plots[-1].modify['sphere']([0.3,0.3,0.3], 0.1, circle_args=d)
Out[5]: 0

In [6]: pc.save()
yt         INFO       2010-09-18 21:04:40,063 Saved 
data0111_Projection_x_Density.png
Out[6]: ['data0111_Projection_x_Density.png']




 _______________________________________________________
sskory at physics.ucsd.edu           o__  Stephen Skory
http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student
________________________________(_)_\(_)_______________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data0111_Projection_x_Density.png
Type: application/octet-stream
Size: 174148 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20100918/41b3fded/attachment.obj>


More information about the yt-users mailing list