Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:48:24+00:00 2026-06-10T11:48:24+00:00

I need to draw vertical lines at regular intervals in a rectangular box. this

  • 0

I need to draw vertical lines at regular intervals in a rectangular box. this is what i have used so far:

xmin=000;
xmax=70000;

ymin=0;
ymax=1000;


line1Val=900;
line2Val=600;
line3Val=300;
xlim([xmin xmax])
ylim([ymin ymax])
xl=get(gca,'XLim');
line(xl,[line1Val line1Val],'Color','y');
line(xl,[line2Val line2Val],'Color','y');
line(xl,[line3Val line3Val],'Color','y');
hold on ;

rectangle('Position',[120000,900,(280000-120000),37],'faceColor','k') 

so the width of the rectangle is 160000 units i want to divide this into 4 , where the vertical line is of a different color(say red) and the height of the line is 37 units.

any ideas on how i can draw this without drawing 4 rectangles whose edges are red and are filled with black color.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:48:25+00:00Added an answer on June 10, 2026 at 11:48 am

    You could use the parameters xstart,ystart,width and height for drawing your rectangle:

    rectangle('Position',[xstart,ystart,width,height],'faceColor','k');
    

    After that, you could determine the line positions in a loop and simply draw these lines:

    for i = 1:3
        x = xstart+i*width/4;
        line([x x],[ystart ystart+height],'Color','r');
    end
    

    If you want a red line at the start and end of the rectangle, let i = 0:4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to draw vertical and horizontal rectangle / bands (like in Gantt charts)
I need to draw a lot of lines. I'm using UIBezierPath for drawing lines
I need to draw 2D overlay over OpenGL scene. OpenGL is used for 2D
I need to draw on a TPanel, ideally directly so I don't have another
I need to draw a .png image on an UIView. I have no clue
I have a UIViewController with some images. I need to draw some horizontal and
i need to draw two lines. can i use the same UIView subclass to
Need draw a graph with dot/graphviz like this image: The texts can be above
I have computed the values of the points I need to draw and I
I need to draw a lot of (about 500000) little lines in some area

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.