[R] unique scale color ggplot2

Catalin Roibu c@t@||nro|bu @end|ng |rom gm@||@com
Tue Jul 7 12:00:11 CEST 2020


Dear R users,

I want to create a plot for multiple sites and to keep the same color range
scale (the correlation values range from -0.5 to 0.7 for all data, but I
have sites with different min and max).

I used this code:
cols<-c("#0288D1", "#039BE5", "#03A9F4","#29B6F6", "#4FC3F7", "#FFCDD2",
"#E57373", "#F44336", "#E53935", "#D32F2F", "#C62828", "#B71C1C")
zCuts <-seq(-.5, 0.6, by = 0.1)
p<-ggplot(df1, aes(x=as.factor(spei), y=as.factor(month), fill = cut(cor,
zCuts))) +
  geom_tile() +
  scale_fill_manual(values=cols)

but for each site the scale color is different.


Please help me to solve this problem!

Thank you!


Bests!

Catalin




-- 

-
-
Catalin-Constantin ROIBU
Lecturer PhD, Forestry engineer
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone      +4 0230 52 29 78, ext. 531
mobile phone    +4 0745 53 18 01
FAX:                +4 0230 52 16 64
silvic.usv.ro <http://www.usv.ro/>

	[[alternative HTML version deleted]]



More information about the R-help mailing list