我试图在MATLAB中对两个线向量之间的区域进行着色,但它做了一些奇怪的事......这是我的代码:
startDate = datenum('01-01-2004');
endDate = datenum('12-01-2012');
xData = linspace(startDate,endDate,108);
fill( [xData' fliplr(xData')], [Rain_Max fliplr(Rain_Min)], 'b');
set(gca, 'XTick', xData([1 14 26 38 49 62 74 86 97]));
datetick('x','yyyy','keepticks')
xlim([731947 735204])
发生了什么事?!
这是我在绘制两条线时得到的结果:
Rain_Max = [54.3765 71.9412 67.1059 10.6000 13.7765 3.6824 0.3647 0.9647 4.6706 9.9059 16.1647 37.7529 60.1353 34.4235 42.5353 11.9000 7.8000 14.6294 8.4235 5.7706 1.7941 37.3059 30.5765 36.3765 68.5765 38.4588 74.8353 52.9824 4.9412 10.5059 8.1176 2.2824 12.0176 6.0000 13.2706 34.6941 64.0706 53.2706 66.3059 7.3059 10.0000 21.2941 0.7176 13.9941 6.4471 17.2000 23.9176 39.5588 55.8941 67.6353 34.5118 11.9588 5.7529 6.7588 14.8706 0.2471 9.3059 12.6118 32.2000 75.2824 59.7471 72.7706 23.7824 18.3176 23.0176 9.9059 0.5529 0.5294 0.9294 14.4118 14.6000 63.1765 78.3765 60.5882 37.2706 29.5647 14.1176 1.9059 11.2059 21.2471 17.1000 28.5824 32.3353 68.4000 68.7647 83.9765 69.3059 42.6471 7.9529 7.1647 3.8294 3.9176 1.2235 15.3706 31.2176 49.9765 79.8941 54.4412 74.0000 20.8824 10.4235 9.6588 10.3765 0.6471 3.4235 11.6000 23.5235 28.9294];
Rain_Min = [1.2294 1.2412 0.9882 1.6471 2.3412 1.0235 0.1882 0.3647 0.3706 2.7412 2.1294 3.2765 1.6176 1.1824 0.7824 0.5824 2.1176 0.9529 4.3059 0.7765 0.6176 1.8059 0.8000 2.6235 1.6882 1.8176 1.8176 3.0294 0.8118 0.9176 1.3706 0.0941 1.8647 1.8000 0.9706 1.5118 1.9588 1.9059 1.6529 1.5294 1.7176 0.9235 0.3765 2.3529 0.2412 3.8941 1.7294 1.4471 1.2588 1.0471 1.1412 1.8529 0.2471 1.0647 0.6471 0.2471 1.3529 1.3529 2.4706 1.4412 1.5176 1.5765 2.6118 0.8588 1.0000 1.3882 0.2941 0.2941 0.6235 3.2353 5.2647 6.2824 1.1529 1.5235 2.5471 3.0000 2.2471 1.1765 1.7882 5.1294 2.1529 2.1294 3.7882 4.1176 0.9706 1.7176 1.8824 3.5000 2.6765 3.4235 2.9588 0.9529 0.0235 1.8529 1.8353 2.7765 3.8941 1.5294 1.6176 4.4118 2.2824 0.3412 2.9882 0.1647 2.6588 1.5294 5.2471 2.1588];
答案 0 :(得分:2)
你可以使用area
进行扭曲:
...
area(xData,[Rain_Min(:) , Rain_Max(:)-Rain_Min(:)]); hold on
colormap([1 1 1; 0 0 1]);
...