From: Wenbiao Cai on 28 Jul 2010 11:43 Below is my code, but in the graph the xticklabels are not equally spaced. Is it possible to force them to be equally spaced? Thank you plot(rgdp/rgdp(end-4),rp,'.'); lsline; xlabel('GDP per capita (US=1)'); ylabel('Non-agricultural value added per worker rel. to Agricultural'); axis([1/64 3/2 0 10]); xtick = [1/64,1/32,1/16,1/8 ,1/4,1/2,1,3/2]; xtick_label = ['1/64';'1/32';'1/16';'1/8 ';'1/4 ';'1/2 ';'1 ';'3/2 ']; set(gca','XTick',xtick); set(gca,'XTicklabel',xtick_label);
From: Matt Fig on 28 Jul 2010 12:50 axis([1/64 3/2 0 10]); xtick = [1/64,1/32,1/16,1/8 ,1/4,1/2,1,3/2]; xtick_label = ['1/64';'1/32';'1/16';'1/8 ';'1/4 ';'1/2 ';'1 ';'3/2 ']; set(gca','XTick',xtick,'XTicklabel',xtick_label,'xscale','log');
From: Matt Fig on 28 Jul 2010 13:00 "Matt Fig" <spamanon(a)yahoo.com> wrote in message <i2pn3v$br5$1(a)fred.mathworks.com>... > axis([1/64 3/2 0 10]); > xtick = [1/64,1/32,1/16,1/8 ,1/4,1/2,1,3/2]; > xtick_label = ['1/64';'1/32';'1/16';'1/8 ';'1/4 ';'1/2 ';'1 ';'3/2 ']; > set(gca','XTick',xtick,'XTicklabel',xtick_label,'xscale','log'); Also, I would use a cell array to hold the labels. This gives better alignment with the ticks as there is no extra spacing needed to preserve rectangularity. xtick_label = {'1/64';'1/32';'1/16';'1/8';'1/4';'1/2';'1';'3/2'};
From: TideMan on 28 Jul 2010 16:06 On Jul 29, 3:43 am, "Wenbiao Cai" <billmao...(a)hotmail.com> wrote: > Below is my code, but in the graph the xticklabels are not equally spaced.. Is it possible to force them to be equally spaced? Thank you > > plot(rgdp/rgdp(end-4),rp,'.'); > lsline; > xlabel('GDP per capita (US=1)'); > ylabel('Non-agricultural value added per worker rel. to Agricultural'); > axis([1/64 3/2 0 10]); > xtick = [1/64,1/32,1/16,1/8 ,1/4,1/2,1,3/2]; > xtick_label = ['1/64';'1/32';'1/16';'1/8 ';'1/4 ';'1/2 ';'1 ';'3/2 ']; > > set(gca','XTick',xtick); > set(gca,'XTicklabel',xtick_label); The ticks are a geometric progression, so to get them equispaced, you must make the x-axis log either by using semilogx instead of plot or: set(gca,'XScale','log')
|
Pages: 1 Prev: Displaying voxels, plenty of them Next: add edge midpts to delaunayTri mesh |