MATLAB Answers

scatter plot color setting.

2 views (last 30 days)
Matt on 19 Sep 2014
Edited: per isakson on 20 Sep 2014
In the matlab code below, I have scattered points. How can i choose different scatterd fonts like * and + and set the color of theses scattered points.
[ax, h1, h2] = plotyy(x,y1,Ax,y2,'scatter');
line(x,y2,'Parent',ax(2) )
Thank you very much!
  1 Comment
per isakson
per isakson on 19 Sep 2014
The "A" in Ax is that a typo?

Sign in to comment.

Answers (1)

per isakson
per isakson on 19 Sep 2014
Those simple circles are patch objects. (There is a lot to read about patches in the documentation.)
ch1 = get( h1, 'children' )
set( ch1, 'MarkerEdgeColor', [1,0,0] )
per isakson
per isakson on 19 Sep 2014
Execute these two lines after your script. One series of circles will turn red. That is an answer to "set the color of theses scattered points.".
Secondly, I invited you to search the documentation on patch and find out how to change the shape of the "markers".

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!