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 で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!