Is there a simple way to plot 2D data with means of pixel intensity along the x- and y-axes on the sides of the image? similar to seaborn's jointplot
(doc) but using a 2D numpy array as an input? Or maybe the numpy array can easily be transformed into a form that can be scatter plotted?
An ugly workaround would be the following where I transform the image into x and y coordinates. Then, I can use jointplot
but the image output is pretty ugly.
img=#some 2d image data
xx=np.zeros(img.sum())
yy=np.zeros(img.sum())
i=0
for x in range(img.shape[0]):
for y in range(img.shape[1]):
for c in range(img[x,y]):
xx[i]=x
yy[i]=y
i+=1
import seaborn as sns
sns.jointplot(yy,xx)