From: Gonzalo on
Hello,

I have a GUI with 1) buttons, 2)pop-up menus and 3) a graph. I'm interested in plotting ONLY the graph without the the buttons or menus. Any help will be appreciated..

Thanks a lot,
From: neil on
"Gonzalo " <glpita(a)gmail.com> wrote in message <i0u284$ctj$1(a)fred.mathworks.com>...
> Hello,
>
> I have a GUI with 1) buttons, 2)pop-up menus and 3) a graph. I'm interested in plotting ONLY the graph without the the buttons or menus. Any help will be appreciated..
>
> Thanks a lot,

I would create a new figure using the copyobj function then use the print function to print it
plotH = plot(rand(3,100));
orignalAxes = gca;
uicontrol('parent',gcf)


%Create a ne figure
newFig = figure(2);
%Create a copy of the axes
newA = copyobj(orignalAxes,newFig);
%copy the plot across
newPlotH = copyobj(plotH,newA);

%Print the fig with the print function
print(newFig,'-dpng','image.png');
%close the new figure
close(newPlotH)

see the print doc for more info there.
My assumption is that you will have stored the figure, axes and line handles somewhere in your code.
From: Gonzalo on
Cool!,

It's working! I need to include the legend and the labels as well. How can I do that?

Thanks a lot

"neil " <neil.iain(a)gmail.com> wrote in message <i0u3jb$8c3$1(a)fred.mathworks.com>...
> "Gonzalo " <glpita(a)gmail.com> wrote in message <i0u284$ctj$1(a)fred.mathworks.com>...
> > Hello,
> >
> > I have a GUI with 1) buttons, 2)pop-up menus and 3) a graph. I'm interested in plotting ONLY the graph without the the buttons or menus. Any help will be appreciated..
> >
> > Thanks a lot,
>
> I would create a new figure using the copyobj function then use the print function to print it
> plotH = plot(rand(3,100));
> orignalAxes = gca;
> uicontrol('parent',gcf)
>
>
> %Create a ne figure
> newFig = figure(2);
> %Create a copy of the axes
> newA = copyobj(orignalAxes,newFig);
> %copy the plot across
> newPlotH = copyobj(plotH,newA);
>
> %Print the fig with the print function
> print(newFig,'-dpng','image.png');
> %close the new figure
> close(newPlotH)
>
> see the print doc for more info there.
> My assumption is that you will have stored the figure, axes and line handles somewhere in your code.
From: neil on
"Gonzalo " <glpita(a)gmail.com> wrote in message <i0u284$ctj$1(a)fred.mathworks.com>...
> Hello,
>
> I have a GUI with 1) buttons, 2)pop-up menus and 3) a graph. I'm interested in plotting ONLY the graph without the the buttons or menus. Any help will be appreciated..
>
> Thanks a lot,

You are going to have to do the same for all the objects you want to copy to the new figure. Make sure you store the handles when you create the objects.