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 7883623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:34:54+00:00 2026-06-03T04:34:54+00:00

Here is my plot dat <- data.frame( pos = c(1, 3, 5, 8, 10,

  • 0

Here is my plot

dat <- data.frame(
  pos = c(1, 3, 5, 8, 10, 12),
  start = c(1,3, 6, 7, 10, 11),
  end = c(5, 6, 9, 9, 13, 12)
)

library(ggplot2)
p <- ggplot(dat) + geom_segment(aes(x=start, y=pos, xend=end, yend=pos), 
       color="blue", size=2) + ylab("Fragments)") +  xlab("Position")
    scale_y_reverse() + theme_bw()

p1 <- p + opts(legend.position="left",
        panel.background=theme_blank(),panel.border=theme_blank(),
        panel.grid.major=theme_blank(),
        panel.grid.minor=theme_blank(),plot.background=theme_blank())


p1

enter image description here

Bitmapped desired version is, with axis line and labels near the segments. [ just exta-note: Note that bitmap changed the line to round ended (it would be interesting to see if we can do in the ggplot2)]

enter image description here

  • 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-03T04:34:56+00:00Added an answer on June 3, 2026 at 4:34 am

    Interestingly, I actually think this is easier in base graphics:

    plot(c(0,13),c(1,12),type = "n",axes = FALSE,xlab = "Position",ylab = "")
    segments(x0 = dat$start,
             y0 = dat$pos,
             x1 = dat$end,
             y1 = dat$pos,
             col = "blue",
             lwd = 6,
             lend = 2)
    text(x = dat$start - 0.5,y = dat$pos,labels = dat$pos,font = 2)
    axis(1)
    axis(1,at = c(0,12),labels = FALSE,tcl = 0.5)
    

    Edit Added additional axis call to get the outer most tick in both directions.

    enter image description here

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

Sidebar

Related Questions

Here's a plot: library(ggplot2) ggplot(mtcars, aes(x = factor(cyl), y = hp, group = factor(am),
Here is a short part of my data: dat <-structure(list(sex = structure(c(1L, 1L, 1L,
I plotted a facet plot using ggplot and here is the plot The problem
I am using ggplot to plot time course data (fixation proportions over time to
Here is my data and plot nmar <- seq (1, 100, 5) position= rep(nmar,
Let's say I have the following dataset bodysize=rnorm(20,30,2) bodysize=sort(bodysize) survive=c(0,0,0,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,1,1) dat=as.data.frame(cbind(bodysize,survive)) I'm aware that
I use Google Visualization API to plot Line Chart. Here are the codes: google.load(visualization,
I am using matplotlib and numpy to make a polar plot. Here is some
I just wonder how to add annotation in matlab plot? Here is my code:
I have a a stacked bar plot using ggplot for which I'm trying to

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.