library(ggplot2)
source("~/R/skryptydoR/varia/ggplot_theme_publication.R")
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
ewa <- read.csv("~/Desktop/ewa.csv", header=F)
ewa$V1 <- as.character(ewa$V1)


ggplot(ewa, aes(x = V1, y=V2))+geom_bar(stat="identity", fill="lightblue")+ ylab("suma opadu rocznego (mm)") + xlab("rok")+
  geom_hline(aes(yintercept=mean(ewa$V2)), color="blue")+
  scale_y_continuous(expand=c(0,0)) +
  theme_Publication()+
  theme(axis.text.x = element_text(colour="grey20",size=10, angle=50, hjust=1),
        axis.text.y = element_text(colour="grey20",size=11))+
  guides(color=guide_legend(override.aes=list(fill=NA))) # usuwa szary kolor z legendy

# wykres nr 2

ewa2 <- read.csv("~/Desktop/ewa2.csv", header=T)
etykiety <- ewa2$mies[1:24]
etykiety[1:12*2] <- NA

barplot(ewa2$max[1:24], col = c("red","blue"), names.arg = NA, las=3, ylab = "sumy opadu (mm)", xlab="", xpd = F, ylim=c(-15,220))
text(0.5:24*1.2, ewa2$max[1:24]+5, ewa2$max[1:24])
text(0.5:24*1.2, -5, ewa2$rok[1:24], srt=0, cex=0.8, col=c("red","blue"))


abline(h=0:4*50, lty=2)
axis(1, at = 1:24*1.2, etykiety, tick=NA, line = NA, lwd = 0, las=2, hadj=0.8)