Clear Filters
Clear Filters

Combine 2 plots into a single figure

1 view (last 30 days)
SreeHarish Muppirisetty
SreeHarish Muppirisetty on 12 Dec 2013
Answered: Suneesh on 12 Dec 2013
Can I combine two plots into a single figure. Assuming that my Xticks for:
Plot1 would be 0 1 2 3 4 5 6 7 8 9 10 and for
Plot2 they would be 10 1000 2000 3000 4000 5000.
I want Plot3 a combined figure of Plot 1 & 2 with Xticks arranged finally as
1 2 3 4 5 6 7 8 9 10 1000 2000 3000 4000 5000.
Thanks for your time

Answers (1)

Suneesh
Suneesh on 12 Dec 2013
One way to do this is by manipulating the XData and YData properties. Try:
figure; h1 = plot(1:10);
figure; h2 = plot(10:10:50,20:24);
set(h1,'XData',[get(h1,'XData') get(h2,'XData')], 'YData', [get(h1,'YData') get(h2,'YData')])

Community Treasure Hunt

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

Start Hunting!