I don't understand why I cannot find any examples on this, maybe its not possible; I've seen How to show PIL Image in ipython notebook and How to convert a NumPy array to PIL image applying matplotlib colormap and cannot figure this out.
Say I have this Jupyter code:
import io
import matplotlib.figure
import matplotlib.pyplot as plt
%matplotlib inline
fig = matplotlib.figure.Figure(facecolor=(1.0,1.0,1.0,1.0))
fig.text(0, 0, "Hello World", fontsize=20)
with io.BytesIO() as buf:
fig.savefig(buf, dpi=120, format="png", bbox_inches="tight",
pad_inches=0)
buf.seek(0)
rgba = plt.imread(buf)
from IPython.display import display
from IPython.display import Markdown as md, Javascript, HTML
display(md("I want this text **above** the image"))
plt.imshow(rgba)
display(md("I want this text **below** the image"))
This is what I get:
... but this is what I want instead:
... or in case I'm not clear enough, this is the end result I desire:
How can I achieve that?