从matplotlib图中删除白色背景

问题描述 投票:0回答:1

我正在尝试绘制透明图形,但是背景中出现了一些框,并且外部框没有出现。如何从情节中删除白色背景并使其透明并放置外框?

from matplotlib import pyplot
pyplot.scatter(Neural_Net, y_test)
pyplot.xlabel('Actual', fontsize=15)
pyplot.ylabel('Predicted', fontsize=15)
pyplot.show()

Output

python numpy matplotlib graph-visualization
1个回答
1
投票

[默认matplotlib styleclassic

您可以看到可用的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')

希望有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.