matplotlib can not see the effect of setting edgecolor in plt.savefig() or plt.figure()
matplotlib, python
Solution
According to the documentation of `matplotlib.figure.Figure()`, the figure's edge `linewidth` is set to `0.0` by default. You can visualize the `edgecolor` if you bump up this value in either of your code snippets:
import matplotlib.pyplot as plt
plt.figure(linewidth=2)
plt.plot([1,2,3])
plt.savefig('test.png', edgecolor='r', facecolor='g')
Or:
import matplotlib.pyplot as plt
plt.figure(edgecolor='r', facecolor='g', linewidth=2)
plt.plot([1,2,3])
plt.show()
`linewidth=0.0` is a good default, but it should be better documented in matplotlib.pyplot.savefig().
Problem
I can't figure out how to add a border around a figure, it's my understanding that this would be the figure.edgecolor parameter or savefig(edgecolor) but this does not appear to work. I'm using matplotlib 1.1.1. I would expect this code to draw a red border around the figure: ``` import matplotlib.pyplot as plt plt.plot([1,2,3]) plt.savefig('test.png', edgecolor='r', facecolor='g') ``` When I look at the figure it has a green facecolor, but I don't see a red edgecolor? The following doesn't work either: ``` import matplotlib.pyplot as plt plt.figure(edgecolor='r', facecolor='g') plt.plot([1,2,3]) plt.show() ``` Again I see the green facecolor, but no red edgecolor. What am I doing wrong? Any ideas?