क्या कोई यह बता सकता है कि आंकड़े के चेहरे रंग को सेट करते समय नीचे दिया गया कोड क्यों काम नहीं करता है?Matplotlib आकृति चेहरा रंग (पृष्ठभूमि रंग)
import matplotlib.pyplot as plt
# create figure instance
fig1 = plt.figure(1)
fig1.set_figheight(11)
fig1.set_figwidth(8.5)
rect = fig1.patch
rect.set_facecolor('red') # works with plt.show().
# Does not work with plt.savefig("trial_fig.png")
ax = fig1.add_subplot(1,1,1)
x = 1, 2, 3
y = 1, 4, 9
ax.plot(x, y)
# plt.show() # Will show red face color set above using rect.set_facecolor('red')
plt.savefig("trial_fig.png") # The saved trial_fig.png DOES NOT have the red facecolor.
# plt.savefig("trial_fig.png", facecolor='red') # Here the facecolor is red.
जब मैं ऊंचाई आंकड़ा fig1.set_figheight(11)
fig1.set_figwidth(8.5)
इन कमांड plt.savefig("trial_fig.png")
द्वारा उठाया जाता है का उपयोग कर की चौड़ाई निर्दिष्ट करें। हालांकि, चेहरा रंग सेटिंग नहीं उठाई जाती है। क्यूं कर?
आपकी मदद के लिए धन्यवाद।
स्पष्टीकरण के लिए धन्यवाद! – Curious2learn