从 matplotlib 图中删除白色背景
remove white background from the matplotlib graph
我正在尝试绘制透明图形,但背景中出现了一些框,外框没有出现。如何从绘图中删除白色背景并使其透明并放置外框?
from matplotlib import pyplot
pyplot.scatter(Neural_Net, y_test)
pyplot.xlabel('Actual', fontsize=15)
pyplot.ylabel('Predicted', fontsize=15)
pyplot.show()
默认matplotlib
style
是classic
可以看到可用matplotlib styles
import matplotlib.pyplot as plt
#To list all available styles, use:
print(plt.style.available)
['Solarize_Light2', '_classic_test_patch', 'bmh', 'classic', 'dark_background', 'fast', 'fivethirtyeight', 'ggplot', 'grayscale', 'seaborn', 'seaborn-bright', 'seaborn-colorblind', 'seaborn-dark', 'seaborn-dark-palette', 'seaborn-darkgrid', 'seaborn-deep', 'seaborn-muted', 'seaborn-notebook', 'seaborn-paper', 'seaborn-pastel', 'seaborn-poster', 'seaborn-talk', 'seaborn-ticks', 'seaborn-white', 'seaborn-whitegrid', 'tableau-colorblind10']
要改回默认的 while 背景:
plt.style.use('classic')
希望对您有所帮助!
我正在尝试绘制透明图形,但背景中出现了一些框,外框没有出现。如何从绘图中删除白色背景并使其透明并放置外框?
from matplotlib import pyplot
pyplot.scatter(Neural_Net, y_test)
pyplot.xlabel('Actual', fontsize=15)
pyplot.ylabel('Predicted', fontsize=15)
pyplot.show()
默认matplotlib
style
是classic
可以看到可用matplotlib styles
import matplotlib.pyplot as plt
#To list all available styles, use:
print(plt.style.available)
['Solarize_Light2', '_classic_test_patch', 'bmh', 'classic', 'dark_background', 'fast', 'fivethirtyeight', 'ggplot', 'grayscale', 'seaborn', 'seaborn-bright', 'seaborn-colorblind', 'seaborn-dark', 'seaborn-dark-palette', 'seaborn-darkgrid', 'seaborn-deep', 'seaborn-muted', 'seaborn-notebook', 'seaborn-paper', 'seaborn-pastel', 'seaborn-poster', 'seaborn-talk', 'seaborn-ticks', 'seaborn-white', 'seaborn-whitegrid', 'tableau-colorblind10']
要改回默认的 while 背景:
plt.style.use('classic')
希望对您有所帮助!