plotting just contours in a slice
Hi all, I would like to be able to take a slice through a 3D dataset and then plot just the contours of a single variable within that slice. I do not want to overlay the contours with an annotate_countours method. I know one way about this would be to use the FixedResolutionBuffer of some slice plot to reconstruct a mesh-grid and the data, which can then be used within matplotlib directly to create a contour plot. I was curious if there was a more clever method using yt plot objects? Chris
Hey Chris,
I think your best bet might be to do the full process -- create a
slice, annotate it with contours (maybe even filled contours, which
could be an option), and then access the matplotlib axes object. On
the axes object there will be an attribute called images, or image,
which will contain all the matplotlib.image.AxesImage objects. I
believe you can set the alpha on an AxesImage object to 0.0 using
set_alpha, which should de-blend it, but you may also be able to call
set_visible(False).
But I like this idea, and maybe we should make it easier to do.
Here's an example of getting at the axes objects:
http://yt-project.org/docs/2.5/cookbook/simple_plots.html#accessing-and-modi...
If this works for you, it'd probabyl be worth a quick recipe in the cookbook.
-Matt
On Fri, May 24, 2013 at 1:46 PM, Chris Malone
Hi all,
I would like to be able to take a slice through a 3D dataset and then plot just the contours of a single variable within that slice. I do not want to overlay the contours with an annotate_countours method.
I know one way about this would be to use the FixedResolutionBuffer of some slice plot to reconstruct a mesh-grid and the data, which can then be used within matplotlib directly to create a contour plot.
I was curious if there was a more clever method using yt plot objects?
Chris
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hey Matt,
Thanks for the general idea of getting this started. I've added a simple
recipe to the cookbook showing how one can make a contour plot from a
dataset.
Chris
On Fri, May 24, 2013 at 10:54 AM, Matthew Turk
Hey Chris,
I think your best bet might be to do the full process -- create a slice, annotate it with contours (maybe even filled contours, which could be an option), and then access the matplotlib axes object. On the axes object there will be an attribute called images, or image, which will contain all the matplotlib.image.AxesImage objects. I believe you can set the alpha on an AxesImage object to 0.0 using set_alpha, which should de-blend it, but you may also be able to call set_visible(False).
But I like this idea, and maybe we should make it easier to do. Here's an example of getting at the axes objects:
http://yt-project.org/docs/2.5/cookbook/simple_plots.html#accessing-and-modi...
If this works for you, it'd probabyl be worth a quick recipe in the cookbook.
-Matt
Hi all,
I would like to be able to take a slice through a 3D dataset and then
On Fri, May 24, 2013 at 1:46 PM, Chris Malone
wrote: plot just the contours of a single variable within that slice. I do not want to overlay the contours with an annotate_countours method.
I know one way about this would be to use the FixedResolutionBuffer of some slice plot to reconstruct a mesh-grid and the data, which can then be used within matplotlib directly to create a contour plot.
I was curious if there was a more clever method using yt plot objects?
Chris
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Chris Malone
-
Matthew Turk