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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:44:11+00:00 2026-05-27T18:44:11+00:00

I would like to plot a time series that look like this: what I

  • 0

I would like to plot a time series that look like this:

enter image description here

what I plot with:

qplot(Jahr, Wert, data=tu, group = Geschlecht, color = Altersgr) + facet_grid(Geschlecht ~ Land)

My data looks like this:

  Land   Altersgr Geschlecht Jahr  Wert
1   DE    < 20 J.          m 2000  13.0
2   DE  20-<65 J.          m 2000  25.7
3   DE     65+ J.          m 2000  70.1
4   DE  65-<80 J.          m 2000  44.2
5   DE     80+ J.          m 2000 213.5
6   BB    < 20 J.          m 2000  26.8

Everything is fine so far. But I have to connect the corresponding points (same color) with a line. I couldn’t figure out how to do that. If I use geom_line() I got this result:

enter image description here

Which is not what I want… I just have the feeling I overlook something…

Any suggestions? Thanks for y’all help.

  • 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-27T18:44:12+00:00Added an answer on May 27, 2026 at 6:44 pm

    You may find that using the `group’ aes will help you get the result you want. For example:

    tu <- expand.grid(Land       = gl(2, 1, labels = c("DE", "BB")),
                      Altersgr   = gl(5, 1, labels = letters[1:5]),
                      Geschlecht = gl(2, 1, labels = c('m', 'w')),
                      Jahr       = 2000:2009)
    
    set.seed(42)
    tu$Wert <- unclass(tu$Altersgr) * 200 + rnorm(200, 0, 10)
    
    ggplot(tu, aes(x = Jahr, y = Wert, color = Altersgr, group = Altersgr)) + 
      geom_point() + geom_line() + 
      facet_grid(Geschlecht ~ Land)
    

    Which produces the plot found here:

    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 time series(a csv file) data that looks like below. Each observation
I would like to plot this kind of data: X axis: dates Y axis:
I wrote the following code to make time series plot by group. nsplot<- xyplot(conc
I am using ggplot2 to plot simple line charts of time series data. One
I would like to plot a series of vertical lines in gnuplot at a
I have multiple vectors of varying lengths that I would like to plot next
I would like to make a script that outputs only the real time value
I would like to plot a vertical line (I'd prefer any orientation, but I'd
I would like to plot implicit equations (of the form f(x, y)=g(x, y) eg.
I would like to plot y1 and y2 in the same plot. x <-

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.