How to get distinct markers for scatter plot while reading data from excel?
Show older comments
So, I'm reading certain data from excel and I need to give each group of data that is being read with a different marker... how do I do that? Kindly help.
As of now I'm doing this:
journeys = readtable('plot1.xlsx'); /
%selecting data--------------------
[journeys.x, journeys.y] = mfwdtran(mstruct, journeys.latitude, journeys.longitude); %transform the flights latitude and longitude
in = inpolygon(journeys.x, journeys.y, X, Y);
[groupid, flights] = findgroups(journeys.flight); %assign unique id to each flight and apply to rows of the table
isallin = splitapply(@all, in, groupid); %are ALL points of the flight in the polygon? logical output
selectedflights = flights(isallin); %list of flights where all points are in the polygon
selectedjourneys = journeys(ismember(journeys.flight, selectedflights), :); %portion of the table with only the selected data
%selecting data--------------
%lets try plotting-----
[sx, sy] = mfwdtran(mstruct, selectedjourneys.latitude, selectedjourneys.longitude);
color = selectedjourneys.flight;
scatter(sx,sy,[],color, 'Marker','+') %plotting all flights in between the ats route
Here all the data have one marker '+'
But I want to give distinct markers to each group based on the group id (as mentioned above)
1 Comment
KSSV
on 18 Apr 2019
Have a look on gscatter
Accepted Answer
More Answers (0)
Categories
Find more on Scatter Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!