<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/151000</link>
    <title>MATLAB Central Newsreader - specify parent map axes?</title>
    <description>Feed for thread: specify parent map axes?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 26 Jun 2007 12:53:19 -0400</pubDate>
      <title>specify parent map axes?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/151000#379682</link>
      <author>matt dash</author>
      <description>Hi all,&lt;br&gt;
I'm plotting lines on a map using linem and I would like to specify a&lt;br&gt;
particular map axes as the parent. I can accomplish this by preceding&lt;br&gt;
linem with something like:&lt;br&gt;
&lt;br&gt;
axes(maphandle)&lt;br&gt;
&lt;br&gt;
but if I instead try to specify the target map as a property pair&lt;br&gt;
within linem (by using ...'parent',maphandle...) i get the error:&lt;br&gt;
??? Error using ==&amp;gt; linem&lt;br&gt;
Not a map axes. Select a map axes or use AXESM to define one.&lt;br&gt;
&lt;br&gt;
I'd much rather use the second syntax since it's a lot faster...does&lt;br&gt;
anyone know why this doesnt work?&lt;br&gt;
&lt;br&gt;
ps,&lt;br&gt;
maphandle is the handle to an axes that I have turned into a map&lt;br&gt;
using the commands:&lt;br&gt;
&lt;br&gt;
axes(maphandle)&lt;br&gt;
handles.maxes=axesm(.......)&lt;br&gt;
&lt;br&gt;
(as far as I know it is also not possible to use property/value pairs&lt;br&gt;
to specify a target axes to the axesm command)</description>
    </item>
    <item>
      <pubDate>Tue, 26 Jun 2007 13:30:24 -0400</pubDate>
      <title>Re: specify parent map axes?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/151000#379688</link>
      <author>Kelly</author>
      <description>matt dash wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I'm plotting lines on a map using linem and I would like to specify&lt;br&gt;
&amp;gt; a&lt;br&gt;
&amp;gt; particular map axes as the parent. I can accomplish this by&lt;br&gt;
&amp;gt; preceding&lt;br&gt;
&amp;gt; linem with something like:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; axes(maphandle)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; but if I instead try to specify the target map as a property pair&lt;br&gt;
&amp;gt; within linem (by using ...'parent',maphandle...) i get the error:&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; linem&lt;br&gt;
&amp;gt; Not a map axes. Select a map axes or use AXESM to define one.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I'd much rather use the second syntax since it's a lot&lt;br&gt;
&amp;gt; faster...does&lt;br&gt;
&amp;gt; anyone know why this doesnt work?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ps,&lt;br&gt;
&amp;gt; maphandle is the handle to an axes that I have turned into a map&lt;br&gt;
&amp;gt; using the commands:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; axes(maphandle)&lt;br&gt;
&amp;gt; handles.maxes=axesm(.......)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; (as far as I know it is also not possible to use property/value&lt;br&gt;
&amp;gt; pairs&lt;br&gt;
&amp;gt; to specify a target axes to the axesm command)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&lt;br&gt;
Could you give a little more detail of the code you're using? I&lt;br&gt;
tried to see if I could replicate the error using a simple example,&lt;br&gt;
and haven't been able to. However, I'm definitely seeing some weird&lt;br&gt;
stuff. The following snippet runs without error, but linem seems to&lt;br&gt;
be getting confused with projections.&lt;br&gt;
&lt;br&gt;
load coast;&lt;br&gt;
f = figure;&lt;br&gt;
a1 = subplot(2,1,1);&lt;br&gt;
axes(a1);&lt;br&gt;
m1 = axesm('mercator');&lt;br&gt;
a2 = subplot(2,1,2);&lt;br&gt;
axes(a2);&lt;br&gt;
m2 = axesm('lambert');&lt;br&gt;
linem(lat, long, 'parent', a1, 'color', 'b');&lt;br&gt;
linem(lat, long, 'parent', a2, 'color', 'r');&lt;br&gt;
setm(m1, 'frame', 'on');&lt;br&gt;
&lt;br&gt;
I'll see if I can figure out what's going on in my code here.&lt;br&gt;
&lt;br&gt;
And to your other comment, yes, you're right that you can't directly&lt;br&gt;
specify a parent axis via axesm.&lt;br&gt;
setm(m2, 'frame', 'on');</description>
    </item>
    <item>
      <pubDate>Tue, 26 Jun 2007 14:24:44 -0400</pubDate>
      <title>Re: specify parent map axes?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/151000#379696</link>
      <author>matt dash</author>
      <description>here is a sample of my code, which is part of a pretty large gui&lt;br&gt;
