[yt-users] Annotation on profileplots

Nathan Goldbaum nathan12343 at gmail.com
Mon Oct 30 14:14:06 PDT 2017


Right now unfortuantely ProfilePlot doesn't offer much in the way of
customization. Your reading of the documentation is correct, none of the
annotate_ methods are implemented for ProfilePlot. In principle we could
implement them but up until now no one has taken on that project.
Ultimately the reason this isn't easy is because ProfilePlot is not
implemented using the same infrastructure as the other yt plot types so the
"annotate_" methods don't get attached "for free" like the other plot types
as part of their basic design. It's set up this way largely for historical
reasons.

Anyway, to answer your question, here is an example notebook that explains
how you might do what you want with ProfilePlot:

https://gist.github.com/anonymous/012a0518c82c687a9c5bab861451ffd0

This uses a couple of hacks and accesses some private functions inside of
ProfilePlot and PlotMPL.

You may end up finding it more convenient to manually plot everything using
matplotlib, as in this example:

https://gist.github.com/anonymous/3c5c991a8ca32e17805acf61a697c68f

As-is ProfilePlot is a bit unflexible and isn't terribly easy to customize.
That asid, there's probably a number of things we could do to make
ProfilePlot a bit more flexible for your use case. In particular, we could
add a way to overplot lines to a ProfilePlot and add a `set_font()`
function to ProfilePlot.

Both of these would be relatively straightforward to add, I think. If you'd
be interested in working on that let me know and I can give you pointers
and point you at the relevant places you'd need to modify in the yt source
code. If you're not interested in working on that, please feel free to file
those feature requests as an issue on our github issue tracker.
Unfortunately I can't commit to doing this myself as I have other things I
need to concentrate on for yt.

Hope that helps,

Nathan

On Mon, Oct 30, 2017 at 2:48 PM, tyuta <y0u1t1a5.t at gmail.com> wrote:

> Dear yt-users,
>
> Hi, I want to annotate some lines on 1D profile plots, like on projection
> plots or slice plots. I looked through the yt documentation, and I found:
>
> Callbacks can be applied to plots created with SlicePlot
> <http://yt-project.org/doc/reference/api/yt.visualization.plot_window.html#yt.visualization.plot_window.SlicePlot>
> , ProjectionPlot
> <http://yt-project.org/doc/reference/api/yt.visualization.plot_window.html#yt.visualization.plot_window.ProjectionPlot>
> , OffAxisSlicePlot
> <http://yt-project.org/doc/reference/api/yt.visualization.plot_window.html#yt.visualization.plot_window.OffAxisSlicePlot>,
> or OffAxisProjectionPlot
> <http://yt-project.org/doc/reference/api/yt.visualization.plot_window.html#yt.visualization.plot_window.OffAxisProjectionPlot> by
> calling one of the annotate_ methods that hang off of the plot object.
>
> on plot modification page, which means annotate_line method is not
> effective for profile plots (I actually tried this on profile plots, and it
> did not work). Is there any good way to annotate lines on 1D profile plots?
> Also, I want to change the fontsize of numbers and labels on the axes of
> profileplots. How can I do this?
> For example, I want to annotate vertical line on density=1e-25, and change
> the fontsize of "density", "10**-28", ..., "10**-21".
>
> Thanks,
> Y.T.
> [image: 埋め込み画像 1]
>
> _______________________________________________
> 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/20171030/486f7ccc/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.png
Type: image/png
Size: 43420 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20171030/486f7ccc/attachment-0002.png>


More information about the yt-users mailing list