I want to print the row of a dataframe below a plot. Here is my current code:
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec np.random.seed(1234) df = pd.DataFrame( {'px_last': 100 + np.random.randn(1000).cumsum()}, index=pd.date_range('2010-01-01', periods=1000, freq='B'), ) fig, ax = plt.subplots(2,1) # ax[0].plot(x,y,"k.") # df.loc[idx, 'px_last'].plot(ax=ax, color=color, label='') ax[0].plot(df.index, df['px_last']) #url = 'https://raw.githubusercontent.com/kornelski/pngquant/master/test/img/test.png' url = 'df_row1.png' im = plt.imread(url) implot = ax[1].imshow(im) Right now, I save the first row of the dataframe as an image and plot it as a subplot for my main image. Is there an easier way to do this? I tried using dataframe_image as explained here but it only saves the image, I'm unable to find a way to plot it dynamically as a subplot.
Here is my expected output

