0

Bear with me on this explanation because I am unsure the best way to relay this information. I am attempting to plot a depth graph but I want the y axis' negative axis to be positive values because that would look pleasing to be able to show depth going down with the independent variable. In this compilation I want the x axis to be at the top of the graph and the y axis to be the left side of the graph. The y axis will start at 0,0 and go down to 80 (down the canonical negative axis but I want the values to show positive).

Unsure how to do this and any help would be appreciated. I've looking through stackover flow and the only minor help has been given to those with MATLAB and Java similar questions.

Katie S
  • 89
  • 7
  • 1
    Do you have an example of your data or the output that you'd like? This guide explains the things you should try to include with your questions to make answering easier: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Andrew Brēza Jul 14 '17 at 17:00
  • You can rotate the chart by 180 degree if your chart doesn't have number figures. – Om Sao Jul 14 '17 at 17:02
  • You can label your axis however you want. See `?axis` if you are using base plots or `?scale_y_continuous` if you are using `ggplot2`. Please see Andrew Breza's link - if you need example code, you will need to provide example data / an example plot. Built-in data is easiest, but simulated data or copy/pasteable data shared with `dput()` also work. – Gregor Thomas Jul 14 '17 at 17:03

2 Answers2

1

You can just specify ylim with the usual order reversed.

plot(iris[,3:4], pch=20, ylim=c(3,0))

Reversed Limits

G5W
  • 36,531
  • 10
  • 47
  • 80
0

ggplot2 solution: use scale_y_reverse()

# Create data frame
df <- data.frame(Depth = 0:80, Stuff = runif(81, 0, 1))

# Plot it
ggplot(df) + geom_point(aes(x = Stuff, y = Depth)) + scale_y_reverse()

enter image description here

Dan
  • 11,370
  • 4
  • 43
  • 68