Particle Projection Plot: Increase Marker size
![](https://secure.gravatar.com/avatar/a2e1c77e16c7d24f69c02e301b08600b.jpg?s=120&d=mm&r=g)
Hi, For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization.particle_plots.html...) Thanks, Stephanie
![](https://secure.gravatar.com/avatar/7857f26c1ef2e9bdbfa843f9087710f7.jpg?s=120&d=mm&r=g)
Sorry, can you clarify what you are trying to customize? What marker? On Tue, Apr 24, 2018 at 2:43 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi,
For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization.particle_plots. html#yt.visualization.particle_plots.ParticleProjectionPlot)
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
![](https://secure.gravatar.com/avatar/a2e1c77e16c7d24f69c02e301b08600b.jpg?s=120&d=mm&r=g)
Hi Nathan, With particle projection plots, each particle is represented by a dot on the plot. Is there a way to increase that size of those dots? (When there are not a lot of particles, the original dot size make it hard to see the distribution of these particles.) Thanks, Stephanie On Tue, Apr 24, 2018 at 12:45 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Sorry, can you clarify what you are trying to customize? What marker?
On Tue, Apr 24, 2018 at 2:43 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi,
For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization. particle_plots.html#yt.visualization.particle_plots.P articleProjectionPlot)
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
![](https://secure.gravatar.com/avatar/7857f26c1ef2e9bdbfa843f9087710f7.jpg?s=120&d=mm&r=g)
Ah, that's why I didn't understand. There is no marker. You can think of the ParticleProjectionPlot as a way to visualize a 2D histogram. Rather than drawing a shape where a particle is, it identifies the pixel in an image where the particles projected position overlaps and colors in that pixel. There are two ways to make the marker generated by an individual particle bigger. One would be to make the resolution of the image lower: https://gist.github.com/ngoldbaum/7efdb43be7749260169bb6d12a8edd75 (the "marker" is square because it's just filling in a pixel) Another would be to draw markers using a plot annotation, in particular the particle callback. Unfortunately doing that right now requires a change to the yt codebase, which I've proposed as a pull request here: https://github.com/yt-project/yt/pull/1765 See the notebook I link to in the pull request description for a usage example. On Tue, Apr 24, 2018 at 2:49 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi Nathan,
With particle projection plots, each particle is represented by a dot on the plot. Is there a way to increase that size of those dots? (When there are not a lot of particles, the original dot size make it hard to see the distribution of these particles.)
Thanks, Stephanie
On Tue, Apr 24, 2018 at 12:45 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Sorry, can you clarify what you are trying to customize? What marker?
On Tue, Apr 24, 2018 at 2:43 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi,
For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization.par ticle_plots.html#yt.visualization.particle_plots.ParticleProjectionPlot)
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
![](https://secure.gravatar.com/avatar/a2e1c77e16c7d24f69c02e301b08600b.jpg?s=120&d=mm&r=g)
Thanks Nathan, especially for the explanation; otherwise I would have never thought of thinking particle projection plot that way. And thanks for sending in the pull request, that functionally would really help! On Tue, Apr 24, 2018 at 1:11 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Ah, that's why I didn't understand. There is no marker. You can think of the ParticleProjectionPlot as a way to visualize a 2D histogram. Rather than drawing a shape where a particle is, it identifies the pixel in an image where the particles projected position overlaps and colors in that pixel.
There are two ways to make the marker generated by an individual particle bigger.
One would be to make the resolution of the image lower:
https://gist.github.com/ngoldbaum/7efdb43be7749260169bb6d12a8edd75
(the "marker" is square because it's just filling in a pixel)
Another would be to draw markers using a plot annotation, in particular the particle callback. Unfortunately doing that right now requires a change to the yt codebase, which I've proposed as a pull request here:
https://github.com/yt-project/yt/pull/1765
See the notebook I link to in the pull request description for a usage example.
On Tue, Apr 24, 2018 at 2:49 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi Nathan,
With particle projection plots, each particle is represented by a dot on the plot. Is there a way to increase that size of those dots? (When there are not a lot of particles, the original dot size make it hard to see the distribution of these particles.)
Thanks, Stephanie
On Tue, Apr 24, 2018 at 12:45 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Sorry, can you clarify what you are trying to customize? What marker?
On Tue, Apr 24, 2018 at 2:43 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi,
For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization.par ticle_plots.html#yt.visualization.particle_plots.ParticleProjectionPlot )
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
![](https://secure.gravatar.com/avatar/a2e1c77e16c7d24f69c02e301b08600b.jpg?s=120&d=mm&r=g)
Hi Nathan, Since you merged the pull request to the yt codebase, I just downloaded that and tried your annotate particle method. Strangely, the annotated particles didn't show up. Not sure if this is a related issue, but if I try to draw a circle around the center with annotate_sphere, nothing shows up as well. I show a simple example below, using the EAGLE dataset from the YT data hub. eagle_fname = './data/snapshot_028_z000p000/snap_028_z000p000.0.hdf5' unit_base = {'UnitLength_in_cm' : 3.085678e+24, 'UnitMass_in_g' : 1.989e+43, 'UnitVelocity_in_cm_per_s' : 100000.0} ds = yt.load(eagle_fname,unit_base=unit_base) center = ds.arr(np.array([12.08809,4.474372,1.4133347]),'Mpccm') plot_cubeside = ds.quan(50,'kpc') # a cube of +/- 25 kpc from the center (50 kpc in length) boxreg_leftcorner = center - plot_cubeside/2. boxreg_rightcorner = center + plot_cubeside/2. boxreg = ds.region(center,left_edge=boxreg_leftcorner,right_edge=boxreg_rightcorner) ppx = yt.ParticleProjectionPlot(ds, 'x', fields=('PartType0','Mass'),\ center=center,width=plot_cubeside,data_source=boxreg) ppx.annotate_particles(plot_cubeside, p_size=100, ptype='PartType0') ppx.annotate_sphere(center, radius=(10, 'kpc'), coord_system='data', circle_args={'color':'black'}) ppx.save('test_annotateparticle.png') I wonder would this be related to some subtleties in coordinate systems that I am not aware of. I tried to specify the center in 'code_length' in annotate_sphere, but then nothing happens as well. Please let me know if there's something I have obviously missed. Thanks for you help again! Stephanie On Tue, Apr 24, 2018 at 1:11 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Ah, that's why I didn't understand. There is no marker. You can think of the ParticleProjectionPlot as a way to visualize a 2D histogram. Rather than drawing a shape where a particle is, it identifies the pixel in an image where the particles projected position overlaps and colors in that pixel.
There are two ways to make the marker generated by an individual particle bigger.
One would be to make the resolution of the image lower:
https://gist.github.com/ngoldbaum/7efdb43be7749260169bb6d12a8edd75
(the "marker" is square because it's just filling in a pixel)
Another would be to draw markers using a plot annotation, in particular the particle callback. Unfortunately doing that right now requires a change to the yt codebase, which I've proposed as a pull request here:
https://github.com/yt-project/yt/pull/1765
See the notebook I link to in the pull request description for a usage example.
On Tue, Apr 24, 2018 at 2:49 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi Nathan,
With particle projection plots, each particle is represented by a dot on the plot. Is there a way to increase that size of those dots? (When there are not a lot of particles, the original dot size make it hard to see the distribution of these particles.)
Thanks, Stephanie
On Tue, Apr 24, 2018 at 12:45 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Sorry, can you clarify what you are trying to customize? What marker?
On Tue, Apr 24, 2018 at 2:43 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi,
For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization.par ticle_plots.html#yt.visualization.particle_plots.ParticleProjectionPlot )
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
![](https://secure.gravatar.com/avatar/7857f26c1ef2e9bdbfa843f9087710f7.jpg?s=120&d=mm&r=g)
Hi Stephanie, Thanks for the report and for the test script to reproduce the issue. This ended up being due to a couple of unit handling issues in yt that I've fixed here: https://github.com/yt-project/yt/pull/1767 Apologies for the trouble and thanks again for the bug report and steps to reproduce the bug. -Nathan On Wed, Apr 25, 2018 at 11:18 AM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi Nathan,
Since you merged the pull request to the yt codebase, I just downloaded that and tried your annotate particle method. Strangely, the annotated particles didn't show up. Not sure if this is a related issue, but if I try to draw a circle around the center with annotate_sphere, nothing shows up as well. I show a simple example below, using the EAGLE dataset from the YT data hub.
eagle_fname = './data/snapshot_028_z000p000/snap_028_z000p000.0.hdf5' unit_base = {'UnitLength_in_cm' : 3.085678e+24, 'UnitMass_in_g' : 1.989e+43, 'UnitVelocity_in_cm_per_s' : 100000.0} ds = yt.load(eagle_fname,unit_base=unit_base)
center = ds.arr(np.array([12.08809,4.474372,1.4133347]),'Mpccm') plot_cubeside = ds.quan(50,'kpc')
# a cube of +/- 25 kpc from the center (50 kpc in length) boxreg_leftcorner = center - plot_cubeside/2. boxreg_rightcorner = center + plot_cubeside/2. boxreg = ds.region(center,left_edge=boxreg_leftcorner,right_edge= boxreg_rightcorner)
ppx = yt.ParticleProjectionPlot(ds, 'x', fields=('PartType0','Mass'),\ center=center,width=plot_cubeside,data_source=boxreg) ppx.annotate_particles(plot_cubeside, p_size=100, ptype='PartType0') ppx.annotate_sphere(center, radius=(10, 'kpc'), coord_system='data', circle_args={'color':'black'}) ppx.save('test_annotateparticle.png')
I wonder would this be related to some subtleties in coordinate systems that I am not aware of. I tried to specify the center in 'code_length' in annotate_sphere, but then nothing happens as well.
Please let me know if there's something I have obviously missed.
Thanks for you help again! Stephanie
On Tue, Apr 24, 2018 at 1:11 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Ah, that's why I didn't understand. There is no marker. You can think of the ParticleProjectionPlot as a way to visualize a 2D histogram. Rather than drawing a shape where a particle is, it identifies the pixel in an image where the particles projected position overlaps and colors in that pixel.
There are two ways to make the marker generated by an individual particle bigger.
One would be to make the resolution of the image lower:
https://gist.github.com/ngoldbaum/7efdb43be7749260169bb6d12a8edd75
(the "marker" is square because it's just filling in a pixel)
Another would be to draw markers using a plot annotation, in particular the particle callback. Unfortunately doing that right now requires a change to the yt codebase, which I've proposed as a pull request here:
https://github.com/yt-project/yt/pull/1765
See the notebook I link to in the pull request description for a usage example.
On Tue, Apr 24, 2018 at 2:49 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi Nathan,
With particle projection plots, each particle is represented by a dot on the plot. Is there a way to increase that size of those dots? (When there are not a lot of particles, the original dot size make it hard to see the distribution of these particles.)
Thanks, Stephanie
On Tue, Apr 24, 2018 at 12:45 PM, Nathan Goldbaum <nathan12343@gmail.com
wrote:
Sorry, can you clarify what you are trying to customize? What marker?
On Tue, Apr 24, 2018 at 2:43 PM, Stephanie Ho <stephaniehkho@gmail.com> wrote:
Hi,
For particle projection plots, is there a way to increase the marker size? I am sorry if I overlooked, but I don't seem to see a relevant keyword for marker size under ParticleProjectionPlot (documentation: http://yt-project.org/doc/reference/api/yt.visualization.par ticle_plots.html#yt.visualization.particle_plots.ParticlePro jectionPlot)
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Nathan Goldbaum
-
Stephanie Ho