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 comentario

Image Analyst
Image Analyst el 13 de Dic. de 2019
Editada: Image Analyst el 13 de Dic. de 2019
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Etiquetas

Preguntada:

el 13 de Dic. de 2019

Editada:

el 13 de Dic. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by