Hi,
I am using the stem() function to plot some DT signals. The problem I am facing is that stem line is not following the colour of the marker. When I force a colour change using 'b' or 'r' (for example) only the marker changes but the stem line stays as is. Please refer to the figure & code bellow. I am using MATLAB R2018a.
Thanks!
figure(1);
subplot(2, 1, 1);
stem(t1, x400_n, 'b');
title('x400[n] @ fs = 400Hz');
xlabel('n');
ylabel('x[n]');
grid on;
subplot(2, 1, 2);
stem(t1, x400_n_1stHarm, 'b');
title('1st harmonic of x400[n] @ fs = 400Hz');
xlabel('n');
ylabel('x[n]');
grid on;

4 Kommentare

Guillaume
Guillaume am 4 Mai 2020
stem doesn't normally fill the curve with colour. Are you using a custom stem function per chance?
What does
which stem -all
returns?
Joshua Scicluna
Joshua Scicluna am 4 Mai 2020
It appears as filled because there is a substantial number of samples, when zooming in the stem lines appear… again with different colour. Refer to figure.
which stem -all
returns
C:\Program Files\MATLAB\R2018a\toolbox\matlab\specgraph\stem.m
Guillaume
Guillaume am 4 Mai 2020
"It appears as filled because there is a substantial number of samples, when zooming in the stem lines appear… again with different colour"
Ah, got you. I can't reproduce the behaviour in 2020a with 'opengl hardware' renderer and 1e6 points in the curve. How many points in your curves.
Unfortunately, I don't have 2018a installed anymore. You may want to look at Resolving low-level graphics issues. Switching renderer may resolve the problem.
Makes kind of pretty plots though...
Joshua Scicluna
Joshua Scicluna am 4 Mai 2020
Problem Solved!
I took a good look into the Resolving low-level graphics issues and tried to use the command
opengl('save','software')
which worked fine. The stem plot lines follow the colour of the markers.
Thanks for your help! @Guillaume

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by