displaying time on plot
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
davit petraasya
am 20 Mär. 2016
Kommentiert: davit petraasya
am 24 Mär. 2016
Hi Does anyone know how to display points time on plot? I have 15 points(15 x and 15 y) and 15 different years(1980,1982,1983,...) corresponding to the points. I can plot the point like plot(x,y,'.r').How I may display the years of each point on plot?
Thanks a lot!
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 20 Mär. 2016
Use the text() function. There are a number of date and time functions that you might want to use in conjunction with sprintf() to create a string to display on your graph at some (x,y) location with text().
Weitere Antworten (1)
Star Strider
am 20 Mär. 2016
If you want to display all the years on the x-axis, use the set function:
For example:
x = [1980 1982 1983 1986 1987];
y = rand(1, 5);
figure(1)
plot(x, y)
set(gca, 'XTick',x)
grid
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!