How to export an image with no bakground color but transparent?

1 vue (au cours des 30 derniers jours)
Emerson De Souza
Emerson De Souza le 20 Oct 2011
I want to export a graph but without any background, also NO WHITE. The exported image is expected to be transparent and will be placed on the top of another one. Only the axis and the displayed curve are allowed to appear.
I tried to do achieve this by writing the following lines:
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y);
axis([-0.2 7 -1.2 1.2])
set(gca)
set(gca,'Color','none')
print -dmeta -f1 -r600 myfigure %or -dbitmap, -djpeg, -dtiff, -depsc
But unfortunately the exported image always have a white background. I wonder if someone knows how to correct this.
I thank you in advance for your attention
Emerson

Réponse acceptée

Emerson De Souza
Emerson De Souza le 20 Oct 2011
set(gcf, 'color', 'blue');
set(gca, 'color', 'yellow');
set(gcf, 'InvertHardCopy', 'off');

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by