How to plot vertical and horizontal bars in a graph?
이전 댓글 표시
This is my code. I want to make an intersection road graph and T-junction road.
switch get(handles.shape, 'value');
case 1
errordlg('Please choose any shape','Error');
case 2
grid on;
line(ylim, [20,20], 'Color', 'k', 'LineWidth', 50);
% Draw line for Y axis.
case 3
hold on;
line([10,10], ylim, 'Color', 'k', 'LineWidth', 22); % Draw line for Y axis.
line(xlim, [0.5,0.5], 'Color', 'k', 'LineWidth', 22); % Draw line for X axis.
case 4
hold on;
line([10,10], ylim, 'Color', 'k', 'LineWidth', 22); % Draw line for Y axis.
line(xlim, [1,1], 'Color', 'k', 'LineWidth', 22); % Draw line for X axis.
case 5
r = 1;
xc = 3;
yc = 3;
theta = linspace(0,1*pi);
x = r*cos(theta) + xc;
y = r*sin(theta) + yc;
plot(x,y,'Color','k','LineWidth',15)
axis equal
case 6
r = 1;
xc = 3;
yc = 3;
theta = linspace(0,2*pi);
x = r*cos(theta) + xc;
y = r*sin(theta) + yc;
plot(x,y,'Color','k','LineWidth',15)
axis equal
end
댓글 수: 1
Image Analyst
2019년 12월 13일
편집: Image Analyst
2019년 12월 13일
Not sure what the problem is, but line() should do it. If you want some other shape, try patch() or fill().
Is there a problem with line()? If so, attach a screenshot, and if possible your m and fig files.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!