plotting wave heights next to dots on a matlab plot
2 views (last 30 days)
Show older comments
“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 Comments
dpb
on 8 Jul 2014
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
Answers (1)
dpb
on 1 Jul 2014
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.
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps 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!