- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将我的 fill_between 添加到图例中,但它不起作用?为什么它与其他地 block 不同?这是我现在的图表:
plt.scatter(stageheight,discharge,color='b',label='measured data')
plt.plot(stageheight_hecras,discharge_hecras,'y^',label='modeled with HEC-RAS')
plt.plot(stageheight_masked,discharge_predicted,'r-',label='regression line measured data')
plt.plot(stageheight_hecras,discharge_predicted_hecras,'g-',label='regression line HEC-RAS')
plt.plot(stageheight_masked,upper,'r--',label='15% error measured data')
plt.plot(stageheight_masked,lower,'r--')
plt.plot(stageheight_hecras,upper_hecras,'g--',label='30% error HEC-RAS')
plt.plot(stageheight_hecras,lower_hecras,'g--')
plt.fill_between(stageheight_masked,upper,lower,facecolor='red',edgecolor='red',alpha=0.5,label='test')
plt.fill_between(stageheight_hecras,upper_hecras,lower_hecras,facecolor='green',alpha=0.5)
plt.axhline(y=0.6,xmin=0,xmax=1,color='black',linewidth = 4.0,label='measuring range')
plt.text(0.02,0.7,'measured rating curve $Q = 1.37H^2 + 0.34H - 0.007$\nmodeled ratign curve $Q = 1.14H^2 - 0.51H + 0.07$',bbox=dict(facecolor='none',edgecolor='black',boxstyle='square'))
plt.title('Rating curve Catsop')
plt.ylabel('discharge$[m^3/s]$')
plt.ylim(0,2.5)
plt.xlim(0,1.2)
plt.xlabel('stageheight$[m]$')
plt.legend(loc='upper left', title='Legend')
plt.grid(True)
plt.show()
最佳答案
您使用的是什么版本的 matplotlib
?
如果您升级到 v1.5.0
或更高版本,这应该可以工作。有关更多详细信息,请参见此处:https://github.com/matplotlib/matplotlib/pull/3303#event-182205203
关于python - 在 python 中的图例中添加一个 fill_between,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35653251/
我有以下数据框: symbol DAL MS QQQ SPY TLT XLE symbol
您好,我在 python 中使用 fill_between 命令,但 fill_between 似乎总是在线图下方。 看这个例子,alpha=1,所以不是不可见的。当它们位于 fill_between
我正在创建一个当前看起来像这样的“事件图”: 但是,我不知道如何为每个颜色组添加图例。这就是现在创建情节的方式: handles = dict() for i, channel_events in e
我正在创建一个当前看起来像这样的“事件图”: 但是,我不知道如何为每个颜色组添加图例。这就是现在创建情节的方式: handles = dict() for i, channel_events in e
我正在使用 Anaconda 2.7,我的 fill_between() 尝试没有结果。我不确定我是否遗漏了一个包,或者我的绘图语法是否正在抛出 python... 这是我的代码: from scip
我有一些问题与使用 mplot3D 在 Python 中创建一个简单的线图有关,其中填充了图下方的区域。我在 RedHatEnterprise 7.2、matplotlib 1.2.0 和 numpy
我有一个奇怪的情况,我需要一些帮助。我有以下数据: xdata = [ 11.125, 11.375, 11.625, 11.875, 12.125, 12.375, 12.625, 1
当您在同一张图上绘制多个内容时,大多数绘图方法(如 plot() 和 errorbar)会自动更改为 color_palette 中的下一种颜色。由于某些原因,fill_between() 不是这种情
我必须将月份名称显示为 xticks,当我绘制图形并将 x 作为月份名称传递时,它绘制错误。我还必须在折线图上叠加一个散点图。 我不能在这里粘贴完整的代码,因为它是一个 MOOC 作业,我只是在寻找我
这类似于 Matlab: Combine the legends of shaded error and solid line mean ,除了 Matplotlib。示例代码: import num
我用下面的代码在空间中绘制了随机三角形,但我想用颜色填充三角形。我知道 matplotlib 中的 fill_between() 函数,但是我不确定如何在下面的示例中实现它 import matplo
我是新手,正在尝试 .fill_between() 我图表上的两条线。我已经尝试了所有我能想到的方法来确保基础数据是正确的,但每次我绘制此图表时,.fill_between() 都会在 x 轴上出现一
我正在尝试将我的 fill_between 添加到图例中,但它不起作用?为什么它与其他地 block 不同?这是我现在的图表: plt.scatter(stageheight,discharge,co
我正在尝试对由此示例代码生成的两条曲线的交点之前的区域进行着色: import numpy as np import matplotlib.pyplot as plt x = np.arange(0,
我从两个数据帧创建了一个 Pandas 图: ttload.plot(legend=True, figsize=(12,7)) zzload.plot(legend=False) 现在,我想使用 fi
我有一种感觉,我要用这个来敲我的额头,但我正在尝试填充两个极函数的公共(public)内部 r = 4 sin(2θ ) 和 r = 2。看来我得到的与我想要的相反。有什么想法吗? import nu
我绘制了(使用 matplotlib)时间序列及其相关的置信区间上限和下限(我在 Stata 中计算)。我使用 Pandas 读取 stata.csv 输出文件,因此该系列的类型为 pandas.co
我正在尝试为 matplotlib 中的 fill_between 形状制作动画,但我不知道如何更新 PolyCollection 的数据。举个简单的例子:我有两条线,我总是在它们之间填充。当然,线条
我想 Fill_Between 正态分布的一个子部分,比如说左边的 5%tile。 import numpy as np import matplotlib.pyplot as plt from sc
我想制作一个移动图,在绘制曲线时曲线下方的区域会变色。 我用谷歌搜索了一下,发现我应该以某种方式创建一个补丁。但是,我不明白他们给出的任何例子,所以让我在这里用我的具体例子问一下: import nu
我是一名优秀的程序员,十分优秀!