<div dir="ltr"><span style="font-size:12.8px">Hi Greta,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">The development version of yt has a function called toggle_right_handed that might be useful here.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Take a look at the following example: <a href="https://gist.github.com/2937442f997bb16f5505fa470edb2480" target="_blank">https://gist.github.<wbr>com/<wbr>2937442f997bb16f5505fa470edb24<wbr>80</a></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Unfortunately you need to be using the development version to do this, there's no workaround for the version you're using, since the call to `invert_xaxis` needs to happen while the plot is getting set up. There are instructions on how to build yt from source here:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><a href="http://yt-project.org/docs/dev/installing.html#installing-yt-using-pip-or-from-source" target="_blank">http://yt-project.org/docs/<wbr>dev/installing.html#<wbr>installing-yt-using-pip-or-<wbr>from-source</a><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Alternatively if you're using conda you can use the nightly conda builds:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><a href="http://yt-project.org/docs/dev/installing.html#nightly-conda-builds" target="_blank">http://yt-project.org/docs/<wbr>dev/installing.html#nightly-<wbr>conda-builds</a><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Hope that's helpful,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Nathan</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 11, 2017 at 12:00 AM, Greta Zhong <span dir="ltr"><<a href="mailto:gretazhong@yahoo.com" target="_blank">gretazhong@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">Hi everyone!<div><br></div><div>I’m trying to invert the horizontal axis on some simple projection plots. I’m trying to get a projection along the x axis, with y as the vertical and z as the horizontal axis where the horizontal/z axis is inverted, with the horizontal/z axis decreasing from left to right. Here’s the relevant code:</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)"><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.x_axis[0] = 2</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.x_axis['x'] = 2</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.y_axis[0] = 1</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.y_axis['x'] = 1</span></div></div></div><div><br></div><div>This is just assigning the z axis (2) to the horizontal axis and the y axis (1) to the vertical axis.</div><div><br></div><div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)">plot1 = yt.ProjectionPlot(ds,"x","<wbr>velocity_x",weight_field='<wbr>density')</div></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)"><span style="font-variant-ligatures:no-common-ligatures"><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">#plot1.plots["velocity_x"].<wbr>axes.invert_xaxis()</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">plot1.save()</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">plot12 = yt.ProjectionPlot(ds,"x","<wbr>density")</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">#plot12.plots["density"].axes.<wbr>invert_xaxis()</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">plot12.save()</span></div></span></div></span></div></div><div><br></div><div>And then I just use ProjectionPlot to make the plots. As you can see, I commented out a sort of matplotlib-y attempt to invert the horizontal axis, to no effect.</div><div><br></div><div>I’ve attached two files: the first is what I’m getting with the above code (‘Projection_x_density_actual'<wbr>), and the second illustrates the orientation I’d like (‘Projection_x_density_<wbr>rotated'). Unfortunately, I got to the desired orientation by swapping my vertical/horizontal axes like this:</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.x_axis[0] = 1</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.x_axis['x'] = 1</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.y_axis[0] = 2</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:monaco;color:rgb(244,244,244);background-color:rgba(0,0,0,0.85098)"><span style="font-variant-ligatures:no-common-ligatures">ds.coordinates.y_axis['x'] = 2</span></div></div><div><br></div><div>and then just rotating the png in preview.</div><div><br></div><div>I can’t find anything in the documentation about this besides the fact that we can use matplotlib objects to customize plots. I’d really appreciate any help on this!</div><div><br></div><div>Thanks,</div><div>Greta</div><div><br></div></div><br>______________________________<wbr>_________________<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/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br></blockquote></div><br></div></div>