Why does plot quality reduce when plotting line and scatter together?

I am using plot3() and scatter3() together and the quality of the plot is reducing. The plot becomes a bit pixelated.
% Code snippets of what I am using
plot3(xSol{1}(first_seconds), omegaSol{1}(first_seconds), ESol{1}(first_seconds), 'LineWidth', 1.8, 'Color', PS.Purple2);
scatter3(x_FP(1, i), omega_FP(1, i), E_FP(1, i), 'Marker', 'o', 'SizeData', 60, 'MarkerFaceColor', PS.DRed2, 'MarkerEdgeColor', PS.Red4, 'MarkerFaceAlpha', MarkerAlpha);
Why is this happening? How can I get a smooth and high quality plot?
Problem picture:
Basically I want to have the dots with a certain alpha. plot3() does not allow that so I am using scatter3(). If there is another way of using 'o' Marker with plot3() and get alpha for them I can use that.

6 commentaires

Can you attach the complete code, so that we can reproduce the same plot?
load('datafile.mat');
figure(2);
fig2_comps.fig = gcf;
%=================================================
% PLOT TIME SERIES
time_limit = 50;
upper_time_limit = 90;
first_seconds = tSol{1} < time_limit;
after_first_seconds = (tSol{1} > time_limit) & (tSol{1} < upper_time_limit);
% figure(1);
fig2_comps.p1 = plot3(xSol{1}(1), omegaSol{1}(1), ESol{1}(1), 'HandleVisibility', 'off', 'LineStyle', 'none', 'LineWidth', 1.5, 'Marker', 'o', 'MarkerSize', 6, 'MarkerFaceColor', PS.DBlue1, 'MarkerEdgeColor', PS.Purple2);
hold on
fig2_comps.p2 = plot3(xSol{1}(first_seconds), omegaSol{1}(first_seconds), ESol{1}(first_seconds), 'LineWidth', 1.8, 'Color', PS.Purple2);
fig2_comps.p3 = plot3(xSol{1}(after_first_seconds), omegaSol{1}(after_first_seconds), ESol{1}(after_first_seconds), 'LineWidth', 1.5, 'Color', PS.Green1);
grid on
MarkerAlpha_list = linspace(1, 0.2, length(x_FP(1, :)));
for i = 1:length(x_FP(1, :))
MarkerAlpha = MarkerAlpha_list(i);
fig2_comps.p4 = scatter3(x_FP(1, i), omega_FP(1, i), E_FP(1, i), 'HandleVisibility', 'off', 'Marker', 'o', 'SizeData', 60, 'MarkerFaceColor', PS.DRed2, 'MarkerEdgeColor', PS.Red4, 'MarkerFaceAlpha', MarkerAlpha);
fig2_comps.p5 = scatter3(x_FP(2, i), omega_FP(2, i), E_FP(2, i), 'HandleVisibility', 'off', 'Marker', 'o', 'SizeData', 60, 'MarkerFaceColor', PS.DBlue2, 'MarkerEdgeColor', PS.Blue4, 'MarkerFaceAlpha', MarkerAlpha);
end
legend('location', 'northwest');
You have 20 samples only, as per attached data.
No, 20 is the number of circles appearing.
I am talking about the pixelation of the line.
For some reason this pixelation is only happening when displaying.
When I save the figure with 600dpi no pixelation happens.

Connectez-vous pour commenter.

Réponses (1)

The painters-renderer that produces vector-format output, like eps doesn't understand alpha-type transparency. Therefore when you have plots utilizing alpha-mapped transparent objects you will get figures saved with the opengl renderer - which understands transparency but produces pixel-based images. There is (as far as I know) nothing much we can do about that.
Hope this clarifies the issue.

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by