Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Inverting a bar chart
Date: Wed, 28 Oct 2009 15:22:43 -0400
Organization: The MathWorks
Lines: 16
Message-ID: <hca5m3$7cr$1@fred.mathworks.com>
References: <hca1r7$ove$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: quistr.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1256757763 7579 172.31.45.136 (28 Oct 2009 19:22:43 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 28 Oct 2009 19:22:43 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <HIDDEN>
Xref: news.mathworks.com comp.soft-sys.matlab:580735


Ryan Utz wrote:
> Hello all,
> 
> I need to make a simple (i.e. bar(x,y)) bar chart where the y-axis is inverted, in other words, bars go down instead of up (though the values are positive), so that the graph looks like columns hanging from the ceiling. Is there any way to tell Matlab to do this? Multiplying all of my y-axis values by -1 does the trick but then the y-axis is incorrectly labeled (i.e. with negative values). 
> 
> Thanks for any/all help,
> Ryan

Assuming gca (the current axes) is the axes containing the bar plot:
   set(gca, 'ydir', 'reverse');

-- 

Richard Quist
Software Developer
The MathWorks, Inc.