(unfortunately the sample is also long... but it's pretty&lt;br&gt;
straightforward.) I think the reason your code works is that the&lt;br&gt;
correct subplot is already the target (it becomes the target when you&lt;br&gt;
create it), so the 'parent' in linem is redundant (why this matters,&lt;br&gt;
I dont know, but it looks like it does):&lt;br&gt;
&lt;br&gt;
thanks for your help!&lt;br&gt;
&lt;br&gt;
f=figure;&lt;br&gt;
handles.smallmapaxes=axes;&lt;br&gt;
set(handles.smallmapaxes,'position',[.05 .3 .4 .4]);&lt;br&gt;
handles.otheraxes=axes('position',[.55 .3 .4 .4]);&lt;br&gt;
&lt;br&gt;
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br&gt;
% make a little map&lt;br&gt;
axes(handles.smallmapaxes)&lt;br&gt;
&lt;br&gt;
handles.maxes=axesm('MapProjection','lambert','MapLatLimit',[10 65],&lt;br&gt;
'MapLonLimit',[-150 -42]);&lt;br&gt;
&lt;br&gt;
setm(gca,'FFaceColor',[0 0 .3]); %set ocean color&lt;br&gt;
framem;&lt;br&gt;
&lt;br&gt;
%sets axes to just focus on the usa...&lt;br&gt;
set(gca,'xlim',[-.35 .32])&lt;br&gt;
set(gca,'ylim',[.4 .9])&lt;br&gt;
&lt;br&gt;
%plot canada and mexico&lt;br&gt;
load coast&lt;br&gt;
geoshow(lat,long,'DisplayType','polygon','FaceColor',[.1 .1&lt;br&gt;
.1],'EdgeColor',[.8 .8 .8])&lt;br&gt;
clear lat long&lt;br&gt;
&lt;br&gt;
load conus.mat&lt;br&gt;
&lt;br&gt;
handles.usmap=geoshow(uslat,uslon,&lt;br&gt;
'DisplayType','polygon','FaceColor',[0 0 0], 'EdgeColor',[.8 .8 .8]);&lt;br&gt;
geoshow(statelat,statelon,'DisplayType','line','Color',[.5 .5 .5])&lt;br&gt;
geoshow(gtlakelat,gtlakelon, 'DisplayType','polygon','FaceColor',[0 0&lt;br&gt;
.3], 'EdgeColor',[.8 .8 .8])&lt;br&gt;
&lt;br&gt;
%% some sample data to plot&lt;br&gt;
A =[&lt;br&gt;
&lt;br&gt;
14 1393 18.439 65.984 40.64 73.779&lt;br&gt;
7 1474.7 30.194 97.67 42.364 71.005&lt;br&gt;
21 1321.2 30.194 97.67 40.64 73.779&lt;br&gt;
7 1474.7 42.364 71.005 30.194 97.67&lt;br&gt;
7 1521 42.364 71.005 39.858 104.67&lt;br&gt;
39 1077.4 42.364 71.005 26.072 80.153&lt;br&gt;
28 1087.7 42.364 71.005 26.536 81.755&lt;br&gt;
7 2065.2 42.364 71.005 36.08 115.15&lt;br&gt;
];&lt;br&gt;
%% plot some lines on map&lt;br&gt;
&lt;br&gt;
%somewhere along the line another axes gets made current:&lt;br&gt;
axes(handles.otheraxes)&lt;br&gt;
&lt;br&gt;
%now want to switch back and plot to the map:&lt;br&gt;
&lt;br&gt;
%% this works:&lt;br&gt;
%{&lt;br&gt;
axes(handles.smallmapaxes)&lt;br&gt;
&lt;br&gt;
for j=1:size(A,1)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;handles.currentroute(j)=linem([A(j,3) A(j,5)],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[-A(j,4) -A(j,6)],'Color',[.99 .60 .07],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'LineWidth',2,'hittest','off');&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
%}&lt;br&gt;
&lt;br&gt;
%% this doesnt:&lt;br&gt;
&lt;br&gt;
for j=1:length(A)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;handles.currentroute(j)=linem([A(j,3) A(j,5)],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[-A(j,4) -A(j,6)],'Color',[.99 .60 .07],...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'LineWidth',2,'hittest','off','parent',handles.smallmapaxes);&lt;br&gt;
end</description>
    </item>
    <item>
      <pubDate>Tue, 26 Jun 2007 17:11:01 -0400</pubDate>
      <title>Re: specify parent map axes?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/151000#379721</link>
      <author>Kelly</author>
      <description>matt dash wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; here is a sample of my code, which is part of a pretty large gui&lt;br&gt;
&amp;gt; (unfortunately the sample is also long... but it's pretty&lt;br&gt;
&amp;gt; straightforward.) I think the reason your code works is that the&lt;br&gt;
&amp;gt; correct subplot is already the target (it becomes the target when&lt;br&gt;
&amp;gt; you&lt;br&gt;
&amp;gt; create it), so the 'parent' in linem is redundant (why this&lt;br&gt;
&amp;gt; matters,&lt;br&gt;
&amp;gt; I dont know, but it looks like it does):&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; thanks for your help!&lt;br&gt;
&lt;br&gt;
Actually, the reason mine works is that I made both subplots map&lt;br&gt;
axes. So even though I had switched the focus to a different plot, I&lt;br&gt;
avoided the error meassage you found. But the bug was still&lt;br&gt;
manifesting itself by plotting the wrong projection.&lt;br&gt;
&lt;br&gt;
This does seem to be a bug in linem. If you look at line 129 of the&lt;br&gt;
linem code,&lt;br&gt;
&lt;br&gt;
[mstruct,msg] = gcm;&lt;br&gt;
&lt;br&gt;
you'll see it does grabs the mstruct data before it begins plotting.&lt;br&gt;
But instead of checking the axis you specified using the 'parent'&lt;br&gt;
property, it completely ignores this command and checks whatever the&lt;br&gt;
current axis is, and throws an error if this axis doesn't hold a map&lt;br&gt;
axis.&lt;br&gt;
&lt;br&gt;
I'd go ahead and report this bug to The Mathorks. To get it working&lt;br&gt;
properly, you'll probably have to modify linem to parse the inputs&lt;br&gt;
and look for a parent axis to feed to gcm in this line rather than&lt;br&gt;
always defaulting to the current one.&lt;br&gt;
&lt;br&gt;
-Kelly</description>
    </item>
    <item>
      <pubDate>Wed, 27 Jun 2007 12:17:31 -0400</pubDate>
      <title>Re: specify parent map axes?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/151000#379888</link>
      <author>matt dash</author>
      <description>ah, that clears things up... thanks a lot!</description>
    </item>
  </channel>
</rss>

