when printing a figure matlab prints line that are not shown on screen

2 views (last 30 days)
Hi i am trying to print a map. when i do set(gca,'Position',outpos,'box','off');
I see no frame around my map (pcolorm) but then when i print it the left and bottom lines appear
I even tried to manually set xcolor and ycolor, when they are being set to lets say blue the frame apears blue but once i try setting the to white the same black line appear. what do i do?
the code i am using:
fg=figure
set(gcf, 'renderer', 'zbuffer');
m1=axesm('mapprojection','mercator','MapLatLim',[31 34.5],'MapLonLim',[30 36],... 'frame','off','plabellocation',1,'mlabellocation',1,'parallellabel', 'on','meridianlabel','on','frame','on');
cb=colorbar('Location','east');
caxis([-.1 1.5]);
inpos=get(gca,'Position');
outpos=[.2 .015 inpos(3) inpos(4)];
set(gca,'Position',outpos,'box','off');
inpos=get(cb,'Position');
outpos=[.05 .2 inpos(3) inpos(4)*.9];
set(cb,'Position',outpos);
data2plot=surface_noriv(:,:,itime)-surface_nile_before(:,:,itime);
data2plot(fsm==0)=0/0;
pcolorm(latpom,lonpom,data2plot);
shading interp;
showaxes('off');
textm(31.5,35,num2str(itime*2),'FontName','Times',... 'FontWeight','Bold','FontSize',16);
filename=['/tmp/time' sprintf('%03d',itime) '.png']
saveas(fg,filename)

Accepted Answer

David
David on 21 Jun 2019
Set XColor and YColor to None:
set(gca,'XColor','none');
set(gca,'YColor','none');

More Answers (0)

Categories

Find more on Graphics Object Identification 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!