Skip to content Skip to sidebar Skip to footer

Add Image To Background Of Plot With Seaborn & Matplotlib

I am trying to create a Control Variability Grid Analysis in Python. This analysis requires plotting min and max blood glucose values (in this case, my own) per day on a scatterplo

Solution 1:

import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np  # sample data

img = plt.imread('CVGA.png')
fig, ax = plt.subplots(figsize=(6, 6))
# sns.scatterplot(data=min_max_day, x=min_max_day['Glucose Value (mg/dL)']['amin'], y=min_max_day['Glucose Value (mg/dL)']['amax'], zorder=1)

sns.scatterplot(x=np.linspace(110, 41, 10), y=np.linspace(110, 401, 10), ax=ax)
plt.xlim(110, 40)
plt.ylim(110, 400)

ax.imshow(img, extent=[110, 40, 110, 400], aspect='auto')

enter image description here


Post a Comment for "Add Image To Background Of Plot With Seaborn & Matplotlib"