<div dir="ltr"><div>OK, sorry for the confusion earlier. Never reply to mailing list questions on your phone!</div><div><br></div>The issue is that the ParticleCallback (the class that gets invoked when you call annotate_particles, see yt/visualization/plot_modifcations.py for more details) generates the list of particles to plot based on a region data object that it constructs inline, which is *not* necessarily the same as your "dd" data object that you're using to generate the list of particle sizes to pass to the p_size keyword argument. In fact, looking at the code, I suspect we've always expected p_size to be a scalar and it's basically an accident that it seems to work when you pass it an array of particle sizes. This means that the mapping from particles to particle sizes is basically random - it will only be exactly the same if the two data objects happen to be exactly the same.<div><br><div>I think the best way forward here would be to allow you to specify a custom data object to gather the particles from, instead of only using the region generated by the _get_region function defined here:</div><div><br></div><div><a href="https://bitbucket.org/yt_analysis/yt/src/9f4dc27f7c8fd399a35e04d0423298753b2994c9/yt/visualization/plot_modifications.py?at=yt&fileviewer=file-view-default#plot_modifications.py-1640">https://bitbucket.org/yt_analysis/yt/src/9f4dc27f7c8fd399a35e04d0423298753b2994c9/yt/visualization/plot_modifications.py?at=yt&fileviewer=file-view-default#plot_modifications.py-1640</a><br></div><div><br></div><div>It would also probably be a good idea to error out if you pass a non-scalar p_size without supplying a custom data object to avoid silently producing an incorrect result.</div><div><br></div><div>I think this would be a relatively straightforward modification to yt, if you're willing to give it a shot it would be a welcome contribution. I'm happy to help out with getting your development environment set up and answering questions.</div><div><br></div><div>If you don't want to do that, your custom call to ax.scatter should work fine. The reason you need to call prj.show() for it to work correctly is due to the design of the plotting system: plots aren't actually "valid" until just before they're displayed or saved to disk. You actually don't need to call prj.show(), you can instead call the lower level prj._setup_plots() function to get the same effect.</div><div><br></div><div>In the long run, I'd like to hide this possibly confusing implementation detail from users, possibly by making the .plots attribute of the ProjectionPlot or the .ax attribute of the indifvidual plot objects a property that calls _setup_plots, so the plot is always constructed and valid before you do any custom modifications.</div><div><br></div><div>I'd actually go so far as to call the need to call _setup_plots(), save(), or show() before doing custom modifications is a bug, please feel free to report this as such so we don't lose track. I have some time tomorrow, I might take a shot at fixing this since it is indeed quite confusing, and your e-mail here has popped up into the top of my stack of possible ways to improve yt :)</div><div><br></div><div>Anyway, I hope that wasn't too much detail and that it was a helpful explanation.</div><div><br></div><div>Best,</div><div><br></div><div>Nathan Goldbaum</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 19, 2016 at 8:40 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="white-space:pre-wrap">Oh wait, I see, you want to specify the particle sizes when you call annotate_particles. Let me see if that's possible right now....</div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 19, 2016 at 8:02 PM Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="white-space:pre-wrap" class="m_8710189933825282970gmail_msg">Hi Josh,<br class="m_8710189933825282970gmail_msg"><br class="m_8710189933825282970gmail_msg">Sorry, it's not clear what the difference is, can you explain that a little bit more clearly?<br class="m_8710189933825282970gmail_msg"><br class="m_8710189933825282970gmail_msg">Is there any chance you can upload one of your datasets that has this issue so one of us can reproduce the issue locally?<br class="m_8710189933825282970gmail_msg"><br class="m_8710189933825282970gmail_msg">Nathan</div></blockquote></div></div></div></blockquote></div><br></div>