Prev: problem with dicomwrite
Next: integrate and fire model
From: James on 4 Apr 2010 11:46 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <2e7016b6-346f-4f93-a6f2-930b7dc55a76(a)l37g2000vbd.googlegroups.com>... > James: > You might want to take a look at this GUIDE template: > http://www.mathworks.com/matlabcentral/fileexchange/24224 > > You can place an axes on there in GUIDE with some rough appearance, > and then do finer tweaks in the code if you wish. In that case, you > wouldn't the axes command to create a NEW axes, you'd just use your > existing axes (with its existing tag, e.g. handles.axesPlot) and then > tweak its settings with the set() function, e.g.: > > set(handles.axesPlot, 'XGrid', 'on'); > > or whatever... > > I often have two on my GUIs, handles.axesPlot, and handles.axesImage, > and sometimes handles.axesHistogram. ImageAnalyst, Thanks for the assistance. I have already created an axes in GUIDE, and I would like to perform the tweaking of the axes from inside the code as you mentioned. So since my axes tag is "figure" I would use handles.figure and similarly set(handles.figure, 'XGrid','on'); etc... Is this correct? So basically I will create all of the properties of the plot using similar set(handles.figure, ............); Thanks
From: ImageAnalyst on 4 Apr 2010 12:00 Yes, that's correct, although I would choose a different tag name than "figure" because I always like to avoid reserved MATLAB-built-in names for my variable and control names. I typically use the names like I told you. They're good because they're descriptive and they identify the control as an axes, which it is. You've called it figure, which it's not, and conflicts with the reserved word "figure" - bad practice. I typically call the main GUI that contains all the various controls (axes, listboxes, checkboxes, pushbuttons, etc.) "figMainWindow" because again, it's descriptive and identifies it as a figure. I'll preface other controls with the type of control that they are, eg, lstXXXXX, btnXXXXXX, chkXXXXXX, sldXXXXXX, radXXXXXX, etc. It helps me keep things organized and helps me know what something is when I refer to it in the code. When you want to switch focus to one of the axes on your GUI, you can call axes(): axes(handles.axesPlot); % Switch gca to axesPlot. % Do stuff like plotting. axes(handles.axesImage); % Switch gca to axesImage. % Do stuff like display an image. It will now show up in axesImage instead of axesPlot.
From: James on 4 Apr 2010 17:19 ImageAnalyst, thanks for your help. I'll try to figure this out later on this evening and I'll post the results asap.
From: James on 5 Apr 2010 19:14 Ok so here's where I'm at, I have added the following to the opening_Fcn set(handles.AxesPlot,'XGrid', 'on'); set(handles.AxesPlot,'YGrid', 'on'); set(handles.AxesPlot,'Color',[0 0 0]); set(handles.AxesPlot,'YColor', 'b'); set(handles.AxesPlot,'XColor', 'b'); and it is approximately the look I am going for. So now I am attempting to plot my data however it isn't. I put this code set(handles.AxesPlot,xz,yz,'Marker','*','LineWidth',2.0,'Color',[0 1 0]); in the opening_Fcn however I'm getting an error and it's with the term 'Marker'. This is how I have created the "dot" on the plot outside of the gui. What should I do about this? Also I'm working on the actual plot commands which are in my receive button function. I wrote these lines set(handles.AxesPlot,'YData',yz,'XData',xz); set(handles.AxesPlot,'Visible','on'); however I'm not seeing anything on the graph. I'm not sure if this is because of the marker issue, or because these aren't even the correct commands. Let me know if you have any ideas. Thanks
From: James on 5 Apr 2010 19:35
Ok so here's where I'm at, I have added the following to the opening_Fcn set(handles.AxesPlot,'XGrid', 'on'); set(handles.AxesPlot,'YGrid', 'on'); set(handles.AxesPlot,'Color',[0 0 0]); set(handles.AxesPlot,'YColor', 'b'); set(handles.AxesPlot,'XColor', 'b'); and it is approximately the look I am going for. So now I am attempting to plot my data however it isn't. I put this code set(handles.AxesPlot,xz,yz,'Marker','*','LineWidth',2.0,'Color',[0 1 0]); in the opening_Fcn however I'm getting an error and it's with the term 'Marker'. This is how I have created the "dot" on the plot outside of the gui. What should I do about this? Also I'm working on the actual plot commands which are in my receive button function. I wrote these lines set(handles.AxesPlot,'YData',yz,'XData',xz); set(handles.AxesPlot,'Visible','on'); however I'm not seeing anything on the graph. I'm not sure if this is because of the marker issue, or because these aren't even the correct commands. Let me know if you have any ideas. Thanks |