Prev: mvncdf
Next: How to debug a cell?
From: Ken on 23 Mar 2010 19:53 I am kinda stuck here... below is my matlab code: figure hold on ax1 = gca; hl1 = line(x,y,'Color','b'); set(ax1,'XColor','b','YColor','b'); ax2 = axes('Position',get(ax1,'Position'),... 'XAxisLocation','top',... 'YAxisLocation','right',... 'Color','none',... 'XColor','k','YColor','k'); hl2 = line(x,z,'Color','k','Parent', ax2); hold off figure hold on; [ax, h1, h2] = plotyy(x,y, x,z); hold off; but when I like to shoe a couple points on both graphs with '*', I can't get it working? any suggestions?
From: Ken on 23 Mar 2010 20:14 This is kinda urgent!!!! I appreciate if anyone can help me with it immediately... Many thanks and appreciated!!! -ken "Ken " <kk61(a)cornell.edu> wrote in message <hobk91$180$1(a)fred.mathworks.com>... > I am kinda stuck here... > below is my matlab code: > > figure > hold on > ax1 = gca; > hl1 = line(x,y,'Color','b'); > > set(ax1,'XColor','b','YColor','b'); > > ax2 = axes('Position',get(ax1,'Position'),... > 'XAxisLocation','top',... > 'YAxisLocation','right',... > 'Color','none',... > 'XColor','k','YColor','k'); > > hl2 = line(x,z,'Color','k','Parent', ax2); > hold off > > figure > hold on; > [ax, h1, h2] = plotyy(x,y, x,z); > hold off; > > but when I like to shoe a couple points on both graphs with '*', I can't get it working? any suggestions? > >
From: Walter Roberson on 23 Mar 2010 22:02 Ken wrote: > This is kinda urgent!!!! I appreciate if anyone can help me with it > immediately... Many thanks and appreciated!!! > > -ken > > "Ken " <kk61(a)cornell.edu> wrote in message > <hobk91$180$1(a)fred.mathworks.com>... >> I am kinda stuck here... >> below is my matlab code: >> >> figure >> hold on >> ax1 = gca; >> hl1 = line(x,y,'Color','b'); >> >> set(ax1,'XColor','b','YColor','b'); >> >> ax2 = axes('Position',get(ax1,'Position'),... >> 'XAxisLocation','top',... >> 'YAxisLocation','right',... >> 'Color','none',... >> 'XColor','k','YColor','k'); >> >> hl2 = line(x,z,'Color','k','Parent', ax2); >> hold off >> figure >> hold on; >> [ax, h1, h2] = plotyy(x,y, x,z); >> hold off; >> but when I like to shoe a couple points on both graphs with '*', I >> can't get it working? any suggestions? Ambiguous wording. You have four graphs, so speaking about adding points to "both graphs" leaves us confused about what you are doing. Usually you do not use "hold on" until after you have done the first graph, because the first graph establishes the xlim and ylim properties; when you "hold on" before doing the graph, xlim and ylim get frozen at the default values, with the result that not everything might be shown, or the aspect ratio might not be what you want. In general, to add points, I would suggest you use scatter(ax1, pointx, pointy, '*') scatter(ax(1), pointx, pointy, '*')
From: Ken on 24 Mar 2010 06:08 Hi Walter, Thanks. This doesn't work as scatter do generate another plot with the points. I want to generate them on the same plot. It has to be on one of the two plots, either on plotyy or line graph... don't have to be on both. I put them both since I didn't get any of them working... Let me know if you got a solution for it asap... Thanks again, kind regards, -ken Walter Roberson <roberson(a)hushmail.com> wrote in message <hobrrc$nst$1(a)canopus.cc.umanitoba.ca>... > Ken wrote: > > This is kinda urgent!!!! I appreciate if anyone can help me with it > > immediately... Many thanks and appreciated!!! > > > > -ken > > > > "Ken " <kk61(a)cornell.edu> wrote in message > > <hobk91$180$1(a)fred.mathworks.com>... > >> I am kinda stuck here... > >> below is my matlab code: > >> > >> figure > >> hold on > >> ax1 = gca; > >> hl1 = line(x,y,'Color','b'); > >> > >> set(ax1,'XColor','b','YColor','b'); > >> > >> ax2 = axes('Position',get(ax1,'Position'),... > >> 'XAxisLocation','top',... > >> 'YAxisLocation','right',... > >> 'Color','none',... > >> 'XColor','k','YColor','k'); > >> > >> hl2 = line(x,z,'Color','k','Parent', ax2); > >> hold off > >> figure > >> hold on; > >> [ax, h1, h2] = plotyy(x,y, x,z); > >> hold off; > >> but when I like to shoe a couple points on both graphs with '*', I > >> can't get it working? any suggestions? > > Ambiguous wording. You have four graphs, so speaking about adding points > to "both graphs" leaves us confused about what you are doing. > > Usually you do not use "hold on" until after you have done the first > graph, because the first graph establishes the xlim and ylim properties; > when you "hold on" before doing the graph, xlim and ylim get frozen at > the default values, with the result that not everything might be shown, > or the aspect ratio might not be what you want. > > In general, to add points, I would suggest you use > scatter(ax1, pointx, pointy, '*') > scatter(ax(1), pointx, pointy, '*') >
From: Ken on 24 Mar 2010 06:36
This is kinda bothering me a lot, i appreciate if someone can help me as soon as possible... thanks, "Ken " <kk61(a)cornell.edu> wrote in message <hocoa4$2pl$1(a)fred.mathworks.com>... > Hi Walter, > > Thanks. This doesn't work as scatter do generate another plot with the points. > I want to generate them on the same plot. It has to be on one of the two plots, either on plotyy or line graph... don't have to be on both. I put them both since I didn't get any of them working... > > Let me know if you got a solution for it asap... > > Thanks again, > > kind regards, > > -ken > > Walter Roberson <roberson(a)hushmail.com> wrote in message <hobrrc$nst$1(a)canopus.cc.umanitoba.ca>... > > Ken wrote: > > > This is kinda urgent!!!! I appreciate if anyone can help me with it > > > immediately... Many thanks and appreciated!!! > > > > > > -ken > > > > > > "Ken " <kk61(a)cornell.edu> wrote in message > > > <hobk91$180$1(a)fred.mathworks.com>... > > >> I am kinda stuck here... > > >> below is my matlab code: > > >> > > >> figure > > >> hold on > > >> ax1 = gca; > > >> hl1 = line(x,y,'Color','b'); > > >> > > >> set(ax1,'XColor','b','YColor','b'); > > >> > > >> ax2 = axes('Position',get(ax1,'Position'),... > > >> 'XAxisLocation','top',... > > >> 'YAxisLocation','right',... > > >> 'Color','none',... > > >> 'XColor','k','YColor','k'); > > >> > > >> hl2 = line(x,z,'Color','k','Parent', ax2); > > >> hold off > > >> figure > > >> hold on; > > >> [ax, h1, h2] = plotyy(x,y, x,z); > > >> hold off; > > >> but when I like to shoe a couple points on both graphs with '*', I > > >> can't get it working? any suggestions? > > > > Ambiguous wording. You have four graphs, so speaking about adding points > > to "both graphs" leaves us confused about what you are doing. > > > > Usually you do not use "hold on" until after you have done the first > > graph, because the first graph establishes the xlim and ylim properties; > > when you "hold on" before doing the graph, xlim and ylim get frozen at > > the default values, with the result that not everything might be shown, > > or the aspect ratio might not be what you want. > > > > In general, to add points, I would suggest you use > > scatter(ax1, pointx, pointy, '*') > > scatter(ax(1), pointx, pointy, '*') > > |