I am using the python code below to attempt to create a graph that fills the entire figure. The problem is I need the graph portion to stretch to fill the entire figure, there should not be any of the green showing and the graphed data should start at one side and go all the way to the other. I have found similar examples online but nothing that exactly solves my problem and I a matplotlib noob. Any help is greatly appreciated.
import numpy as np
import matplotlib.pyplot as plt
data = np.fromfile("rawdata.bin", dtype='<u2')
fig, ax = plt.subplots()
fig.patch.set_facecolor('xkcd:mint green')
ax.axes.xaxis.set_ticks([])
ax.axes.yaxis.set_ticks([])
ax.plot(data)
fig.tight_layout()
plt.show()
CodePudding user response:
You can use subplots_adjust
which gives you full control instead of tight_layout
:
plt.subplots_adjust(left=0, right=1, bottom=0, top=1)
CodePudding user response:
If your environment is a Jupyter environment, you will see the margins even if you control the axes. To suppress this, please add the following code. This information was referenced from