Question about PLOTTING over MAPS

I am using a code to generate the maps, but I'm still having a little trouble adding my own data. What I need is very simple, I have a data file with latitude, longitudes and the number of times that lightning struck on that location (Basically I need a density plot). Any comments will be very helpful.
Thank you, Diana

2 Comments

Do you need this to be on a map projection, or treating the world as flat is fine because lat and lon are really just X and Y to you?
Are you using the mapping toolbox?
do you know how to convert this to density, regardless of it being lat and lon?
I am using a map projection (m_proj function) basically yes the map is flat...I had to download and add all the maps library because I have the student version of matlab. And I just have the number of times that it lightning struck on a specific latitude and longitude. I have been able to plot a mark on the location of every strike but my problem is I don't know how to include the number of times in every location with a color bar for better view.

Sign in to comment.

Answers (1)

pointsize = 8;
scatter(lat(:), long(:), pointsize, numstrikes(:))
colorbar

12 Comments

Thank you for the suggestion, but I tried it and I think it crashed my routine. It still says "Busy" and it usually doesn't take that long. I located it inside of a for loop, do you think that might be affecting it?
It just finished and it only produced a blank page with a scale bar, any suggestions on what it may be wrong?
I have been moving the command around, and I realize that it either plots the map or plots the graph with the scattered points, but it doesn't plot the scatter points on the map. If you have any suggestions they are more than welcome. Thank you for your help.
Do you have a "hold on" command? You should.
Also if I recall correctly, there is a scatterm() in the mapping toolbox that can be used with map projection. You would still need "hold on" between the two plots.
I used the hold on command in every way that i could find, but still it only shows the map and the color bar. And I searched if there was a scatterm function but it doesn't find it so i don't think it has one. Thank you.
Walter Roberson
Walter Roberson on 17 Jul 2012
Edited: Walter Roberson on 17 Jul 2012
scatterm() does exist http://www.mathworks.com/help/toolbox/map/ref/scatterm.html . But possibly not in your version. Which version are you using?
I am not familiar with how the mapping toolbox draws the maps. Which drawing command are you using? I'm thinking that if that command is creating its own axes then one of the two axes would be on top, hiding the other one. A quick test for that would be to draw the scatter plot second, then set(gca, 'Color', 'none')
I have the student version so it doesnt have some of the maptools so I had to add the maps myself... I am using m_proj as the command to generate the map. I will try your suggestion now. Thanks.
It makes the back of the scatter plot clear, like expected but still it doesn't show on the map. Still is either the map or the plot. I moved the order around but nothing same thing. Thank you.
The Mapping Toolbox is an optional add-on product for the Student Version (just as it is for the other versions). It has the same functionality in the student version as in the professional version. See http://www.mathworks.com/academia/student_version/companion.html
If that is not what you are using, please indicate where you found the mapping software you are using.
I am using the maps that I found at this website: http://www2.ocgy.ubc.ca/~rich/private/mapug.html#p5.3 a lot of post here in Matlab central recommended them.
That package is a bit big for me to "sight read", and unfortunately I do not have access to MATLAB for the next bit of time (waiting for a new computer to arrive...)
I don't think I will be able to assist with that toolbox within a reasonable time.
No problem. I appreciate the help that you have given me so far.

Sign in to comment.

Asked:

on 17 Jul 2012

Community Treasure Hunt

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

Start Hunting!