Area plot style graph
이전 댓글 표시
I am trying to recreate a graph. There is 3 layers and i want the values of each layer to oscillate between particular values. I have the correct values stored in bl, gr and ye but when plotted onto the area graph they add to each other so end up oscillating around different values. I know this is because area plots sum up the values beneath it, but is there a way to recreate a similar looking graph but with the oscillation around the actual values i have calculated.
Also although i have 50 values i want the x axis on the graph to only go from 0-1, so any help with that is also appreciated.
This is what i have so far.
clc
clear all
close all
bl = 2.5 + (3.5-2.5).*rand(50,1);
gr = 1.5 + (2.5-1.5).*rand(50,1);
ye = 0.5 + (1.5-0.5).*rand(50,1);
y = [bl gr ye];
area(y)
colormap summer
답변 (2개)
area([y(:, 1) diff(y')'])
Label the x-axis from 0 to 1:
Nticks = 11;
xl = xlim;
set(gca, 'XTick', linspace(xl(1), xl(2), Nticks))
set(gca, 'XTickLabel', linspace(0, 1, Nticks))
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!