Is there a way of making a scatter plot where all the points are different markers and colours?
Ältere Kommentare anzeigen
Hi,
I am pretty much a beginner here. I am trying to make a scatter plot from data that are currently in an excel spreadsheet. I have 5 pairs of column (representing 5-years) with 6 rows in each (representing 6-months). The first column of each pair shows a temperature, and the second column precipitation. What I would like is to have the data from the 5 years represented by different colours, and at the same time, have a different markers for each months. So, one colour per year (total of 5 colours) and one marker per month (total of 6 different marker) Is this something that can be done easily? The only way I could do this with my limited knowledge of Matlab, would be to reorganize the data and do individual scatter plots with hold on hold off function. There must be an easier way...?
Thanks
2 Kommentare
Brendan Hamm
am 6 Aug. 2015
Bearbeitet: Brendan Hamm
am 6 Aug. 2015
The color can be done easily as the scatter() function takes this as an input argument. So if you have a vector representing the year of the corresponding data pass this in for the 4th input argument:
scatter(x,y,a,c)
A scatter plot will always plot the same markers though, so the easiest way here is to do this in a for loop with the hold on as you mention.
I would be happy to make an example of this if you mention how the data is store in MATLAB. Is it in a table, a matrix, several matrices? Are the dates represented as strings, vectors, datetimes or datenums? Which version of MATLAB are you using?
Ali
am 29 Okt. 2017
if true
--------------------------------------------------- code start
This is an example for your case
Input is "Input_Data", two dimension matrix
Marker_Counter=1;
figure6=figure;
Markers = {'+','o','*','x','v','d','^','s','>','<'};
for i=1:10:size(Input_Data,1)
TPR=Input_Data(i:i+9,7);
FPR=Input_Data(i:i+9,8);
plot(FPR,TPR,strcat('-',Markers{Marker_Counter}));
Marker_Counter=Marker_Counter+1;
hold on
end
plot([0.5 1],[0.5 1],'--');
legend('Minpts = 100','Minpts = 200','Minpts = 300','Minpts = 400','Minpts = 500','Minpts = 600','Minpts = 700','Minpts = 800','Minpts = 900','Minpts = 1000','','Location','SouthEast');
xlabel('FPR or (1-Specificity)','FontSize',12,'FontWeight','bold'); ylabel('TPR or Spensitivity)','FontSize',12,'FontWeight','bold');
title('ROC Space');
close(gcf);
-------------------------------------------- code end
end
--------------------------------------- picture link preview

Akzeptierte Antwort
Weitere Antworten (1)
Kategorien
Mehr zu Lengths and Angles finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!