-4

My goal is to create a line graph showcasing: 1. Each line is one different person 2. The line plots the person's ranking over time

Since I'm trying to display ranks (eg. A person is ranked 2nd on the first month, but moves down to 4th the next month, and so on...), I would prefer the point of #1 on the Y axis to be at the top rather than at the bottom. Is that possible?

I've already created the line graph of everyone and their ranks along each timeframe, I just need a way to flip the scale of the Y axis. Thank You for your help!

Meng Vong
  • 27
  • 4
  • 2
    Are you using base plotting functions or a package (e.g., `ggplot2`)? If you provide a reproducible example (i.e., code + data that runs as is), people can use that to demonstrate a solution. – Dan Nov 10 '19 at 23:05
  • 1
    Welcome to Stack Overflow _ @Lyngbakr's advice about including the code in your post is correct. For more guidelines on what is meant by "_reproducible example_" visit this link >>> https://stackoverflow.com/help/minimal-reproducible-example – inputforcolor Nov 11 '19 at 00:55

1 Answers1

2

Like this? Using scale_y_reverse

library(tidyverse)

ChickWeight <- ChickWeight

ggplot(ChickWeight,aes(Time,weight,group = Chick)) +
  geom_line() +
  scale_y_reverse()
Magnus Nordmo
  • 923
  • 7
  • 10