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.
Thanks, Brian
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#matpl...
(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@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________
Stephen,
This worked almost perfectly, except that the 'fill' feature seems to be broken. No matter how I set it, it always plots a filled in circle. Is there some way to get around this?
Thanks, Brian
On Sep 18, 2010, at 11:09 PM, Stephen Skory wrote:
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#matpl...
(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@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________ <data0111_Projection_x_Density.png>_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Brian,
This worked almost perfectly, except that the 'fill' feature seems to be broken. No matter how I set it, it always plots a filled in circle. Is there some way to get around this?
I am unable to reproduce this bug. The "fill" is being respected in my tests. Can you share the script that you've tried?
_______________________________________________________ sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________
Brian,
This rings a few bells for me -- which version of Matplotlib are you using?
python2.6 -c "import matplotlib; print matplotlib.__version__"
should get the info.
-Matt
On Wed, Sep 22, 2010 at 12:46 PM, Stephen Skory stephenskory@yahoo.com wrote:
Brian,
This worked almost perfectly, except that the 'fill' feature seems to be broken. No matter how I set it, it always plots a filled in circle. Is there some way to get around this?
I am unable to reproduce this bug. The "fill" is being respected in my tests. Can you share the script that you've tried?
_______________________________________________________ sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_(_)_______________
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Ahh, it worked out with fresh eyes. I had {'fill':'False'} rather than {'fill':False}.
Thanks for the help.
-Brian
On Sep 22, 2010, at 3:48 PM, Matthew Turk wrote:
Brian,
This rings a few bells for me -- which version of Matplotlib are you using?
python2.6 -c "import matplotlib; print matplotlib.__version__"
should get the info.
-Matt
On Wed, Sep 22, 2010 at 12:46 PM, Stephen Skory stephenskory@yahoo.com wrote:
Brian,
This worked almost perfectly, except that the 'fill' feature seems to be broken. No matter how I set it, it always plots a filled in circle. Is there some way to get around this?
I am unable to reproduce this bug. The "fill" is being respected in my tests. Can you share the script that you've tried?
sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_(_)_______________
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org