필터 지우기
필터 지우기

How to insert grid lines specific position ?

조회 수: 7 (최근 30일)
voxey
voxey 2019년 8월 20일
댓글: Adam Danz 2019년 8월 22일
How to insert grid lines specific position ? check this attached Imafe? How to insert grid line inside red line box on image?
  댓글 수: 2
darova
darova 2019년 8월 20일
You can use plot
plot([800 1000] ,[600 250],'--g')
Or you want insert line into image?
Adam Danz
Adam Danz 2019년 8월 20일
@darova , that plots a diagonal line.

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2019년 8월 20일
Here's a demo
% Define bound
%bound(1) is the x value of the bottom, left corner of the frame
%bound(2) is the y value for the same corner
%bound(3) is the width of the frame
%bound(4) is the height of the frame
bound = [.2 .1 .5 .7];
% Define grid
x = .3:.1:.6;
y = .2:.1:.7;
% Plot
cla()
xlim([0,1])
ylim([0,1])
hold on
rectangle('position', bound, 'EdgeColor','r')
% Plot vertical lines
vh = plot([x(:),x(:)],[bound(2),sum(bound([2,4]))], 'Color', [.6,.6,.6]);
% Plot horizontal lines
hh = plot([bound(1),sum(bound([1,3]))],[y(:),y(:)], 'Color', [.6,.6,.6])
190820 174130-Figure 1.jpg
  댓글 수: 6
voxey
voxey 2019년 8월 22일
its not working? can you share sample result with this code?
Adam Danz
Adam Danz 2019년 8월 22일
My answer contains a fully functional sample with this code.
What's not working? What problems are you having? As I mentioned, if you get stuck, share the relevant sections of code (only the relvant sections that plot the grid). And carefully explain what's not working.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by