plotting wave heights next to dots on a matlab plot
显示 更早的评论
“wavedata” is a 1X50 structure array, and each element is a field with a title and a value. (name, id, time, temperature, waveheight, lat, lon). I already plot the lat and long of the locations from the wavedata structure array as follows:
Latpos=[wavedata(1,:).lat];
Lonpos=[wavedata(1,:).lon];
plot(Lonpos,Latpos, ‘.’);
Now, how do I plot the wave height next to the dots on the plot so that it shows the dot and the wave height next to it?
The problem then becomes: since there are multiple wave heights over a 24 hour period, how do I make a scoll bar on the plot that allows me to scroll from time A to time B according to what time it was. (Then the wave height at each dot would change accordingly?)
Any help would be greatly appreciated. This is for my job not for school work.
5 个评论
Sara
2014-7-1
Do you want to know how to make the scroll bar or how to put text on the plot?
Michael Ant
2014-7-8
Michael Ant
2014-7-8
Sara
2014-7-8
Do you have a draft of a GUI and some data to play with?
dpb
2014-7-8
You can add a slider uicontrol to do the height variability it would seem?
doc uicontrol % example given for callback for a z-axis scaling
回答(1 个)
dpb
2014-7-1
You might look at
doc scatter
As for the labelling,
text(xx,y+dy,num2str(height,'%.2f'),'horizontal','center','vertical','lower')
will write the height values at x,y w/ a slight offset dy for the y direction to not place it directly on the point. Salt to suit...
I don't know how to build an automagic figure axis slider, sorry; I don't do GUIs. Maybe somebody else will chime in on that part.
类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!