From: John on

> You could write a new function 'my_plot()' which calls plot directly and
> then calls you other script.
>

Yes, I thought about that, but it's not optimal in terms of code
maintenance. I believe it is possible to make an
overload for the plot function? (just dont know how) Or add a listener which
will listen for a "plot event" and then call a function
defined by me once the plot function has completed??


From: John on
> Just out of curiosity, why are you trying to intercept PLOT calls? What
> are you trying to have your other script do when PLOT is called? Perhaps
> there's a way to do what you want directly (like if you want to change a
> property of the figure or axes, you could change the default property
> value and so have the figure/axes be created using the new default
> property value.)
>


I would like to add something to the functionality of plot() such that
whenever plot() is called
then the resulting figure will automatically be saved to a jpg-file. I have
a bunch of
scripts which I am not allowed to change. These scripts have several calls
to the plot function. So I
need to modify the behavior of the plot function (add some functionality to
it).