Matlab: disappearing figure label when saved -


i have issue saving figure makes titles disappear.

i create figure, looks want to:

subplot(2,1,1); title('a') plot(a); hold on; plot(b,'rs'); plot(c,'gs'); subplot(2,1,2); title('d') plot(d); hold on; plot(e,'rs'); plot(f,'gs'); 

but in order save it, add

h= figure ... saveas(h,namejpg,'jpg'); 

this saves apart titles. want keep titles - why disappear when define figure?! @ appreciated.

the full code looks this:

h=figure; subplot(2,1,1); title('a') plot(a); hold on; plot(b,'rs'); plot(c,'gs'); subplot(2,1,2); title('d') plot(d); hold on; plot(e,'rs'); plot(f,'gs'); saveas(h,namejpg,'jpg'); 

this happens because title added subplot, cleared when plot called. avoid this, call title after calling plot, so:

figure subplot(2,1,1); plot(a); title('a') hold on; plot(b,'rs'); plot(c,'gs'); subplot(2,1,2); plot(d); title('d') hold on; plot(e,'rs'); plot(f,'gs'); saveas(h,namejpg,'jpg'); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -