<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 10, 2016 at 9:55 AM, Chris M <span dir="ltr"><<a href="mailto:christopherm02@gmail.com" target="_blank">christopherm02@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello all, <div><br></div><div>I've been trying to make a 4 window slice plot using 2D data. The method I want to use is to redraw itself reflected around an axis so that it creates a 4 window slice plot (similar to the ones seen on A Few Complex Plots page but each plot should be rotated). </div><div><br></div><div> If I could get some help on this or even just how to reflect one 2D plot it would be greatly appreciated. </div></div></blockquote><div><br></div><div>One can control which simulation coordinate axis is set to the x or y axis of a yt plot by manipulating the ds.coordinates object. See this example:</div><div><br></div><div><a href="https://gist.github.com/anonymous/cc879dbab87d21bd233b979774d5ebf0" target="_blank" style="font-size:12.8px">https://gist.github.com/anonymous/cc879dbab87d21bd233b979774d5ebf0</a><br></div><div><br></div><div>I'm not sure offhand if this trick could be easily applied to a multi-panel plot.</div><div><br></div><div>There isn't an interface to force rotations or reflections for plots, although if someone wanted to add that functionality and came up with a nice clean API for it, I bet it would be accepted into yt. It certainly comes up as a feature request on the mailing list pretty often.</div><div><br></div><div>If you aren't interested in improving yt to add this capability, it may be easiest to generate these plots outside of yt using your favorite plotting package. You can get the image buffer associated with a plot via the frb attribute of yt plot objects and plot it using matplotlib, like so:</div><div><br></div><div> from matplotlib import pyplot as plt</div><div> import numpy as np</div><div> import yt</div><div><br></div><div> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')</div><div><br></div><div> slc = yt.SlicePlot(ds, 2, 'density') </div><div><br></div><div> # density_image is an 800x800 ImageArray instance</div><div> density_image = slc.frb['density']</div><div><br></div><div> # density_image is a 2D numpy array</div><div> density_image = np.array(density_image)</div><div><br></div><div> plt.imshow(density_image)</div><div><br></div><div>The "frb" attribute points to the FixedResolutionBuffer instance associated with that plot object. See:</div><div><br></div><div><a href="http://yt-project.org/docs/dev/analyzing/generating_processed_data.html#d-image-arrays">http://yt-project.org/docs/dev/analyzing/generating_processed_data.html#d-image-arrays</a><br></div><div><a href="http://yt-project.org/docs/dev/reference/api/generated/yt.visualization.fixed_resolution.FixedResolutionBuffer.html">http://yt-project.org/docs/dev/reference/api/generated/yt.visualization.fixed_resolution.FixedResolutionBuffer.html</a><br></div><div><br></div><div>-Nathan</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Regards,</div><div>Chris</div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>