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

  • Home
  • SEARCH
  • 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 7687675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:45:22+00:00 2026-05-31T19:45:22+00:00

I am having problems getting segments of small lengths to appear in my plot.

  • 0

I am having problems getting segments of small lengths to appear in my plot.

Assuming the following sample data:

x=c(11,22,33,44,55)
y=c(15,23,33,45,57)
z=strptime(20120101:20120105,'%Y%m%d')

If I were to create segments out of this data my segment for the third record does not show up if I want square or butt line ends. It does show up if I allow my line ends to be round lend=0.

plot(z,x,type='n')
segments(as.numeric(z),x,as.numeric(z),y,lwd=5,lend=2)

If I try this:

segments(as.numeric(z),x,as.numeric(z),y,lwd=5,lend=0)

It shows a circle at 33. Is there a way to get at the very least a flat line that will appear at 33 (hopefully in base)?

I would have used my actual data which is also doing this when the range is small for instance 33.0005 to 33.0010, but that data is huge and I was hoping solving for when they are identical would also solve for small ranges.

ETA: If lwd=15 the circle looks even more ridiculous.

Maybe segments are not the right way to approach this?

This is for a candlestick chart, so these numbers would represent open and close. I also have high and low numbers which extend beyond this range and are drawn using lwd=1 under these segments.

  • 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-05-31T19:45:24+00:00Added an answer on May 31, 2026 at 7:45 pm

    Base graphics does supply rect. And in fact, it does what you want. Using your definitions above.

    xdiff <- max(as.numeric(z)) - min(as.numeric(z))
    segwidth <- xdiff/50
    
    plot(z,x,type='n')
    rect(z-segwidth/2, x, z+segwidth/2, y, col="black")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems getting a div to appear using jquery after 5 seconds. right
I'm having problems getting the new data from the RandomNumbers List I got this
I am having problems getting text within a table to appear centered in IE.
I'm having problems getting the form parameters in the following Compojure example: (ns hello-world
I am having problems getting JBoss to inject an environment variable value into a
I am having problems getting the 'ByAccount' aggregation to work in SQL Server Analysis
I've been having problems getting jqmodal modal dialogs to display on links added dynamically
I am having problems getting at a click event of a button and am
I am having problems getting my Permalinks changed with my Wordpress instance. I have
I am having problems getting validation to work for a form built using Zend_Form.

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.