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:

ds.coordinates.x_axis[0] = 2

ds.coordinates.x_axis['x'] = 2

ds.coordinates.y_axis[0] = 1

ds.coordinates.y_axis['x'] = 1

This is just assigning the z axis (2) to the horizontal axis and the y axis (1) to the vertical axis.

plot1 = yt.ProjectionPlot(ds,"x","velocity_x",weight_field='density')

#plot1.plots["velocity_x"].axes.invert_xaxis()

plot1.save()

plot12 = yt.ProjectionPlot(ds,"x","density")

#plot12.plots["density"].axes.invert_xaxis()

plot12.save()

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.

I’ve attached two files: the first is what I’m getting with the above code (‘Projection_x_density_actual'), and the second illustrates the orientation I’d like (‘Projection_x_density_rotated'). Unfortunately, I got to the desired orientation by swapping my vertical/horizontal axes like this:

ds.coordinates.x_axis[0] = 1

ds.coordinates.x_axis['x'] = 1

ds.coordinates.y_axis[0] = 2

ds.coordinates.y_axis['x'] = 2

and then just rotating the png in preview.

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!

Thanks,

Greta