Doing a very simple code in ggplot2 where I have a large df of two columns one showing dates and another percent.
#snippet of df this, goes on for 5,000+ rows
date percent
1 1997-04-15 0.78
2 1997-04-16 0.77
3 1997-04-17 0.77
4 1997-04-18 0.77
5 1997-04-21 0.77
# also the dput() of the df not sure if I did this right
structure(list(date = structure(c(9966, 9967, 9968, 9969, 9972,
9973, 9974, 9975, 9976, 9979, 9980, 9981, 9982, 9983, 9986), class = "Date"),
percent = c("0.78", "0.77", "0.77", "0.77", "0.77", "0.79",
"0.79", "0.79", "0.79", "0.79", "0.79", "0.79", "0.79", "0.79",
"0.79")), .Names = c("date", "percent"), row.names = c(NA,
15L), class = "data.frame")
Currently my ggplot()
is something simple
ggplot( short_df, aes( date, percent ) ) + geom_line()
I try to plot a small snippet of the df to get a good idea of how the plot is going to look and I was greated by this:
When I do geom_point()
the plot seems fine.
My second question is when plotting the entire df the plot seems to include every percent value:
I add scale_y_discrete( breaks = pretty( DF$percent ) )
to the previous code and when I use the short_df
the plot seems to split the ticks fine:
However, when I do it on the actual df it shows me a y axis with one tick:
I do get a warning:
Warning message: In pretty.default(BSD$percent) : NAs introduced by coercion