英文:
Plot border color change
问题
我尝试将facecolor
更改为白色,但没有成功。
英文:
How can I change border color from dark gray to white? I have tried a few things but not success.
here is code and figure.
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('classic')
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pylab as plt2
def plot_hist(*argv, titles):
"""
plots the historgram of the input phase maps
"""
for i in range(len(argv)):
hist = np.histogram(argv[i].ravel(), bins=100)
plt.plot(hist[1][1:], hist[0])
plt.xlabel("phase values")
plt.ylabel("frequency")
plt.title("Histogram Analysis")
plt.grid()
if titles is not None:
plt.legend(titles)
fig=plt.figure(facecolor='white')
plt.show()
I tried to change facecolor to white but it did not work.
答案1
得分: 0
你目前正在将样式设置为 classic
,这会将 figure.facecolor
设置为灰色(请参见GitHub上的样式参数)。这是有意为之吗?
你可以选择删除 plt.style.use('classic')
来使用默认样式,或者使用以下代码将 figure.facecolor
设置为白色:
plt.rcParams['figure.facecolor'] = 'white'
英文:
You are actively setting the style to classic
, which sets figure.facecolor
to grey (see the style parameters on github). Is this on purpose?
You can either remove plt.style.use('classic')
to use the default style or set figure.facecolor
to white with the following:
plt.rcParams['figure.facecolor']='white'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论