MATLAB: change BaseValue on semilog bar chart
-
05-12-2019 - |
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:
Code:
h=bar(matrix);
set(gca,'YScale','log')
Bonus points / good karma for changing x-values to text!
Cheers
La 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'})
Autres conseils
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.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow