You can control the aspect ratio with ax.set_aspect :
import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax=fig.add_subplot(1,1,1) ax.set_aspect(0.3) x,y=np.random.random((2,100)) plt.scatter(x,y)
Another way to set the aspect ratio ( jterrace already mentioned) is to use the figsize parameter in plt.figure : for example. fig = plt.figure(figsize=(3,1)) . However, the two methods are slightly different: a figure can contain many axes. figsize controls the aspect ratio for the whole picture, and set_aspect controls the aspect ratio for a particular axis.
You can then trim the unused space around the graph with bbox_inches='tight' :
plt.savefig('/tmp/test.png', bbox_inches='tight')

If you want to get rid of excess empty space due to the automated selection of x-range and y-range of matplotlib, you can manually set them using ax.set_xlim and ax.set_ylim :
ax.set_xlim(0, 1) ax.set_ylim(0, 1)

source share