Send plot from one axes to another

14 vues (au cours des 30 derniers jours)
Álvaro Pauner Argudo
Álvaro Pauner Argudo le 20 Fév 2018
Is it possible to send a plot from one axes to another in order to see it bigger? I'm able to send the axes to a new figure, as follows:
if true
axes(handles.axes_cam1)
fig=figure;ax=axes;clf;
new_handle=copyobj(handles.axes_cam1,fig);
set(gca,'ActivePositionProperty','outerposition')
set(gca,'Units','normalized')
set(gca,'OuterPosition',[0 0 1 1])
set(gca,'position',[0.1300 0.1100 0.7750 0.8150])
end
But what I want is to send it to other axes that already exist (handles.axes_graficos) and I'm not able with copyobj maybe because I'm doing something wrong.
The target is to avoid repeating the code in the other axes.
  2 commentaires
Jan
Jan le 20 Fév 2018
Modifié(e) : Jan le 20 Fév 2018
Maybe you have a bug in your code using copyobj to copy the line object. Give us a chance to find it by posting the failing code, not some other code which runs successfully. Please explain "I'm not able with copyobj" with details: Do you get an error or does the result differ from your expectation?
What does "repeating the code in the other axes" mean? Code appears in the program text, not in an axes.
Álvaro Pauner Argudo
Álvaro Pauner Argudo le 20 Fév 2018
Sorry, I can't send you the code right now because I don't have here the computer where I'm programming this.
Excuse me for my explanation, I start again. I'm writing an SPC program using guide. I have one tab where you can see four SPC and plot new samples (as you can see in the attached image), but those plots are small, so I have created another tab with one bigger plot, in order to see the small plots better and, with a pop-up menu, select one of the four graphs. For doing this, I could "repeat the code in the other axes", I mean, extract the points plotted in the small axes and plot them in the big one, recycling some of my functions. As I want the same plot but bigger, I was wondering if using copyobj I could do this instead of writting more code lines.
My main problem is that I don't understand well how copyobj works, because I don't want to send the axes from one figure to another, what I want is to send the small axes to the big axes but both in the same figure.
Maybe I'm saying a lot of things that have no sense because I'm new using Matlab.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 20 Fév 2018
Modifié(e) : Jan le 20 Fév 2018
This copies the line objects from Axes1 to Axes2 using copyobj:
Fig1 = figure;
Axes1 = axes;
LineH = plot(1:10, rand(1, 10));
Fig2 = figure;
Axes2 = axes;
copyobj(LineH, Axes2)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by