I am working with R and I trying to make chart in ggplot2. Below you can see my data and my line chart.
# Create data frame
years <- 2000:2005
value <- runif(length(years), min = 100, max = 500)
df <- data.frame(Year = years, Value = value)
df$Value<-round(df$Value,1)
ggplot(df, aes(x = Year, y = Value)) +
geom_line(color = "red", size = 1) +
geom_point(color = "red", size = 1) +
geom_text(aes(label = Value), vjust = -0.5, size = 4) +
labs(title = " ",
x = " ",
y = " ") +
theme_minimal() +
scale_x_continuous(breaks = seq(min(df$Year), max(df$Year), by = 1))+
theme(axis.text.x = element_text(colour = 'black'),
axis.text.y = element_text(colour = 'black'))
This code generates a line chart, but the resulting line is unfortunately not smooth; instead, it appears rough.
Can anyone help me with how to solve this problem and produce a line chart with a smooth, straight line?
1