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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:15:03+00:00 2026-05-26T06:15:03+00:00

Hi I have a data frame that looks like this: Seq H E T

  • 0

Hi I have a data frame that looks like this:

    Seq     H   E   T   C
1   Seq_1   2   1   5   4
2   Seq_2   2   1   5   4
3   Seq_3   2   1   5   4
4   Seq_4   0   0   6   6
5   Seq_5   0   4   2   6    

Where H,E,T and C represent the counts of these features within each sequence.

I’m trying to build a line graph where each line should represent one sequence. The X-axis will be the features (H,E,T,C) and the Y-axis its corresponding count, so the lines will show the count’s variation within each sequence.

How should I do that? I’ve already messed around with a lot of things but couldn’t make it!

  • 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-26T06:15:04+00:00Added an answer on May 26, 2026 at 6:15 am

    The trick to ggplot is that it expects data to be in “long” format. It’s often easiest to get it in this format with melt. Once melted, it becomes an exercise of specifying the plot as you want to view it. Here’s an example:

    txt <- "    Seq     H   E   T   C
    1   Seq_1   2   1   5   4
    2   Seq_2   2   1   5   4
    3   Seq_3   2   1   5   4
    4   Seq_4   0   0   6   6
    5   Seq_5   0   4   2   6 "
    
    dat <- read.table(textConnection(txt), header = TRUE)
    library(ggplot2)
    
    dat.m <- melt(dat)
    
    
    ggplot(dat.m, aes(variable, value, group = Seq, colour = Seq)) + 
      geom_line()
    

    This results in some overplotting issues for Seq_1 – Seq_3 so you may want to consider dropping colour and faceting instead:

    ggplot(dat.m, aes(variable, value, group = Seq)) + 
      geom_line() + 
      facet_wrap(~Seq)
    

    Faceting obviously becomes less useful when you have 100s of sequences to review.

    enter image description here

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

Sidebar

Related Questions

I have a data.frame in R that looks like this: score rms template aln_id
I have a data frame in R that looks like this: > TimeOffset, Source,
I have a data.frame that looks like this > head(df) Memory Memory Memory Memory
I have a data frame that looks like this: user1,product1,0 user1,product2,2 user1,product3,1 user1,product4,2 user2,product3,0
I have a dataset that looks like this: a <- data.frame(rep(1,5),1:5,1:5) b <- data.frame(rep(2,5),1:5,1:5)
I have a data.frame that looks like this: 320 Dutch A7 3 321 Dutch
I have the following data frame (info) that looks like this: > info[1:5,] field
I have a data frame that looks like this: site date var dil 1
I have a data.frame named pp that looks like this: > head(pp) X02R X03N
I have a data set that looks like this: ByYear <- data.frame( V1 =

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.