COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

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

• Email
• 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.

Farid
```
 0
Reply Farid 4/29/2010 8:42:05 PM

See related articles to this posting

```"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
335 Views

Similar Articles

11/30/2013 2:04:19 PM
page loaded in 27128 ms. (0)