Hi Everyone, I have a simulation with an axis symmetry so i want to plor full simulation using the flip function. However, both plots are flipped in te resulting imagen. Is there a way to flip just one of them? Thanks in advance. for i in range(0,2): print(i) # Load the data and create a single plot ds = yt.load(fn) # load data p = yt.plot_2d(ds, ("Temp")) p.set_width((4,1)) if i == 1: p.flip_vertical() print("vertical") # This forces the ProjectionPlot to redraw itself on the AxesGrid axes. plot = p.plots[("Temp")] plot.figure = fig plot.axes = grid[i].axes plot.cax = grid.cbar_axes[i] # Finally, this actually redraws the plot. p.render() plt.savefig("multiplot_2x2_time_series.png")
Hi there, When you initialize a matplotlib AxesGrid object with `share_all=True`, all of the axes will be linked. So calling `flip_vertical()` will flip all of the linked vertical axes. When `share_all=False`, then y axes in each row will be linked. If you put your plots in separate rows with `share_all=False` then `flip_vertical` will behave as expected. e.g.,: import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import AxesGrid import yt ds = yt.load_sample("IsolatedGalaxy") fig = plt.figure() grid = AxesGrid( fig, (0.075, 0.075, 0.85, 0.85), nrows_ncols=(2, 1), axes_pad=1.0, label_mode="all", share_all=False, cbar_location="right", cbar_mode="edge", cbar_size="5%", cbar_pad="0%", ) for i in range(2): p = yt.SlicePlot(ds, 'x', 'density') p.zoom(40) if i == 1: p.flip_vertical() plot = p.plots['density'] plot.figure = fig plot.axes = grid[i].axes plot.cax = grid.cbar_axes[i] p.render() plt.savefig("multiplot_with_flip.png")
participants (2)
-
Chris Havlin
-
FERNANDO ILLACANCHI GUERRA