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 Comments

Do you want to know how to make the scroll bar or how to put text on the plot?
So basically, I need the wave heights next to the dots. But since at any given time, the wave height is a certain value for each dot (location), I want to put a scroll bar on the figure so that I can slide the bar and have the wave heights change according to what time it is.
Do you have a draft of a GUI and some data to play with?
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

Sign in to comment.

Answers (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.

Products

Asked:

on 1 Jul 2014

Commented:

dpb
on 8 Jul 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!