
Scatter‐plot marker edge color turns black when copying to PowerPoint
    2 views (last 30 days)
  
       Show older comments
    
Hi everyone,
I’m running into a strange issue when I copy my MATLAB figure into PowerPoint and then ungroup the graphic objects. Although I explicitly set both the marker face and edge colors to red, after ungrouping in PowerPoint the marker edges always appear black. Before ungrouping in PowerPoint: markers are solid red circles (face and edge).This happens whether I use scatter or plot. Trying all of the different Copy Figure e options in the MATLAB figure window, none of these preserve the red edge color once ungrouped.
scatter(x, y, 50, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
xlabel('X');
ylabel('Y');
title('Scatter Plot with Red Markers');
or 
plot(x, y, 'o', ...
    'MarkerSize', 8, ...
    'MarkerFaceColor', 'r', ...
    'MarkerEdgeColor', 'r', ...
    'LineStyle', 'none');
Thanks in advance for any tips!
1 Comment
  Matt J
      
      
 on 20 Jun 2025
				Do you not see the following warning? It seems like a Microsoft thing, not a Matlab thing.

Answers (1)
  Matt J
      
      
 on 20 Jun 2025
        
      Edited: Matt J
      
      
 on 20 Jun 2025
  
      If you download export_fig, 
and if you are on Windows, then you can copy an axes and its children as separate components to an open PowerPoint slide, like in the following.
x=rand(1,10); y=rand(1,10);
scatter(x, y, 50, 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'r');
xlabel('X');
ylabel('Y');
title('Scatter Plot with Red Markers');
copyComponents()

function copyComponents()
    h=[gca;gca().Children];
    axcol=h(1).Color;
    axlims=axis;
    h(1).Color='none';
    for n=1:numel(h)
        set(h,'Visible','off');
        h(n).Visible='on';
        axis(axlims);
        drawnow
        export_fig(gca,'-transparent','-clipboard','-nocrop')
        % Attach to running PowerPoint session
        ppt = actxGetRunningServer('PowerPoint.Application');
        % Get the active presentation
        presentation = ppt.ActivePresentation;
        % Get the current view and current slide index
        view = ppt.ActiveWindow.View;
        currentSlideIndex = view.Slide.SlideIndex;
        % Access the current slide object
        slide = presentation.Slides.Item(currentSlideIndex);
        % Select it
        slide.Select;
        % Paste from clipboard
        ppt.CommandBars.ExecuteMso('Paste');
    end
    set(h,'Visible','on');
    h(1).Color=axcol;
end
0 Comments
See Also
Categories
				Find more on MATLAB Report Generator 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!
