Plotyy on uipanel

Hello everyone!

I am trying to build a GUI for my modeling programm which calculates and plots models based on experimental data.

My question is if it it possible to build a uipanel object that can include an area where a plotyy function is applied. As of my knowledge, one must first create an “axes” handle to the panel in order to plot a subsueqeunt plot on the panel, however, the handle of the axes function does not work with the plotyy function (as it has two y axes). therefore my question, is there a way to implement a graphics window in the panel which is able to plot the plotyy function? or do i have to do it with the normal plot function instead?

Thank you very much!

plotyy works with a single axes input for me. It doesn’t seem to matter if that axes is inside an uipanel:

hp = uipanel ();
hax = axes (hp);
x = 0:0.1:2*pi;
y1 = sin (x);
y2 = exp (x - 1);
hax = plotyy (hax(1), x,y1, x-1,y2, @plot, @semilogy);

Which error are you seeing?

I get an invalid handle error, although it is the same handle , like in your example “hax”

Can you post an example that reproduces the error you are seeing?

okay this is a little hard to show, but I’ll try:

I have this panel + axes code:

f = figure;
p = uipanel ("title", "MWD Deconvolution Software", "position", [0 0 1 1], "parent", f);
ax_cc = axes(p, "position", [0.05 0.55 0.5 1]);
ax = axes(p, "position", [0.05 0 0.5 0.5]);

and with the “ax” handle i go into a function which calculates and plots a model based on the calculated fit using the semilogx function. this works fine and gets plotted in the ax handle as intented. But afterwards I have another function which calculates another model but it is based on the results of the first calculation/model. and for the second function I have the ax_cc handle which should be used for plotting for the second model (which happens now to be a plotyy plot) and during that plot the handle error occurs and the plotting doesn work. it appears to be a get: handle error, so the handle changes somehow during the process and isn’t there anymore?

ah now it works, i completely forgot that I had an hold off and clf clasue after the first calculation, that was the issue, sorry for that :see_no_evil: :see_no_evil: