From: kbr on 26 Jun 2010 21:22 Hello, I have a bar plot with x-axis labels showing as 0.04, 0.06, 0.08, etc. How do I change these to 4%, 6%, 8%, etc. Also, how do I show more digits to the right of the decimal? ie: 4.0% vs 4%? Thanks!
From: Faraz Afzal on 26 Jun 2010 21:49 "kbr" <karlruff(a)yahoo.com> wrote in message <i0693u$io7$1(a)fred.mathworks.com>... > Hello, > > I have a bar plot with x-axis labels showing as 0.04, 0.06, 0.08, etc. How do I change these to 4%, 6%, 8%, etc. > > Also, how do I show more digits to the right of the decimal? ie: 4.0% vs 4%? > > Thanks! Hi Karl after plotting your bar graph just use this and ur problem is solved.. set(gca,'XTickLabel','4.000%|6.000%|8.000%|10.000%') Thats it.. I hope it helps.. Forget not to say Thanks.. regards, Muhamamd Faraz
From: dpb on 26 Jun 2010 21:54 kbr wrote: > Hello, > > I have a bar plot with x-axis labels showing as 0.04, 0.06, 0.08, etc. > How do I change these to 4%, 6%, 8%, etc. > > Also, how do I show more digits to the right of the decimal? ie: 4.0% vs > 4%? There may be an easier way I'm not thinking of but... t = get(gca,'xticklabel'); % retrieve current labels v = str2num(v)*100; % convert to percent numeric values t = num2str(v,'%.1f%%', v); % convert to char array w/ % sign set(gca,'xticklabel', t); % and write new labels Salt to suit... --
From: ImageAnalyst on 26 Jun 2010 22:10 Shouldn't that be v = str2num(t)*100; ???
From: dpb on 26 Jun 2010 23:41
ImageAnalyst wrote: > Shouldn't that be > v = str2num(t)*100; ??? Indeed... -- |