Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding text to geoshow

364 views
Skip to first unread message

August 2wrcozp0

unread,
Oct 28, 2011, 8:15:30 AM10/28/11
to
Hej!

I have a problem with adding text to a geoshow figure, perhaps anyone could help me?

The following plot works perfectly fine, where B is gridded data points:
geoshow (lat,lon,B);

However, when I want to add text:
geoshow (lat,lon,B);
text (lat1,lon1,'help');

The text ends up below the graph.

How do I move the text to the front, so I can see it??

Thanks in advance!

Rob Comer

unread,
Oct 28, 2011, 6:16:30 PM10/28/11
to
"August 2wrcozp0" <august.a...@itm.su.se> wrote in message <j8e6d2$vv$1...@newscl01ah.mathworks.com>...
> The following plot works perfectly fine, where B is gridded data points:
> geoshow (lat,lon,B);
>
> However, when I want to add text:
> geoshow (lat,lon,B);
> text (lat1,lon1,'help');
>
> The text ends up below the graph.

Do you mean that the text is visible, but it appears in the wrong place? If you are plotting in a map axes (created with axesm, worldmap, or usamap), try using textm instead of text. If not, you may need to swap lat1 and lon1 in your call to text.

Rob Comer
Mapping Toolbox Development
MathWorks

August 2wrcozp0

unread,
Oct 31, 2011, 12:14:13 PM10/31/11
to
Thanks for your reply Rob!

I actually tried with both text and textm, but wrote text here by mistake.
Textm plots the text at the right spot. I can see that, since when I set facealpha to 0.2 for the geoshow comand I see the text. But when facealpha is set to 1, the text is no longer visible. Somehow the text must end up in a lower level or something like that. How do I move it up?

Kelly Kearney

unread,
Oct 31, 2011, 3:38:12 PM10/31/11
to
"August 2wrcozp0" <august.a...@itm.su.se> wrote in message <j8mhgl$65q$1...@newscl01ah.mathworks.com>...
> Thanks for your reply Rob!
>
> I actually tried with both text and textm, but wrote text here by mistake.
> Textm plots the text at the right spot. I can see that, since when I set facealpha to 0.2 for the geoshow comand I see the text. But when facealpha is set to 1, the text is no longer visible. Somehow the text must end up in a lower level or something like that. How do I move it up?


Try uistack(h, 'top'), where h is the handle of your text object.

-Kelly

August 2wrcozp0

unread,
Nov 1, 2011, 4:47:27 AM11/1/11
to
It appears that this problem is related to the display of the figure in matlab, rather than the figure itself. If I save the image as a PDF file, the text appears in the right position, ontop of the geoshow grid. Strange....

August 2wrcozp0

unread,
Nov 1, 2011, 5:37:10 AM11/1/11
to
However, when I use contourm:
contourm (lat,lon,B);
textm(lat1,lon1,'help');
The problem is remains. I am wondering why plotting maps is different from the normal plotting procedures?
Using:
contour(lon,lat,B);
text(lon1,lat1,'help');
moves the text ontop without any special tricks....

Felipe

unread,
Nov 28, 2011, 12:59:09 AM11/28/11
to
"August 2wrcozp0" <august.a...@itm.su.se> wrote in message <j8oek6$d5a$1...@newscl01ah.mathworks.com>...
%The map axes
R=worldmap(latlim, lonlim);
%plot something
geoshow(R,map,RefMap,'DisplayType','texturemap')
did you try?
textm(lat,lon,'help','Color',[1 1 1],...
'FontSize',9,'FontWeight','bold',...
'HorizontalAlignment','center')

Rob Comer

unread,
Nov 28, 2011, 9:40:08 PM11/28/11
to
"August 2wrcozp0" <august.a...@itm.su.se> wrote in message <j8oek6$d5a$1...@newscl01ah.mathworks.com>...
I'm not seeing this problem -- with either geoshow or contourm, but I don't know what your inputs (lat, lon, B, lat1, and lon1) are.
0 new messages