Area plot style graph
Afficher commentaires plus anciens
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
Réponses (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))
Andy
le 21 Fév 2013
0 votes
Catégories
En savoir plus sur Graph and Network Algorithms dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!