Andy
Andy

Reputation: 303

How should I fix my x-axis?

This is my graph when I graph the month and year of houses sold by the prices of the houses. I was wondering as to how I could make x-axis look nicer without loosing too much information in the graph.

Here is my code:

month_year_of_date <- paste(month_of_date, year_of_date, sep = "/")

ggplot(housing_data, aes(x = factor(month_year_of_date), y = housing_data$price)) + 
    geom_point()

plot(factor(test), housing_data$price)

enter image description here

Upvotes: 0

Views: 55

Answers (1)

Farshad
Farshad

Reputation: 61

You can turn the labels by 45 degrees as below:

theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))

Upvotes: 1

Related Questions