Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB: change BaseValue on semilog bar chart

How can I change the base value on the following barchart from 0 to another value (eg 0.001)? Right now it looks plain silly:

Ridiculous bar chart contrapted in MATLAB

Code:

h=bar(matrix);
set(gca,'YScale','log')

Bonus points / good karma for changing x-values to text!

Cheers

like image 559
trolle3000 Avatar asked Mar 04 '12 10:03

trolle3000


1 Answers

Maybe the option to change the baseValue property of bar plots came out only in a later version of Matlab (which version do you have?), but the following works for me:

%# create bar plot with horizontal line at 3
bar(randn(4),'baseValue',1)
%# rename x-tick labels
set(gca,'xticklabel',{'first','second','third'})

enter image description here

like image 186
Jonas Avatar answered Oct 23 '22 02:10

Jonas