Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
svmtrain plot design

Subject: svmtrain plot design

From: Paul

Date: 20 Mar, 2013 00:03:13

Message: 1 of 3

Hello community,
i have calculated the support vector machines with "svmtrain".Everything works well but i have a problem with the design of my plot.If i change the marker, then there is just a overlay above the original markers and the legend entry is not changed to the new marker design.Can anybody give me a solution for my problem?

a = [1;4;3;2;4;5;6;7;9;3];
b = [3;1;3;1;5;6;3;7;8;1];
c = [1;3;5;2;5;6;6;8;9;2];
d = [2;4;6;3;2;6;4;8;6;7];

x(1:10,1)=a;
x(11:20,1)=b;
x(1:10,2)=c;
x(11:20,2)=d;

x=double(x);

col = [0 0 0];
cold = [0.5 0.5 0.5];

svmStruct=svmtrain(x,textdata,'showplot',true);
hold on
plot (a,c,'.','color',col,'MarkerSize',5,'MarkerEdgeColor',col,'MarkerFaceColor',col);
hold on
plot (b,d,'.','color',cold,'MarkerEdgeColor',cold,'MarkerFaceColor',cold);
hold on legend ('change','no-change');
grid on

Thank you and best regards, Paul

Subject: svmtrain plot design

From: Alan_Weiss

Date: 20 Mar, 2013 12:56:40

Message: 2 of 3

On 3/19/2013 8:03 PM, Paul wrote:
> Hello community,
> i have calculated the support vector machines with
> "svmtrain".Everything works well but i have a problem with the design
> of my plot.If i change the marker, then there is just a overlay above
> the original markers and the legend entry is not changed to the new
> marker design.Can anybody give me a solution for my problem?
>
> a = [1;4;3;2;4;5;6;7;9;3];
> b = [3;1;3;1;5;6;3;7;8;1]; c = [1;3;5;2;5;6;6;8;9;2];
> d = [2;4;6;3;2;6;4;8;6;7];
>
> x(1:10,1)=a;
> x(11:20,1)=b;
> x(1:10,2)=c;
> x(11:20,2)=d;
>
> x=double(x);
>
> col = [0 0 0];
> cold = [0.5 0.5 0.5];
>
> svmStruct=svmtrain(x,textdata,'showplot',true);
> hold on
> plot
> (a,c,'.','color',col,'MarkerSize',5,'MarkerEdgeColor',col,'MarkerFaceColor',col);
> hold on
> plot
> (b,d,'.','color',cold,'MarkerEdgeColor',cold,'MarkerFaceColor',cold);
> hold on legend ('change','no-change');
> grid on
>
> Thank you and best regards, Paul

I think you need to play around with the visibility of the legend and
figures. Something like this (may not work completely, but something
like it should):

% Set up your data, then:
svmStruct=svmtrain(x,textdata,'showplot',true);
set(svmStruct.FigureHandles{2},'Visible','off') % gets rid of data point
markers
legend_handle = legend;
set(legend_handle,'Visible','off') % gets rid of legend
hold on
% Do your plotting and stuff here, including your legend statement,
without any other hold statements
hold off

Alan Weiss
MATLAB mathematical toolbox documentation

Subject: svmtrain plot design

From: Paul

Date: 20 Mar, 2013 15:01:09

Message: 3 of 3

Alan_Weiss <aweiss@mathworks.com> wrote in message <kicbm8$7ae$1@newscl01ah.mathworks.com>...
> On 3/19/2013 8:03 PM, Paul wrote:
> > Hello community,
> > i have calculated the support vector machines with
> > "svmtrain".Everything works well but i have a problem with the design
> > of my plot.If i change the marker, then there is just a overlay above
> > the original markers and the legend entry is not changed to the new
> > marker design.Can anybody give me a solution for my problem?
> >
> > a = [1;4;3;2;4;5;6;7;9;3];
> > b = [3;1;3;1;5;6;3;7;8;1]; c = [1;3;5;2;5;6;6;8;9;2];
> > d = [2;4;6;3;2;6;4;8;6;7];
> >
> > x(1:10,1)=a;
> > x(11:20,1)=b;
> > x(1:10,2)=c;
> > x(11:20,2)=d;
> >
> > x=double(x);
> >
> > col = [0 0 0];
> > cold = [0.5 0.5 0.5];
> >
> > svmStruct=svmtrain(x,textdata,'showplot',true);
> > hold on
> > plot
> > (a,c,'.','color',col,'MarkerSize',5,'MarkerEdgeColor',col,'MarkerFaceColor',col);
> > hold on
> > plot
> > (b,d,'.','color',cold,'MarkerEdgeColor',cold,'MarkerFaceColor',cold);
> > hold on legend ('change','no-change');
> > grid on
> >
> > Thank you and best regards, Paul
>
> I think you need to play around with the visibility of the legend and
> figures. Something like this (may not work completely, but something
> like it should):
>
> % Set up your data, then:
> svmStruct=svmtrain(x,textdata,'showplot',true);
> set(svmStruct.FigureHandles{2},'Visible','off') % gets rid of data point
> markers
> legend_handle = legend;
> set(legend_handle,'Visible','off') % gets rid of legend
> hold on
> % Do your plotting and stuff here, including your legend statement,
> without any other hold statements
> hold off
>
> Alan Weiss
> MATLAB mathematical toolbox documentation

Hello,
I tried the visibility options but this had not led to success.I found a solution for my own.The plot command of the "svmtrain"-file need access to the "svmplotdata" and and I've edited this file and thereby reset the default settings.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us