I'm trying to make a matrix of colorplots, and the x and y limits have different range. I'm trying to use AxesPlot because it has the nice function of grouping the colorbar for a single group - in my case, I want a colorbar for each line.
What I need is something similar to this:
But with square plots instead of rectangles (which means that each point should be a rectangle instead of a square). In my real case it's even more drastic, since the limits are xlim=[0,360] and ylim=[0,3.5], resulting in a very thin plot.
Is it possible?
Here is the code to make this example figure:
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
import numpy as np
fig = plt.figure(figsize=(10, 6))
nrow = 3
ncol = 1
grid = [ None for j in range( nrow ) ]
for j in range(0,nrow):
plot = nrow*100 + ncol*10 + (j+1)
grid[j] = AxesGrid(fig, plot,
nrows_ncols=(1, 3),
axes_pad=0.05,
cbar_mode='single',
add_all=True,
cbar_location='right',
cbar_pad=0.1
)
for ax in grid[j]:
ax.set_axis_off()
im = ax.imshow(np.random.random((8,16)), vmin=0, vmax=1)
cbar = ax.cax.colorbar(im)
cbar = grid[j].cbar_axes[0].colorbar(im)
cbar.ax.set_yticks(np.arange(0, 1.1, 0.5))
cbar.ax.set_yticklabels(['low', 'medium', 'high'])
plt.show()