[yt-users] plotting questions

Cameron Hummels chummels at gmail.com
Fri Jul 31 06:00:47 PDT 2015


Hi Shankar,

There is an easy way to reset the center, with the set_center() function.

As for p.show(), I believe that only works in an ipython session (now
jupyter) or an ipython notebook.  If you just want to use straight
interactive python sessions, you'll have to stick with saving image and
then opening them with an external program.

Please have a look at the plotting documentation, as I think you'll find
that it answers a lot of your questions.

slice.set_center() docs:
http://yt-project.org/docs/dev/visualizing/plots.html#set-the-plot-center

Plotting documentation:
http://yt-project.org/docs/dev/visualizing/plots.html

Cameron

On Fri, Jul 31, 2015 at 8:45 AM, Shankar Agarwal <agarwalshankar at gmail.com>
wrote:

> Hi all,
>
> Thanks to Andrew/Cameron, p.set_zlim and p.set_colorbar_label worked well.
>
> Moving on, I am making a projection plot of particles using:
>
> 1. ds = yt.load(DATA_SET) # load info_file
> 2. p = yt.ParticleProjectionPlot(ds, 2, ['particle_mass'],
> center=(0.325,0.612,0.817))
> 3. p.set_width((2,'Mpc'))
>
> As you can see, I am choosing a center, and projecting all particles along
> z-axis, onto the x-y within 2 Mpc width around the center. However, I would
> like to do the following:
>
> A) be able to change the "center" as many times as I prefer. Since the
> full simulation data set is quite heavy, every time I change the center, it
> takes about 30 minutes to get the final plot around the new center. So if I
> want to change the center by even a little bit, it is a pain. Is there a
> way to load the full data once, and then be able to repeat steps 2-3
> quickly with different "center". I have about 200-300 "center" values
> (corresponding to high density regions) I would like to explore.
>
> B) p.show() does not pop the plot for me. I have to save it using p.save()
> and then open the image. I have tried x11 and terminal. By the way, I am
> running my plot script as "python myplot.py". In myplot.py do I need to
> import something to display images?
>
> Cheers,
> Shankar
>
>
> On Wed, Jul 29, 2015 at 6:19 PM, Andrew Myers <atmyers2 at gmail.com> wrote:
>
>> Hi Shankar,
>>
>> 1. You can set range of the colorbar by doing, for example:
>>
>> p.set_zlim('particle_mass', 1e6, 1e8)
>>
>> 2. Calling it "Particle Mass" follows the yt convention for phase plots,
>> but you're right that "mass per pixel" or something like that might make
>> more sense. At any rate, you can change the label to whatever you want
>> using, e.g.:
>>
>> p.set_colorbar_label('particle_mass', 'Particle mass per pixel')
>>
>> 3. Currently, contour callbacks are disabled for particle plots. I think
>> they could be made to work, although the results might look like a mess if
>> the plot pixels are sparsely populated. Is this an important feature for
>> you? If so, you could add a ticket about it here
>> <https://bitbucket.org/yt_analysis/yt/issues/new>, and we'll see about
>> enabling this feature.
>>
>> Thanks,
>> Andrew
>>
>>
>>
>> On Wed, Jul 29, 2015 at 8:11 AM, Shankar Agarwal <
>> agarwalshankar at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have a few plotting questions:
>>>
>>> 1.
>>> http://yt-project.org/docs/3.2/cookbook/simple_plots.html#simple-particle-plot
>>>
>>> p.set_unit('particle_mass', 'Msun')
>>>
>>> In the above plot, Colorbar range is approximately Mass=10^5-10^9. When
>>> making a plot using ParticlePlot or ParticleProjectionPlot, can I manually
>>> force the range on the colorbar?
>>>
>>> 2. The label on the colorbar says "Particle Mass". Instead, shouldn't it
>>> be saying something like mass_per_pixel, since the plot is showing the
>>> total number of particles projected along the z-axis? How can we rename the
>>> colorbar?
>>>
>>> 3. Can contours of mass be added to the above plot, using annotate?
>>>
>>> Regards,
>>> Shankar
>>>
>>>
>>> _______________________________________________
>>> 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
>
>


-- 
Cameron Hummels
NSF Postdoctoral Fellow
Department of Astronomy
California Institute of Technology
http://chummels.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150731/b2c51b23/attachment.html>


More information about the yt-users mailing list