Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/KPMtools/set_xtick_label_demo.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 |
wolffd@0 | 2 % Generate some test data. Assume that the X-axis represents months. |
wolffd@0 | 3 x = 1:12; |
wolffd@0 | 4 y = 10*rand(1,length(x)); |
wolffd@0 | 5 |
wolffd@0 | 6 % Plot the data. |
wolffd@0 | 7 h = plot(x,y,'+'); |
wolffd@0 | 8 |
wolffd@0 | 9 % Add a title. |
wolffd@0 | 10 title('This is a title') |
wolffd@0 | 11 |
wolffd@0 | 12 % Set the X-Tick locations so that every other month is labeled. |
wolffd@0 | 13 Xt = 1:2:11; |
wolffd@0 | 14 Xl = [1 12]; |
wolffd@0 | 15 set(gca,'XTick',Xt,'XLim',Xl); |
wolffd@0 | 16 |
wolffd@0 | 17 % Add the months as tick labels. |
wolffd@0 | 18 months = ['Jan'; |
wolffd@0 | 19 'Feb'; |
wolffd@0 | 20 'Mar'; |
wolffd@0 | 21 'Apr'; |
wolffd@0 | 22 'May'; |
wolffd@0 | 23 'Jun'; |
wolffd@0 | 24 'Jul'; |
wolffd@0 | 25 'Aug'; |
wolffd@0 | 26 'Sep'; |
wolffd@0 | 27 'Oct'; |
wolffd@0 | 28 'Nov'; |
wolffd@0 | 29 'Dec']; |
wolffd@0 | 30 |
wolffd@0 | 31 set_xtick_label(months(1:2:12, :), 90, 'xaxis label'); |
wolffd@0 | 32 |
wolffd@0 | 33 |
wolffd@0 | 34 |
wolffd@0 | 35 if 0 |
wolffd@0 | 36 |
wolffd@0 | 37 |
wolffd@0 | 38 % Generate some test data. Assume that the X-axis represents months. |
wolffd@0 | 39 x = 1:8; |
wolffd@0 | 40 y = 10*rand(1,length(x)); |
wolffd@0 | 41 |
wolffd@0 | 42 % Plot the data. |
wolffd@0 | 43 h = plot(x,y,'+'); |
wolffd@0 | 44 |
wolffd@0 | 45 S = subsets(1:3); |
wolffd@0 | 46 str = cell(1,8); |
wolffd@0 | 47 for i=1:2^3 |
wolffd@0 | 48 str{i} = num2str(S{i}); |
wolffd@0 | 49 end |
wolffd@0 | 50 set_xtick_label(str); |
wolffd@0 | 51 |
wolffd@0 | 52 end |