[yt-users] text inside figure window?

Nathan Goldbaum nathan12343 at gmail.com
Wed Feb 19 11:48:19 PST 2014


I made it just now.

There may be a way to search notebooks on the yt hub - Matt would know
more about that.

We have a few notebooks in our documentation
(http://yt-project.org/docs/dev/cookbook/index.html#example-notebooks),
but we could always use more!  I might add this as an example...

-Nathan

On Wed, Feb 19, 2014 at 11:46 AM, Stephanie Tonnesen <stonnes at gmail.com> wrote:
> Super helpful, thanks!  I knew that it had to be something like that, but
> after a few random tries I figured I better just ask.  How did you find that
> notebook?  Did you make it just now?  Is there a way I can search notebooks?
>
> -Stephanie
>
>
> On Wed, Feb 19, 2014 at 2:43 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>>
>> Hi Stephanie,
>>
>> PhasePlot contains a matplotlib figure. Take a look at this notebook
>> for an example:
>>
>>
>> http://nbviewer.ipython.org/url/hub.yt-project.org/notebooks/0759b334549f44e991a0cf6158c7225d.ipynb
>>
>> Hope that's helpful,
>>
>> Nathan
>>
>> On Wed, Feb 19, 2014 at 11:30 AM, Stephanie Tonnesen <stonnes at gmail.com>
>> wrote:
>> > Hi users,
>> >
>> > I am still fiddling with PhasePlot, and would now like to be able to
>> > have
>> > some text inside the window.  I am *not* looking for a legend box or
>> > anything, just text.  If I were writing this on a plot in python I would
>> > just be looking to use p.text(x,y,'text').  I will paste the section of
>> > code
>> > writing the PhasePlot below.
>> >
>> > Thanks!
>> >
>> > Stephanie
>> >
>> > profile = Profile2D(tracerp25, x_field='zkpc', x_n=36, x_min=-6.,
>> >
>> > x_max=0.,x_log=False,y_field='BMagnitude',y_n=40,y_min=1e-8,y_max=1e-4,y_log=True,weight_field=None)
>> > profile.add_fields(['CellMassMsun'])
>> > plot =
>> >
>> > PhasePlot(tracerp25,"zkpc","BMagnitude",["CellMassMsun"],profile=profile,fontsize=21)
>> > plot.set_log("totPressure",True)
>> > plot.set_log("z-velocity",False)
>> > plot.set_log("zvelocity8",False)
>> > plot.set_zlim("CellMassMsun",9e3,1e8)
>> > plot.set_figure_size(4.5)
>> > plot.set_cmap(field="CellMassMsun",cmap='Eos B')
>> >
>> > plot.plots['CellMassMsun'].hide_colorbar()
>> > ax = plot.plots['CellMassMsun'].axes
>> > ax.set_ylabel(r'|B| (Gauss)',fontsize=18)
>> > #ax.set_xlabel('z dist from disk plane (kpc)',fontsize=27)
>> > #ax.set_ylabel(r' ',fontsize=27)
>> > #ax.set_xlabel('dist below disk plane (kpc)',fontsize=18)
>> > ax.set_xlabel(r' ',fontsize=18)
>> >
>> > for label in ax.xaxis.get_ticklabels():
>> >     label.set_rotation(35)
>> >     label.set_fontsize(18)
>> >     label.set_visible(False)
>> > for label in ax.yaxis.get_ticklabels():
>> >     label.set_fontsize(18)
>> > #    label.set_visible(False)
>> >
>> > ax.xaxis.set_ticks([-6,-5,-4,-3,-2,-1,0])
>> > plot.save()
>> >
>> > _______________________________________________
>> > yt-users mailing list
>> > yt-users at lists.spacepope.org
>> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>> >
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list