Multiple area with different Baseline in MATLAB

Viewed 841

I would like to plot multiple "area" with different baseline value on the same axis in MATLAB 2017a. It seems that the behavior has changed with the graphical update (HG2). Is there a workaround?

Here is my sample code:

x = 1: 10;
y1 = rand( 10, 1 );
baseline1 = 2;
hold on
a1 = area( x, y1 + baseline1, baseline1, 'FaceColor', 'r' );
disp( a1.BaseValue );
y2 = rand( 10, 1 );
baseline2 = -1;
a2 = area( x, y2 + baseline2, baseline2, 'FaceColor', 'g' );
disp( a1.BaseValue );

The a1 area baseline updates when creating the second area a2. I would like the a1 properties to remain the same.

EDIT : I added the disp command showing that the property have been updated.

1 Answers
Related