Re: Plot to a figure from a function



Hi David,

The plot function expects an axes handle, not a figure handle. Try the
following:

f = figure;
a = axes;

MyFunction(a, ...);

Inside the function:

plot(a, ... );

I hope that helps.

Thanks.

Rick




"David Doria" <daviddoria@xxxxxxxxx> wrote in message
news:fdmcgt$1cj$1@xxxxxxxxxxxxxxxxxxxxx
in my script i do

h = figure;

then i have a loop which calls a function 'MyFunction' with

MyFunction(h(1), more_params)

the function definition for MyFunction is

function MyFunction(h, more_params)

inside MyFunction, i do

plot(h, ones(10))

and nothing(!) happens until after the program finishes
running, at which point i get a blank axis displayed

does it not work like this?

Thanks,

David


.



Relevant Pages

  • Labelling Figures
    ... Like labelling X axes, Y axes, and main title for each figure that you ... display using plot function. ... Seeking your guidance ... Nishant ...
    (sci.stat.math)
  • Re: Place textbox in figure (not in axes)?
    ... my plot function is used in a Matlab function which I call several times to plot several sets of data into it. ... If I add a second set of axes to the figure I have trouble finding back into the first axes object when I call my function a second time. ... I can set the axes position for the data I am plotting explicitly but there still seems to be a slight offset, every time I call my function causing everything to be overlapped. ...
    (comp.soft-sys.matlab)
  • Re: Matlab GUI: Define Region of interest
    ... but do not get an event when clicking on the axes object. ... I think you may be calling a plot function that overwrites the ... PS - there is no ButtonUpFcn for objects, only the WindowButtonUpFcn ...
    (comp.soft-sys.matlab)
  • Re: about axes(......)
    ... because AXES creates a NEW axis... ... My thought is that I want to creat a new axes with all properties are set up on the begining. ... So I don't need to make any change to the figure after I run the plot function. ... But It doesn't keep the 'xcolor' after I run the code. ...
    (comp.soft-sys.matlab)