[yt-users] How to stamp the vector scale on quiver plots?

Nathan Goldbaum nathan12343 at gmail.com
Tue Oct 7 10:36:56 PDT 2014


Hi Manuel,

On Tue, Oct 7, 2014 at 9:51 AM, Manuel Zamora <mzamora06 at gmail.com> wrote:

> Dear YT community,
>
>  I'm using the annotate_velocity() and annotate_magnetic_field() routines
> for ‘quiver' plots,
> but I also want to stamp the scale of the vectors in the same plot. Could
> anyone point me
> to the respective documentation?
>

Unfortunately the functionality you're talking about hasn't been
implemented.

I can think of three ways to produce the plot you're looking for:

* Create the plot manually in your favorite plotting library, using image
arrays produced using yt's FixedResolutionBuffer object:

http://yt-project.org/doc/visualizing/manual_plotting.html

* Manipulating the SlicePlot or ProjectionPlot to draw a scale arrow
manually.  This will require manipulating the matplotlib figure and axes
objects that are attached to the yt plot object. These doc entries
illustrate how to manually customize yt's plots:

http://yt-project.org/doc/visualizing/plots.html?highlight=figure#further-customization-via-matplotlib
http://yt-project.org/doc/cookbook/simple_plots.html#matplotlib-primitives

* By modifying the QuiverCallback to optionally draw a scale marker.  The
QuiverCallback is defined in plot_modifications.py, a file that lives in
the yt source distribution:

https://bitbucket.org/yt_analysis/yt/src/0f7b97ccc551773ca725ba3209d0364b391793af/yt/visualization/plot_modifications.py?at=yt

All three options will require a bit of code to get working properly.  I'd
personally go with the third option, since it will make this task trivial
for others who have the same problem in the future.  The QuiverCallback
code is pretty straightforward and I don't think a deep understanding of
yt's internals would be necessary to do this. If you choose to go down this
route, we'd love to include your patch into yt and I'd encourage you to
consider submitting a pull request to the yt bitbucket repository.

Sorry I couldn't give an easy answer - unfortunately there's lots of
low-hanging fruit like this in yt's plotting and visualization code, but
since we're all doing research as our day jobs, more or less, it's hard to
justify adding features before people actually need it for a project.
Generally yt features, especially in the plotting code, get implemented as
people happen to need them in their research.

Best,

-Nathan




>  Thanks a lot for your kind help!
>
>  Cheers :)
> _
> Manuel Zamora
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20141007/360997a8/attachment.html>


More information about the yt-users mailing list