plot stem in vertical position
조회 수: 6 (최근 30일)
이전 댓글 표시
x = linspace(-2*pi,2*pi,100);
y = 4*pi*randn(1,100)-2*pi;
figure;
stem(x,y, 'LineWidth', 3)
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Stem Test', 'NumberTitle', 'Off')
hi, i want to plot it in vertical mode

댓글 수: 0
채택된 답변
Voss
2025년 3월 18일
x = linspace(-2*pi,2*pi,100);
y = 4*pi*randn(1,100)-2*pi;
% Set up figure properties:
% Enlarge figure to full screen.
% Get rid of tool bar and pulldown menus that are along top of figure.
% Give a name to the title bar.
figure('Units', 'Normalized', 'OuterPosition', [0 0 1 1], 'Toolbar', 'none', ...
'Menu', 'none', 'Name', 'Stem Test', 'NumberTitle', 'Off');
ax = gca();
hold(ax,'on');
box(ax,'on');
ax.YDir = 'reverse';
ax.ColorOrder = ax.ColorOrder(1,:);
plot(ax,y,x,'o','LineWidth',3)
N = numel(x);
xx = [x;x;NaN(1,N)];
yy = [y;zeros(1,N);NaN(1,N)];
plot(ax,yy(:),xx(:),'LineWidth',3)
xline(ax,0)
댓글 수: 4
추가 답변 (1개)
Walter Roberson
2025년 3월 18일
One method is to create a hgtransform and use that as the parent axes of the stem() call. Then set the Matrix property of the hgtransform to rotate the stem plot; it is often useful to use makehgtform to create the rotation matrix.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Stem Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


