我有一个数据集,我想将其不确定性表示为主图周围的填充区域。在x轴方向上的误差很大,因此我无法使用string = 'foo'
isString = {it instanceof String}
println isString(string) // true
// let's try it a different way
isString2 = {String.isInstance(it)}
println isString2(string) // true
// let's try using .& for fancy FP eta reduction
isString3 = String.&isInstance
println isString3(string) // MethodMissingException
// ^^^ No signature of method: java.lang.String.isInstance()
// is applicable for argument types:
// (java.lang.String) values: [foo]
// EDIT: Case #4
// what if we try a method we know does not exist?
isnotString = String.&isnotInstance
println isnotString(string) // MethodMissingException
// ^^^ gives the same error!
// EDIT: Case #5
// Maybe I am misunderstanding how the .& operator works - let's try an example
bar = 'bar'
equalsBar = bar.&equals
println equalsBar('bar') // true - same as 'bar'.equals('bar')
println equalsBar('baz') // false - same as 'bar'.equals('baz')
// the .& operator has worked as expected in this case
,它需要一组通用的x轴。
我曾尝试按照本网站上其他地方的建议使用plt.fill_between(x,y1,y2)
,但是由于我的数据呈锯齿状变化,所以填充的区域最终看起来像节点(参见附图)。
我要完成的是点对点填充,即对于每个i值填充下限的第i个值和上限的第i个值之间的区域,例如具有实际数据的主线始终在填充区域内。
我当前正在使用的代码附在下面。预先感谢您的建议/帮助!
plt.fill(np.append(x1,x2[::-1]))