Why is not every Marker filled in my Plot

15 vues (au cours des 30 derniers jours)
Ursula
Ursula le 17 Fév 2016

I produce a figure with many subplots where I want to show filled Markers. When i save the figure as a .png file not every marker is filled.

the subplots are created in a for-loop so the code is for every subplot the same

      % code
        sp2 = subplot(4,6,i*2);
    box = boxplot([a, b],'symbol','o','widths', [0.6 0.6]);
    hold on            
    set(box(5,1),'color',[0.48, 0.06, 0.89],'MarkerFaceColor',[0.48, 0.06, 0.89]);
    set(box(5,2),'color',[0.4, 1, 0.1294],'MarkerFaceColor',[0.4, 1, 0.1294]);
    for j=1:2
        q = get(box(5,j),'color');
        patch(get(box(5,j),'XData'),get(box(5,j),'YData'),q,'FaceAlpha',.99); 
    end
    clear h
    set(box(6,:), 'color',[1, 0.2, 0.6], 'linewidth',2);
    set(box(7,:),'MarkerEdgeColor',[1, 0.2, 0.6]);
    line(get(sp2,'XLim'),[0, 0],'color', [0.6, 0.6, 0.6],'LineWidth',1);
    ylabel('\Delta-Stride');
    hold off
    % code
sp1 = subplot(4,6,(i*2-1));
    fill([1:60,60:-1:1],[oben,unten(end:-1:1)],[0.9 0.9 0.9],'LineStyle', 'none','FaceAlpha',[1]);
    hold on
    plot(c,'Color', [0.6, 0.6, 0.6], 'LineWidth', 0.5);
    plot(oben,'Color', [0.6, 0.6, 0.6], 'LineWidth', 0.5);
    plot(unten,'Color', [0.6, 0.6, 0.6], 'LineWidth', 0.5);
    plot(d,e,'d','color',[0.48, 0.06, 0.89], 'MarkerFaceColor',[0.48, 0.06, 0.89],'MarkerSize',[6]);
    plot(f,g,'d','color', [0.4, 1, 0.1294], 'MarkerFaceColor',[0.4, 1, 0.1294],'MarkerSize',[6]);
    lim_unten = min(e)+(min(e)/6); 
    lim_oben = max(g)+(max(g)/6);
    ylim([lim_unten lim_oben]);
    line([d d], [lim_unten, 0],'color', [1, 0.2, 0.6]);
    line([f f],[0, lim_oben],'color', [1, 0.2, 0.6]);
    ylabel('Hip Moment [Nm]');
    xlabel('Stride[%]');
    hold off 

I tried it without the the filled grey area (fill() command) and it worked propely.

Has anyone an idea what i can do that i can show my markers in the correct way and have the filled area?

I would be pleased if someone has an advise for me.

Réponses (1)

Mike Garrity
Mike Garrity le 17 Fév 2016
My guess is that the markers are actually behind the filled grey regions, and your SortMethod is depthsort, and your renderer is OpenGL.
I explained how this works in this post on the MATLAB Graphics blog.
It doesn't look like there's anything in your chart that needs depthsort, so you should be able to just set your SortMethod to childorder manually. The heuristic we use for automatically choosing isn't perfect.

Community Treasure Hunt

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

Start Hunting!

Translated by