White lines and text show up black

I am plotting a map of precipitation intensity over the UK. For example, code for the first panel is
subplot_tight(2,2,1,[0.08 0.055])
m_proj('robinson','lat',[45,57],'lon',[-17,1])
hold on
m_contourf(lon,lat,precip,num_contours,'LineStyle','none');
m_coast('line','Color','w','linewidth',1.25);
m_grid('xtick',10,'tickdir','out','yaxislocation','left');
title('Secondary ice production rate - 2Big - 1800 UTC')
text(0.05,0.9,'\bf{(a)}','Color','w','Units','normalized','FontSize',16)
When I try to save the figure, the white text (\bf{(a)}) and white coastlines show up black. How can I fix this? I am using the OpenGL renderer.. is this the issue? Thanks very much Sylvia

5 Commenti

Maitreyee Mordekar
Maitreyee Mordekar il 27 Nov 2017
Modificato: Maitreyee Mordekar il 27 Nov 2017
Hey Sylvia,
The function subplot_tight looks to be a MATLAB central submission: https://www.mathworks.com/matlabcentral/fileexchange/30884-controllable-tight-subplot
It is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement.
Probably you can contact the author of this submission directly for specific questions about the implementation.
However, can you share the snapshot of the output that you obtain? It will me gain more clarity on the issue.
Hope that helps!
Best, Maitreyee
I resolved this issue with
set(gcf,'InvertHardCopy','off')
before the call to print.
Works great! Thank you!
This "worked" for me, but it created another issue. Now the background around the figure is still grey like it is when viewing the figure instead of white like I need it to be and was before applying this fix. Is there a way to get white lines and text and a white background around the figure?
Daniel, I'm not sure if this helps in your particular case, but I have a set of issues in my own plot printing routines on an inverted X display. I find that I have to explicitly set the background color.
if saveplots
figpadcolor=get(gcf,'color');
set(gcf,'color',[1 1 1]);
thisplot=255-frame2im(getframe(gcf));
imwrite(thisplot,[mode '.png'])
set(gcf,'color',figpadcolor);
end
Of course, I'm using frame2im() and inverting the output, but the idea of temporarily storing the figure color, setting it explicitly, and then restoring it is the idea I'm suggesting.

Accedi per commentare.

Risposte (0)

Richiesto:

il 13 Nov 2017

Commentato:

DGM
il 15 Mar 2021

Community Treasure Hunt

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

Start Hunting!

Translated by