Question

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

Was it helpful?

Solution

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

OTHER TIPS

EDIT: Found this on the file exchange. It seems like what you want.

This thread covers your problem. It seems like an ugly hack. The thread does not point to a nice and built-in way to address your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top