Код: Выделить всё
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import openpyxl as xl
df = pd.read_excel("C:\\temp\\test.xlsx", sheet_name="Sheet2", skiprows=5)
print(df.columns)
def grouped(iterable, n):
return zip(*[iter(iterable)]*n)
pair_count = len(list(grouped(df.columns,2)))
pair = 1
plt.figure(figsize=(10,5))
for x_col,y_col in grouped(df.columns,2):
x=np.array(df[x_col].values)
y=np.array(df[y_col].values)
plt.subplot(1,pair_count,pair)
plt.xlim(0.1,15)
plt.ylim(300,800)
plt.plot(x,y)
plt.title(f"{pair}. th plot")
plt.xlabel(f"{x_col}")
plt.ylabel(f"{y_col}")
pair += 1
plt.show()

Буду очень признателен за вашу помощь!
Пытался добавить fig, ax = plt.subplots(), но получилось 10 отдельных графиков.
Подробнее здесь: https://stackoverflow.com/questions/785 ... matplotlib
Мобильная версия