我有想要绘制的数据以及相应的误差线:
{{{54927.7, -1.91044}, ErrorBar[38.2664, 0.0538982]},
{{55320.9, -1.97673}, ErrorBar[45.3592, 0.101486]},
{{55671.4, -2.15716}, ErrorBar[41.2234, 0.0258249]},
{{56032.9, -2.15957}, ErrorBar[38.8805, 0.0191277]},
{{56410.6, -2.14289}, ErrorBar[41.5501, 0.0189911]},
{{56787.2, -2.19703}, ErrorBar[38.1972, 0.00632055]},
{{57137.5, -2.1839}, ErrorBar[35.6098, 0.0084108]},
{{57493.3, -2.19994}, ErrorBar[38.0298, 0.00651633]},
{{57859.5, -2.19687}, ErrorBar[40.9682, 0.00658857]}}
我可以在* Mathematica中使用“ ErrorListPlot”函数,但是,如果我想通过函数“ ScalingFunctions->“ Reverse””来反转y轴比例,则误差线不会与数据一起绘制.....有关如何解决此问题的任何建议?
答案 0 :(得分:0)
与此question类似。一些混乱使壁虱看起来正确。
Needs["ErrorBarPlots`"]
data = {
{{54927.7, -1.91044}, ErrorBar[38.2664, 0.0538982]},
{{55320.9, -1.97673}, ErrorBar[45.3592, 0.101486]},
{{55671.4, -2.15716}, ErrorBar[41.2234, 0.0258249]},
{{56032.9, -2.15957}, ErrorBar[38.8805, 0.0191277]},
{{56410.6, -2.14289}, ErrorBar[41.5501, 0.0189911]},
{{56787.2, -2.19703}, ErrorBar[38.1972, 0.00632055]},
{{57137.5, -2.18390}, ErrorBar[35.6098, 0.0084108]},
{{57493.3, -2.19994}, ErrorBar[38.0298, 0.00651633]},
{{57859.5, -2.19687}, ErrorBar[40.9682, 0.00658857]}};
data[[All, 1, 2]] = -data[[All, 1, 2]];
ep = ErrorListPlot[data];
newTicks = AbsoluteOptions[ep, Ticks][[1, 2, 2]] /.
{x1_, x2_, x3_, x4_} :> If[x1 == x2,
{x1, NumberForm[-x2, {3, 2}], {0.014, 0}, x4},
{x1, x2, {0.007, 0}, x4}];
newTicks = newTicks /. {
GrayLevel[0.] -> GrayLevel[0.5],
AbsoluteThickness[0.25] -> AbsoluteThickness[0.18],
AbsoluteThickness[0.125] -> AbsoluteThickness[0.08]};
ErrorListPlot[data, Ticks -> {Automatic, newTicks}]
答案 1 :(得分:0)
Needs["ErrorBarPlots`"]
data = {
{{54927.7, -1.91044}, ErrorBar[38.2664, 0.0538982]},
{{55320.9, -1.97673}, ErrorBar[45.3592, 0.101486]},
{{55671.4, -2.15716}, ErrorBar[41.2234, 0.0258249]},
{{56032.9, -2.15957}, ErrorBar[38.8805, 0.0191277]},
{{56410.6, -2.14289}, ErrorBar[41.5501, 0.0189911]},
{{56787.2, -2.19703}, ErrorBar[38.1972, 0.00632055]},
{{57137.5, -2.18390}, ErrorBar[35.6098, 0.0084108]},
{{57493.3, -2.19994}, ErrorBar[38.0298, 0.00651633]},
{{57859.5, -2.19687}, ErrorBar[40.9682, 0.00658857]}};
(* Invert the error bars, visible in InputForm *)
ep = InputForm[ErrorListPlot[data]] /.
{Line[{{a_, b_}, {c_, d_}}] :> Line[{{a, -b}, {c, -d}}],
Line[{Offset[e_, {f_, g_}], Offset[h_, {i_, j_}]}] :>
Line[{Offset[e, {f, -g}], Offset[h, {i, -j}]}]};
(* Discard the InputForm wrapper *)
ep2 = First[ep];
Show[ErrorListPlot[data, ScalingFunctions -> "Reverse"],
Delete[ep2, Most@First@Position[ep2, Point]]]