0
votes

I would like to scatter plot different sets of data points. Each point should have a different markerfacecolor, but within a given set, they would all have the same markeredgecolor.

I got this to work by looping over single scatter points individually, because markerfacecolor seems to only be able to take scalar points. The way I do it is that I loop through my data, and look for the appropriate color.

This works fine because I can define each point separately, but it becomes a problem when trying to set up the legend. It tries to list all the different points, but what I'd like is just an empty circle (markerfacecolor white or transparent), with each set having their specific markeredgecolor.

I hope this is clear enough. Thank you.

Mike

1
Could you please include your code here?Nematollah Zarmehi
Can you place some sample data as well as what code you've written so far so we have something to work with? If you could also provide the figure that you're producing, and then comment on what you want changed, that'll be helpful toorayryeng

1 Answers

0
votes

I've had luck using patches, setting 'FaceColor', 'EdgeColor' to 'none', 'MarkerEdgeColor' to 'flat' and setting the 'FaceVertexCData' to a Nx3 matrix where each row is a color corresponding the the points specified by you Nx1 'XData', 'YData' and 'ZData'.

h = patch('parent',gca,...
          'XData',x,...
          'YData',y,...
          'ZData',z,...
          'FaceColor','none',...
          'EdgeColor','none',...
          'MarkerFaceColor',faceColor,...
          'MarkerEdgeColor','flat',... This is what sets the Edge of each marker
          'FaceVertexCData',C) % C is a Nx3

I don't have access to Matlab at the moment, and Octave does not seem to have exactly the same functionality. Check out the Matlab patch properties documentation for more information.