Hello,
I am analysing datas about the occurence of butterflies on different sectors, and I tried to make a graph about some levels (too complicate to explain). It worked, but when I tried to save the image it saved only a blank one.
Can someone help me ?
here is my script (sorry it's in french but if you can answer I don't think you need the # ) :
setwd("//FRNC2/Data/data/stages/mina.le-quellec/Scripts R")
I- Entrée des données ---------------------
donnees_2021 = read.csv("donnees_2021.csv")
colnames(donnees_2021) <- c("Transect", "Date",
"Noms.scientifiques", "Effectif")
stenoecie = read.csv("Stenoecie.csv")
a) Lier données avec espèces sténoèces ---------------
Prop_steno = merge(donnees_2021,stenoecie,all=TRUE)
b) Création d'un tableau prop2 en retirant les NA ---------
Prop2 = na.omit(Prop_steno)
II- Diagramme en barre espèces sténoèces en fonction transects ---------
a) On ajoute un ligne au tableau nommée Diversite_specifique ---------
Prop2$Diversite_specifique = 1
b) Diagramme ----------
library(ggplot2)
ggplot(data=Prop2, aes(x=Transect, y=Diversite_specifique,
fill=STENOECIE)) +
geom_bar(stat="identity") + scale_fill_manual(values=c("gray48",
"forestgreen",
"gold2",
"orangered",
"red4"))
jpeg(filename =
"Proportion des différentes sténoécie en fonction des transects.jpeg")
dev.off()