library(tidyverse) locus <- as_tibble(read.delim("locus.tsv", header=F)) colnames(locus) <- c("name","length") locus %>% mutate(name=reorder(name, desc(as.numeric(length)))) %>% mutate(id=as.numeric(factor(name))) %>% mutate(L50=ifelse(id==8,1,0)) %>% ggplot(aes(id, length))+ geom_point(aes(color=L50, size = L50))+ geom_line()+ theme_minimal()+ scale_x_continuous(breaks = 1:55, labels = locus$name)+ theme(axis.text.x = element_text(angle = 90))+ xlab("locus")+ scale_color_continuous(palette = c("black", "red"))+ scale_size_continuous(limits=c(0,5))+ guides(size="none", color="none") ggsave("locus.png")