边框颜色更改

huangapple go评论72阅读模式
英文:

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.

Image is here

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'

huangapple
  • 本文由 发表于 2023年7月10日 14:43:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76651245.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定