help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stacked bar plot with positive and negative values


From: Nicholas Jankowski
Subject: Re: Stacked bar plot with positive and negative values
Date: Mon, 20 Apr 2020 12:50:22 -0400



Hi Olivier,
Octave's stacked option appears to work differently than Excel.  I prefer Octave's behavior (although it would be considered a bug
if it differs from MATLAB, I don't have MATLAB to check).   It appears that you can get the plot you want by plotting the positive 
and negative values separately:

z=[1 -2 3;  4 3 1]
zt = z;
zt(zt<0) = 0
h = bar (zt, 'stacked');
hold on
zt = z;
zt(zt>0) = 0
h = bar (zt, 'stacked');
hold off

Tony

FYI.  Octave's behavior is consistent with MATLAB's,

Tony 


only for your code.  his original code does produce different results in Matlab and Octave. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]