
Dear Nathan: Thank you On Wed, Aug 1, 2018 at 11:00 AM <yt-users-request@python.org> wrote:
Send yt-users mailing list submissions to yt-users@python.org
To subscribe or unsubscribe via the World Wide Web, visit https://mail.python.org/mm3/mailman3/lists/yt-users.python.org/ or, via email, send a message with subject or body 'help' to yt-users-request@python.org
You can reach the person managing the list at yt-users-owner@python.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of yt-users digest..."
Today's Topics:
1. Re: Annotate sphere (Nathan Goldbaum)
----------------------------------------------------------------------
Date: Tue, 31 Jul 2018 15:26:44 -0500 From: Nathan Goldbaum <nathan12343@gmail.com> Subject: [yt-users] Re: Annotate sphere To: Discussion of the yt analysis package <yt-users@python.org> Message-ID: <CAJXewOmdDDEkDHYGxgLSvO7JSj5tkca1WeMRLpb0E= xueYxzGA@mail.gmail.com> Content-Type: multipart/alternative; boundary="000000000000c1fdcc0572516664"
--000000000000c1fdcc0572516664 Content-Type: text/plain; charset="UTF-8"
On Tue, Jul 31, 2018 at 3:03 PM, Sushilkumar <sushil.sush19us@gmail.com> wrote:
Dear yt:
Is there a way to annotate sphere to a plot? I used annotate_sphere but it plots an outline of a circle but I would like a "filled circle" to represent a star?
I have a python script (see below) to create a sphere, but not sure how to integrate it with yt
You can use the sphere callback as-is, you just need to pass in the necessary circle_args keyword argument to tell matplotlib to fill in the circle.
Take a look at this notebook: https://gist.github.com/ngoldbaum/c6e0a4ce4c399e2f5bace6033ced2146
circle_args should take any keyword arguments accepted by the matplotlib circle patch object:
https://matplotlib.org/api/_as_gen/matplotlib.patches.Circle.html
Hope that helps,
Nathan
Any suggestions Thank you in advance
#----------------------------------------------------------- ---------------
def create_sphere_coords(radius=10): """ function just returns a set of x,y,z coordinates for generating a sphere. """ r = radius pi = np.pi cos = np.cos sin = np.sin phi, theta = np.mgrid[0:pi:101j, 0:2 * pi:101j]
x = r * sin(phi) * cos(theta) y = r * sin(phi) * sin(theta) z = r * cos(phi)
return (x,y,z)
#----------------------------------------------------------- ---------------
--000000000000c1fdcc0572516664 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo= te">On Tue, Jul 31, 2018 at 3:03 PM, Sushilkumar <span dir=3D"ltr"><<a h= ref=3D"mailto:sushil.sush19us@gmail.com" target=3D"_blank">sushil.sush19us@= gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex"><div dir=3D"ltr"><div>Dear yt:</div><div><br></div><div>Is there= a way to annotate sphere to a plot? I used annotate_sphere but it plots an= outline of a circle but I would like a "filled circle" to repres= ent a star? <br></div><div><br></div><div>I have a python script (see below= ) to create a sphere, but not sure how to integrate it with yt<br></div></d= iv></blockquote><div><br></div><div>You can use the sphere callback as-is, = you just need to pass in the necessary circle_args keyword argument to tell= matplotlib to fill in the circle.</div><div><br></div><div>Take a look at = this notebook: <a href=3D" https://gist.github.com/ngoldbaum/c6e0a4ce4c399e2= f5bace6033ced2146 <https://gist.github.com/ngoldbaum/c6e0a4ce4c399e2=f5bace6033ced2146>"> https://gist.github.com/ngoldbaum/c6e0a4ce4c399e2f5bace6= 033ced2146 <https://gist.github.com/ngoldbaum/c6e0a4ce4c399e2f5bace6=033ced2146></a></div><div><br></div><div>circle_args should take any keyword= arguments accepted by the matplotlib circle patch object:</div><div><br></= div><div><a href=3D" https://matplotlib.org/api/_as_gen/matplotlib.patches.C= ircle.html <https://matplotlib.org/api/_as_gen/matplotlib.patches.C=ircle.html>"> https://matplotlib.org/api/_as_gen/matplotlib.patches.Circle.ht= ml</a></div><div><br></div><div>Hope that helps,</div><div><br></div><div>N= athan<br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef= t:1ex"><div dir=3D"ltr"><div></div><div><br></div><div>Any suggestions <br>= </div><div>Thank you in advance</div><div><br></div><div>#-----------------=
------------<wbr>------------------------------<wbr>---------------<br><br>= def create_sphere_coords(radius=3D<wbr>10):<br>=C2=A0=C2=A0=C2=A0 "&qu= ot;"<br>=C2=A0=C2=A0=C2=A0 function just returns a set of x,y,z coordi= nates for generating <br>=C2=A0=C2=A0=C2=A0 a sphere.<br>=C2=A0=C2=A0=C2=A0= """<br>=C2=A0=C2=A0=C2=A0 r =3D radius<br>=C2=A0=C2=A0=C2= =A0 pi =3D np.pi<br>=C2=A0=C2=A0=C2=A0 cos =3D np.cos<br>=C2=A0=C2=A0=C2=A0= sin =3D np.sin<br>=C2=A0=C2=A0=C2=A0 phi, theta =3D np.mgrid[0:pi:101j, 0:= 2 * pi:101j]<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 x =3D r * sin(phi= ) * cos(theta)<br>=C2=A0=C2=A0=C2=A0 y =3D r * sin(phi) * sin(theta)<br>=C2= =A0=C2=A0=C2=A0 z =3D r * cos(phi)<br><br>=C2=A0=C2=A0=C2=A0 return (x,y,z)=
<br><br>#-----------------------------<wbr>------------------------------<w= br>---------------<br></div></div></blockquote></div></div></div>
--000000000000c1fdcc0572516664--
------------------------------
Subject: Digest Footer
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
------------------------------
End of yt-users Digest, Vol 125, Issue 19 *****************************************
-- *SK2* *"**Claiming that something can move faster than light is a good conversation-stopper in physics. People edge away from you in cocktail parties; friends never return phone calls. You just don’t mess with Albert Einstein.**"*
participants (1)
-
Sushilkumar