matlab中的水平标准差填充图

时间:2016-02-03 11:08:14

标签: matlab fill

我有一个示例文件。第一列是我的y轴(代表深度)。第二列是平均值。第3列是平均值+标准差,第4列是平均值 - 标准偏差。

50      8,52021458848310    12,8530947497846    4,18733442718158
100     19,2273240305912    23,7734814467110    14,6811666144714
150     24,2615944638934    30,2678190187990    18,2553699089878
200     30,6833427597963    39,4337701225571    21,9329153970354
250     34,9509485935449    47,8249116812250    22,0769855058648
300     32,4629780635280    40,1731214462594    24,7528346807966
350     33,7584752483269    43,2424890071851    24,2744614894686
400     39,6944893679358    52,5666743873288    26,8223043485428
450     46,5051455836423    63,5570927760677    29,4531983912169
500     49,0458418910265    70,7507807967089    27,3409029853441
550     52,0737915678693    70,5030313767484    33,6445517589901
600     57,5870126919132    81,1282679272898    34,0457574565365
650     58,7946350532416    85,0428844330643    32,5463856734189
700     59,3263566691245    92,6606340696131    25,9920792686359
750     69,0930407230073    105,935771600040    32,2503098459742
800     71,4416953118855    113,211405934863    29,6719846889079
850     70,3617175991868    111,663890244861    29,0595449535130
900     64,7764846391086    97,4995723191651    32,0533969590521
950     70,7142864622626    102,429751242886    38,9988216816390
1000    88,0269426788223    123,259291760572    52,7945935970724
1250    126,529915074894    193,319779063845    59,7400510859419
1500    173,395473019573    242,127131744655    104,663814294491
1750    225,087445395238    300,319434885651    149,855455904824
2000    269,218588809667    295,582291796995    242,854885822339
figure();
plot(example(:,2),example(:,1),'b-x','linewidth',2);
set(gca,'ydir','rev','xlim',[0 400],'ylim',[0 2000]);
grid on; hold on;
fill( [example(:,3) fliplr(example(:,4))], [example(:,1) fliplr(example(:,1))], 'k'); alpha(.25);

我在情节上的填充区域并没有像它应该的那样出现。我也不确定问题是什么。我得到的是左边的图像,但它应该是右边的图像,除了填充。 enter image description here

1 个答案:

答案 0 :(得分:3)

矢量的正确对齐,即将所有矢量对齐到一个大矢量。否则你有两组矢量,它们被单独认为是

$("#main-nav").css({
   "height": $(document).height() + "px"
});

和flipud而不是fliplr

[example(:,x) example(:,y)] --> [example(:,x); example(:,y)]

一个有效的代码示例

fliplr(example(:,x)) // --> does nothing
flipud(example(:,x)) // --> for a column vector the correct approach