[yt-users] Overlaying matplotlib plots on yt plots

Suoqing JI suoqing at physics.ucsb.edu
Mon Jun 1 21:24:04 PDT 2015


Hi Doris,

> is there a simpler way to do this directly on yt using annotate_contour or some other yt function?


Yes — you can overplot a circle using this plot modification callback: http://yt-project.org/docs/dev/visualizing/callbacks.html#overplot-a-circle-on-a-plot <http://yt-project.org/docs/dev/visualizing/callbacks.html#overplot-a-circle-on-a-plot>

>  is there to get my RAMSES data loaded into yt as a numpy array with actual numbers in them then feed it into matplotlib to do this task?

That’s also available via fixed resolution buffer: http://yt-project.org/docs/dev/visualizing/manual_plotting.html#slice-projections-and-other-images-the-fixed-resolution-buffer <http://yt-project.org/docs/dev/visualizing/manual_plotting.html#slice-projections-and-other-images-the-fixed-resolution-buffer>

Best wishes,
--
Suoqing JI
Ph.D Student
Department of Physics
University of California, Santa Barbara
http://web.physics.ucsb.edu/~suoqing

> On Jun 1, 2015, at 9:13 PM, DORIS LEE <dorislee at berkeley.edu> wrote:
> 
> Hi all, 
> 
> I have been trying to plot a circle of a given radius around the boundary of a collapsing cloud to track its evolution. 
> Usually in matplotlib, I would just draw a circle using a xy meshgrid, but if I do this using matplotlib the circle would be on a separate figure and not overlaid on the yt plot. So I tried using a PlotWindow to separate the data and the yt plot  but I get this error:
> 
> In [92]:yt.visualization.plot_window.PlotWindow(proj,(-1e5,1e5,-1e5,1e5))
> AttributeError: 'ProjectionPlot' object has no attribute '_key_fields'
> 
> In general, is there to get my RAMSES data loaded into yt as a numpy array with actual numbers in them then feed it into matplotlib to do this task? or alternatively, is there a simpler way to do this directly on yt using annotate_contour or some other yt function?
> 
> Thank you.
> 
> Regards,
> Doris
> ----
> Code for generating the attached plot, the green boundary line is in theory what I am trying to draw.
> 
> ds= yt.load("../../bin/output_00002/info_00002.txt")
> proj = yt.ProjectionPlot(ds, "y", "density",window_size=10)
> proj.set_cmap("density","rainbow")
> proj.annotate_velocity()
> proj.show()
> <rho.png>_______________________________________________
> 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/20150601/bb4df1a8/attachment.html>


More information about the yt-users mailing list