plotting data points with numerical y-axis and a string x-axis

  • Follow


I've got 8  1x2 vectors that I would like to plot. The first value in each vector belongs to the 'x90' category and the second value belongs to the 'xnovib' category.

I'd like the x-axis to have two "values".... namely 'x90' and and 'xnovib'. The y-axis will be scaled to the numerical inputs in each of the 8 vectors. How can I plot this with a line joining the two points from each vector considering that the y-axis is numerical and the x-axis is a string.

Thanks in advance
Farid
0
Reply Farid 4/29/2010 8:42:05 PM

"Farid Medleg" <farid.medleg@gmail.com> wrote in message <hrcqus$6o0$1@fred.mathworks.com>...
> I've got 8  1x2 vectors that I would like to plot. The first value in each vector belongs to the 'x90' category and the second value belongs to the 'xnovib' category.
> 
> I'd like the x-axis to have two "values".... namely 'x90' and and 'xnovib'. The y-axis will be scaled to the numerical inputs in each of the 8 vectors. How can I plot this with a line joining the two points from each vector considering that the y-axis is numerical and the x-axis is a string.
> 
> Thanks in advance
> Farid

one of the many solutions

     y=[
     1 2
     2 4
     1.5 4.4
     3 2.1
     ];
     x=repmat(1:2,size(y,1),1);
     cla;
     line(x.',y.',...
          'linewidth',2,...
          'color',[0,1,0]);
     set(gca,...
          'xlim',[0,3],...
          'xtick',1:2,...
          'xticklabel',{'A','zzz'},...     % <- your categories...
          'ylim',[0,5]);

us
0
Reply us 4/29/2010 9:15:22 PM


1 Replies
224 Views

(page loaded in 0.039 seconds)

Similiar Articles:













7/24/2012 11:55:43 AM


Reply: