0

I work with MATLAB.

I have four matrices of size 10x3, and I need to plot them by using the area plot into three different layers, i.e. something similar to the contourslice example (https://uk.mathworks.com/help/matlab/ref/contourslice.html) where on the x-axis and y-axis I would have the 2-d area plot and on the z-axis the four matrices.

For example, I have the following three matrices with an area plot for each individual variable:

A=ones(10,3); 
B=2*ones(10,3); 
C=5*ones(10,3);
D=10*ones(10,3);    
figure(); area(A,'DisplayName','HS') 
figure(); area(B,'DisplayName','HS') 
figure(); area(C,'DisplayName','HS') 
figure(); area(D,'DisplayName','HS')

How can I layer there three area plots into one plot, as shown by this picture for example?

Figure example

Thank you, Mat

Wolfie
  • 27,562
  • 7
  • 28
  • 55
Mat
  • 9
  • 5
  • If you could use `fill` instead of `area`, you could use the solution [here](https://stackoverflow.com/q/43217827/52738). – gnovice Aug 21 '17 at 15:28
  • Thanks, I am not sure that it works in my case. – Mat Aug 21 '17 at 16:32
  • Or maybe [`patch`](https://uk.mathworks.com/help/matlab/ref/patch.html) – Wolfie Aug 21 '17 at 16:49
  • It's not clear what you are asking for. Let's say you do this: `area(rand(10, 3))`. Do you want the three filled plots to be displayed in 3D with separation between them? If so, `area` is not what you want, because it doesn't let you control the z position. – gnovice Aug 21 '17 at 19:20
  • I would like to have a plot that looks like the figure on the question, which means the area plot of the first 10x3 matrix (A) in the first layer (blue area in the above Figure), the second 10x3 matrix (B) in the second layer (brown area in the above figure), and so on. – Mat Aug 22 '17 at 07:38

0 Answers0