Reputation: 83
I have the following data:
Name Value Type
One 500 Confirmed
One 1000 Total
Two 550 Confirmed
Two 900 Total
Three 550 Confirmed
Three 800 Total
And the following R script:
#!/usr/bin/env Rscript
library(ggplot2)
data = structure(list(Name = c("One", "One", "Two", "Two", "Three",
"Three"), Value = c(500L, 1000L, 550L, 900L, 550L, 800L), Type = c("Confirmed",
"Total", "Confirmed", "Total", "Confirmed", "Total")), .Names = c("Name",
"Value", "Type"), class = "data.frame", row.names = c(NA, -6L
))
ggplot(data=data, aes(x=Value, y=Name, group=Name, colour=Type)) + geom_line(color="black") + geom_point()
Which produces the following plot:
My question is, how can I reduce the vertical space between the three categories (One, Two, Three)? They seem needlessly far apart.
Upvotes: 1
Views: 1536
Reputation: 9560
Change the aspect-ratio/size of your plot output.
Here is an example that uses your same code:
Would it be better to have the lines close together, and lots of space to the outside? I doubt it, but if you add
coord_cartesian(ylim = c(-9,13))
to your plot, you can get this:
Upvotes: 2