graph - Recreate plot in MATLAB using figure handle -


is there anyway create same plot twice saving type of axis handle?

my plotting code creates special symbols each point in scatter plot. want create figure 2 subplots. first plot want set specific part of axis (0 10), second plot want (90:100). know recreate plot copy , pasting code, seems cumbersome , hassle manage if change else plots.

is there anyway can create plot once, save handle , replot it?

here functionality looking for:

figure; hold on; x = [1  10 20 10   2000 3000]; y = [10 30 40 20   100   200 ];  // create plot 1 point @ time      = 1:4 subplot(2,1,1); plot(x(i),y(i),'r');  // redacted code // there bunch of code here adjust of first plot each point // in order define of each marker in scatter plot,  // has done 1 point @ time // redacted code  end  // adjust axis axis([1 60 0 50]);  // figure handle handle = gcf;   // create second plot same characteristics first plot different axis boundaries subplot(2,1,2); plot(handle); axis([90 250 1000 4000]);   

here's how can turn code function:

function makeaplot(axbound, ax) % set current axis axes(ax)  hold on; x = [1  10 20 10   2000 3000]; y = [10 30 40 20   100   200 ];  = 1:4  plot(x(i),y(i),'r');  % // redacted code % // there bunch of code here adjust of first plot each point % // in order define of each marker in scatter plot, % // has done 1 point @ time % // redacted code  end  axis(axbound) 

and here's how can call twice differnt arguments plot in different subplots different axes ranges:

ax1 = subplot(2,1,1); makeaplot([1 60 0 50], ax1)  ax2 = subplot(2,1,2); makeaplot([90 250 1000 4000], ax2) 

if doesn't work, copyobjfunction , use copy handle plot.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -