Move Longitude axis above scatterplot
Show older comments
Below is my matlab code that plots locations in a region of interest:
axis = geoaxes('basemap','satellite');
S = struct(axis);
hold on
lat = normrnd(29,0.2,[1,50]);
lon = normrnd(-90,0.2,[1,50]);
geoscatter(axis,lat,lon,30,'.')
The lat/lon data is dummy data for reproducibility purposes. I want to put the Longitude axis above the scatterplot because I will eventually put a colorbar right below the figure. When using the plot function, I understand the following line can put the X-axis on top of a plot:
set(gca,'XAxisLocation','top','YAxisLocation','left')
However, I can't find the same capabilitiy for the geoscatter function.
Any suggestions on how I can accomplish the my goal?
4 Comments
Joseph Cheng
on 2 Jun 2021
would like to test but an ugly way would to follow:
what was set here...
dpb
on 2 Jun 2021
Doesn't appear to be a visible property according to https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.decorator.geographicruler-properties.html
It's either kludge to draw manually as I presume the above link does or see if there is a useful hidden property that will let you get at the axes location property. Yair's FEX submission <Get undocumented object properties> is invaluable for finding these to workaround the warts.
Sometimes, however, there just isn't anything accessible, unfortunately, despite what see like obvious needs for users to be able to control I don't have necessary toolbox to try...
Debbie Green
on 3 Jun 2021
Edited: Debbie Green
on 3 Jun 2021
dpb
on 3 Jun 2021
Was afraid of that...why Mathworks has developed such a penchant recently for these opaque/dark graphics objects that hide useful/needed properties on the basis apparently of "Mother knows best!" is maddening and wastes untold numbers of users' hours more productively spent doing the research/productive work rather than fighting the toolset.
I'd suggest to submit enhancement request for the feature (and any others you run into along the way).
Accepted Answer
More Answers (0)
Categories
Find more on Interact with Maps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!