PLot two cluster plot

5 views (last 30 days)
sm m
sm m on 26 Jul 2015
Edited: sm m on 26 Jul 2015
I want to get a cluster plot as I would have 2 set of values One set which falls as positive set i.e y1 and the other set of values which fall in negative set i.e y2
My code:
> y1 = [11.0 10.8 11.0 11.10 11.9 9.9] ;
>> y2 = [14.0; 16.8; 18.0; 19.10; 21.9; 29.9] ;
>> figure
>> plot(y1,'ok','MarkerFaceColor','k')
>> hold on
>> plot(y2,'ok','MarkerFaceColor','r')
This works and i get a plot like this fig attached
However i am looking for something like getting two clusters against two values on x axis ie y1 and y2
and so i define the names for y1 and y2 and I try to plot them
names = {'Postive =y1' 'Negative =y2'};
plot(names,y1,'ok','MarkerFaceColor','k')
hold on
set(gca,'xtick',[1:2],'xticklabel',names)
plot(names,y1,'ok','MarkerFaceColor','k')
I still get numbers on my x axis whereas I want names on x axis

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!