Skip to content
Prev 393534 / 398503 Next

Date order question

I converted `date` to a factor and it seemed to work:


```
library(ggplot2)
library(cowplot)
date <- c("12-29","12-30","01-01")
date <- factor(date, labels = unique(date))
PT <- c(.106,.130,.121)
data <- data.frame(date,PT)
ggplot(data, aes(x=date,y=PT,group=1))+
  geom_point(size=4)+
  geom_line()+
  geom_hline(yintercept =c(1,.60,0,.30,.25,.2))+
  scale_y_continuous(label=scales::label_percent(),breaks=c(1,0.6,0,.3,0.25,0.2))+
  annotate("text", x=2.5, y=.1, label="Very Good",size=5,fontface="bold")+
  annotate("text", x=2.5, y=.225, label="Good",size=5,fontface="bold")+
  annotate("text", x=2.5, y=.28, label="Marginal",size=5,fontface="bold") +
  annotate("text", x=2.5, y=.45, label="Inadequate",size=6,fontface="bold")+
  annotate("text", x=2.5, y=.8, label="OOC",size=6,fontface="bold")+
  annotate("text", x=2.5, y=-.05, label="PT Not Done",size=5,fontface="bold")+
  theme_cowplot()
```

On Wed, Jan 4, 2023 at 4:09 PM Thomas Subia
<thomas.subia at fmindustries.com> wrote:
Message-ID: <CAPcHnpR2Kx0kwWv9+rXhR=zUXoe7J3JAhqwfhNkb8Gd-ivLYRQ@mail.gmail.com>
In-Reply-To: <BY5PR12MB5512AA7ADEE6A85B5E97A4E0ECF59@BY5PR12MB5512.namprd12.prod.outlook.com>