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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:58:00+00:00 2026-05-21T11:58:00+00:00

I have some data from the 2008 election, which I’ve aggregated in the hopes

  • 0

I have some data from the 2008 election, which I’ve aggregated in the hopes of making a couple graphics about out-party voting. The data looks like this:

> voting
  voteObama voteMcCain      partyID totalvote outvotenumber outVoteProportion
1  325.5233    16.3212 1-Strong Dem  341.8445       16.3212        0.04774452
2  202.7162    32.6342   2-Weak Dem  235.3504       32.6342        0.13866218
3  201.8810    20.7225   3-Lean Dem  222.6035       20.7225        0.09309153
5   32.2052   143.3616   5-Lean Rep  175.5668       32.2052        0.18343559
6   26.6978   204.2876   6-Weak Rep  230.9854       26.6978        0.11558220
7    9.3775   245.7965 7-Strong Rep  255.1740        9.3775        0.03674943

I’d like to use the ggplot2 library, and have had success with it before. I would expect the following command to give me the graph that I want:

> g <- ggplot(data=voting, aes(x=partyID, y=outVoteProportion))
> g + geom_line()

The graphics window shows up, with all the correct labels and scales, but none of the data shows up. If I plot some random data with ggplot, it works fine, also if I plot this data with plot:

> plot(as.factor(voting$partyID), voting$outVoteProportion)

it also works fine. I’m not sure where the problem lies. Is it in the structure of the voting data frame? Or with the way I’m constructing my ggplot object? I expected this to just work, but apparently I’m missing something.

Edit As requested, the output of dput(voting)

structure(list(voteObama = c(325.523299649358, 202.716199040413, 
201.880999490619, 32.2051995545626, 26.6977999508381, 9.37749981880189
), voteMcCain = c(16.3212000578642, 32.634199783206, 20.7224997878075, 
143.361599132419, 204.287599071860, 245.796498090029), partyID = c("1-Strong Dem", 
"2-Weak Dem", "3-Lean Dem", "5-Lean Rep", "6-Weak Rep", "7-Strong Rep"
), totalvote = c(341.844499707222, 235.350398823619, 222.603499278426, 
175.566798686981, 230.985399022698, 255.173997908831), outvotenumber = c(16.3212000578642, 
32.634199783206, 20.7224997878075, 32.2051995545626, 26.6977999508381, 
9.37749981880189), outVoteProportion = c(0.0477445156257969, 
0.138662181778002, 0.0930915275590001, 0.183435591441075, 0.115582197246219, 
0.0367494333108043)), .Names = c("voteObama", "voteMcCain", "partyID", 
"totalvote", "outvotenumber", "outVoteProportion"), row.names = c("1", 
"2", "3", "5", "6", "7"), class = "data.frame")
  • 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-21T11:58:01+00:00Added an answer on May 21, 2026 at 11:58 am

    Posting comment as answer. Read this FAQ to understand why geom_line() does not produce lines

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

Sidebar

Related Questions

I have some server-based reports (*.rdl) which returns data from a SQL Server 2008
I have some data from a external party which is encrypted according to them
I have some data from log files and would like to group entries by
I have some data from JQGrid that should be exported to excel. So, we
I have fetched some data from a SQL database into a datagridview, but after
I have some data, yes, data. This data came from a MySQL query and
I'm using Selenium for work and I have extract some data from //ul, unfortunately
I have some array data returned from an ajax call consisting of an image
I have some data that comes regularily as a dump from a data souce
I have to download some data from external source but I have to submit

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.