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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:02:41+00:00 2026-06-03T08:02:41+00:00

I have some data scraped and processed from the web in this form: >head(dat)

  • 0

I have some data scraped and processed from the web in this form:

>head(dat)
  count  name          episode    percent
1   309   don 01-a-little-kiss 0.27081507
2   220 megan 01-a-little-kiss 0.19281332
3   158  joan 01-a-little-kiss 0.13847502
4   113 peggy 01-a-little-kiss 0.09903593
5   107 roger 01-a-little-kiss 0.09377739
6    81  pete 01-a-little-kiss 0.07099036

I’m trying to created a stacked area chart, similar to the one here: Making a stacked area plot using ggplot2

When I do a

require(RCurl)
require(ggplot2)
link <- getURL("http://dl.dropbox.com/u/25609375/so_data/final.txt")
dat <- read.csv(textConnection(link), sep=' ', header=FALSE, 
             col.names=c('count', 'name', 'episode'))

dat <- ddply(dat, .(episode), transform, percent = count / sum(count))

ggplot(dat, aes(episode, percent, group=name)) + 
     geom_area(aes(fill=name, colour=name), position='stack')

enter image description here

I get this bizarre chart.

I want the areas not to cross eachother, and to fill the entire canvas as the total percent for each episode factor equals 100%.

  • 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-03T08:02:42+00:00Added an answer on June 3, 2026 at 8:02 am

    That was interesting. You’re missing a single row (Lane didn’t appear in Tea Leaves…?), so

    dat2 <- rbind(dat,data.frame(count = 0,name = 'lane',
                        episode = '02-tea-leaves',percent = 0))
    
    ggplot(arrange(dat2,name,episode), aes(x = episode,y = percent)) + 
      geom_area(aes(fill=name,group = name), position='stack')
    

    enter image description here

    appears to work. But it had to be in the right order as well, and I’m not entirely sure why.

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

Sidebar

Related Questions

I already have data I scraped from a web table and I've noticed some
I have this situation where I need to get some data from a webpage
I need to scrape some data from webpages. But I have some encoding problems
I have a scraper that is collecting some data from elsewhere that I have
Basically, I want to scrape some options data daily from Yahoo! Finance. I have
I have some data in this format: one,one two,two sub_one,one sub_two,two sub_sub_one,sub_one sub_sub_two,sub_two sub_sub_sub_one,sub_sub_one
I have a python function that scrapes some data from a few different websites
sheet1 have some data as the following: A B C D 1 number name
I have some data from a unix commandline call 1 ab 45 1234 2
I have some data like this <div> This is some text </div> and i

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.