how to change the type of points for a plot
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have a plot with different points (corresponding to different trials) and I would like to modify the type of points in my plot.
I would like to put the number of each row of my table instead of a cross or a dot.
How can I do this kind of thing?
Thank you in advance.
0 commentaires
Réponse acceptée
Star Strider
le 9 Oct 2020
This should get you started:
x = 1:10; % Create Data
y = rand(size(x)); % Create Data
figure
plot(x, y, '.', 'Color','none') % Plot Colourless Dots
grid
datalbl = compose('%d',x); % Create Point Labels
text(x, y, datalbl, 'HorizontalAlignment','center', 'VerticalAlignment','middle') % ‘Plot’ Point Labels
.
4 commentaires
Star Strider
le 9 Oct 2020
My pleasure!
Try this:
x = rand(1,50); % Create ‘x’ Data
y = rand(size(x)); % Create ‘y’ Data
Trial = 1:numel(x); % Create ‘Trial’ Identifiers
figure
plot(x, y, '.', 'Color','none') % Plot Colourless Dots
grid
datalbl = compose('%d',Trial); % Create Point Labels
text(x, y, datalbl, 'HorizontalAlignment','center', 'VerticalAlignment','middle', 'FontSize',8) % ‘Plot’ Point Labels
It is a slight variation on my earlier code. It should be straightforward for you to adapt it to your data.
Experiment with it to get the result you want.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

