-2

I want to plot two data (x1,y1)=(x,y) which x and y determine some points in space and (xx1,yy1)=(12,12) in the same plot in Matlab. I used below code but there is an error and it doesn't wor. Could anyone help?

  h = plot(x, y, '.g', 'MarkerSize', 10,12,12,'.r', 'MarkerSize', 15);

The complete code is as below.. I want to show a red big dot at the center of the video:

clear all
close all
l=25;
v=0.05;
dt=1;
r=1;
rr=25;
noise=(2.*pi).*.05;
nn=100;
set(gcf, 'doublebuffer', 'on', 'Color', 'k');
set(gca, 'Visible', 'off');
axis([0 l 0 l])
axis('square')
hold on
vidObj = VideoWriter('vicchemo1.avi');
open(vidObj);
x=rand(nn,1).*l;  %first possition
sara nj
  • 197
  • 1
  • 11
  • 2
    You can only use the `MarkerSize` attribute at the end of the `plot` call, so that means the `MarkerSize` of all points will have to be the same for one `plot` call. Therefore, split it up into multiple plot calls as you see in the answers below. – rayryeng Mar 07 '17 at 09:20
  • I can not. I added the complete code, I wanna make a video @rayryeng – sara nj Mar 07 '17 at 12:01

3 Answers3

1

Just below h = plot(x, y, '.g', 'MarkerSize', 10); on line 46. Add the following code:

xc = xlim/2;
yc = ylim/2;
plot(xc(2), yc(2), '.r', 'MarkerSize', 15);
jkazan
  • 1,149
  • 12
  • 29
0

I do not know if I understood your question properly or not. Below lines of code plot the data on same figure:

 plot(x, y, '.g', 'MarkerSize', 10)
 hold
 plot(12,12,'.r', 'MarkerSize', 15)
User1551892
  • 3,236
  • 8
  • 32
  • 52
-1

try something like this

hold on
plot(x, y, '.g', 'MarkerSize', 10)
plot(12,12,'.r', 'MarkerSize', 15)
hold off