据我所知,matplotlib 只是为我的误差线绘制了错误的值。我已经尽可能简化了我的代码,直到对值进行硬编码,但事情仍然是错误的...在下面的示例中,我通过 绘制了完全相同的值scatter,它们出现在我期望的位置到 - 但误差线还很遥远。我是不是误会了什么?
from matplotlib.pyplot import *
x = [1, 2, 3, 4, 5]
y = [5, 11, 22, 44, 88]
err = [[4.3, 10.1, 19.8, 40, 81.6],
[5.9, 13.6, 24.6, 48.5, 100.2]]
figure();
errorbar(x, y, yerr=err, label="data")
scatter(x, err[0], c='r', label="lower limit")
scatter(x, err[1], c='g', label="upper limit")
legend()
show()
Run Code Online (Sandbox Code Playgroud)

我经常遇到这种情况,我需要完成几个连续的操作。如果每个操作都专门使用上一步中的数据,那么我可以很乐意做类似的事情pipe(startingData, TE.chain(op1), TE.chain(op2), TE.chain(op3), ...)。op2当还需要来自 的数据时,我找不到一个好的方法来编写此代码startingData,而无需一堆嵌套回调。
如何避免下面示例中的厄运金字塔?
declare const op1: (x: {one: string}) => TE.TaskEither<Error, string>;
declare const op2: (x: {one: string, two: string}) => TE.TaskEither<Error, string>;
declare const op3: (x: {one: string, two: string, three: string}) => TE.TaskEither<Error, string>;
pipe(
TE.of<Error, string>('one'),
TE.chain((one) =>
pipe(
op1({ one }),
TE.chain((two) =>
pipe(
op2({ one, two }),
TE.chain((three) => op3({ one, two, three }))
)
)
)
)
);
Run Code Online (Sandbox Code Playgroud)