0

how can i change a plot size without changing the figure size?

i know how to change the fig size but the size of the plots gets changed too, so when i save the image the background (figure) should be bigger the the size of the plots.

import numpy as np

import matplotlib.pyplot as plt


x = np.linspace(0, 10, 100)
y1, y2, y3 = np.cos(x), np.cos(x + 1), np.cos(x + 2)
names = ['Signal 1', 'Signal 2', 'Signal 3']

fig, axes = plt.subplots(nrows=3, figsize=(10, 10), facecolor='lightblue')



axes[0].plot(x, y1, color='black')
axes[1].plot(x, y2, color='black')
axes[2].plot(x, y3, color='black')

axes[0].set(xlim=[0, 10], ylim=[-1,1])
axes[1].set(xlim=[0, 10], ylim=[-1,1])
axes[2].set(xlim=[0, 10], ylim=[-1,1])

axes[0].set_title(names[0], fontsize=20)
axes[1].set_title(names[1], fontsize=20)
axes[2].set_title(names[2], fontsize=20)

axes[0].axes.xaxis.set_visible(False)
axes[1].axes.xaxis.set_visible(False)
axes[2].axes.xaxis.set_visible(False)

axes[0].axes.yaxis.set_visible(False)
axes[1].axes.yaxis.set_visible(False)
axes[2].axes.yaxis.set_visible(False)


plt.show()
Winston
  • 15
  • 5

0 Answers0