How to save the scatter plot with and without transparency
Show older comments
Hi,
I need to save the scatter graph plotted with the same data but one with transparency applied and the other without transparency. Although the below code saves both the figures, however, gca styles are only applied on the second plot (i.e. the one with transparency)
a=figure;
scatter(F2(:,2),F3(:,3),0.1,F4(:,5));
b=figure;
scatter(F2(:,2),F3(:,3),0.1,F4(:,5),'MarkerFaceAlpha',0.2,'MarkerEdgeAlpha',0.2);
set(gca, 'FontSize', 10)
set(gca,'fontname','Arial')
set(gca, 'fontweight', 'bold')
saveas(a,'X_1.emf')
saveas(b,'X_2.emf')
Accepted Answer
More Answers (1)
Sulaymon Eshkabilov
on 4 Mar 2023
Edited: Sulaymon Eshkabilov
on 4 Mar 2023
Use exportgraphics() and also, note where the set() command for figure a and b is used and where exportgraphics() is used, e.g.:
F2 = repmat((1:10)', 1, 5);
F3 = F2.^2+2*F2-5;
F4 = sqrt(F3);
a = figure;
surf(F3)
set(gca, 'FontSize', 10)
set(gca,'fontname','Courier')
set(gca, 'fontweight', 'bold')
aX=gca;
aX.XColor='k';
aX.YColor='g';
aX.ZColor='m';
exportgraphics(a, 'a.emf', 'ContentType', 'image', 'BackGroundColor', 'white'); % White background
b=figure;
surfc(abs(F4))
set(gca, 'FontSize', 10)
set(gca,'fontname','Arial')
set(gca, 'fontweight', 'bold')
bX=gca;
bX.XColor='r';
bX.YColor='g';
bX.ZColor='b';
xlabel('x', 'Color','r')
ylabel('y', 'Color','g')
zlabel('z', 'Color','b')
exportgraphics(b, 'b.emf', 'ContentType', 'image', 'BackgroundColor', 'yellow'); % yellow background
Categories
Find more on Printing and Saving 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!




