How to plot vertical and horizontal bars in a graph?

2 次查看(过去 30 天)
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
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 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by