Tiledlayout and duplicating plot for zoom of original plot
Show older comments
Hi all,
I have a plot with different xlines and text annotations with somewhat a large dataset (~3M datapoints).
I am trying to create a subplot (actually a tiledlayout) view where I have the original full graph displayed on the top plot and a zoomed view of the same plot below. I am looking to create a copy of the first plot, where I'll change the Y axis to zoom the graph. This might not be the most optimal way of doing this, however it is a start.
I have created the following testcode to figure out how to do this:
A= rand(50,1)*10;
B= rand(5,1)*length(A);
figT=tiledlayout(2,1);
FigTile1= nexttile(1);
figA = plot(A); hold on;
for i=1:length(B)
xline(B(i),'r')
end
hFigIAxes = findobj('Parent',figT,'Type','axes');
FigTile2 = nexttile(2);
copyobj(FigTile2,hFigIAxes)
But this just throws an error saying "Axes cannot be a child of Axes.". I am not quite sure how to correct this.
Any help will be welcomed! Thanks, Tommy
Accepted Answer
More Answers (0)
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!