diff --git a/R/confidSensib.R b/R/confidSensib.R index f675c8d..b3635b7 100644 --- a/R/confidSensib.R +++ b/R/confidSensib.R @@ -128,20 +128,30 @@ confidSensib<-function(inputDf="", filePath="", nPoints=5, data$Kept<-factor(data$Kept,levels=c("confidence >= threshold","confidence < threshold")) # graphics - etiquette<-paste0("average agreement percentage for LCZ with no confidence value : ", - NAPercAgr," \n (these ",nbOutCasted," geoms are excluded from computing other points)") - + etiquette<-paste0("average agreement percentage for \n LCZ with no confidence value : ", + NAPercAgr, + " \n (these ", + nbOutCasted," geoms are excluded from computing other points)") + pointSize<-20/sqrt(nPoints) confThreshPlot<-ggplot(data=data, aes(x=Confidence, y=Agreement, color=Kept, shape=Kept))+ - labs(x="Confidence threshold", color = "Geom set", shape="Geom set")+ - scale_fill_discrete(breaks=c("confidence >= threshold","confidence < threshold"),)+ + labs(color = "Kept Geometries", shape="Kept Geometries")+ + #scale_fill_discrete(breaks=c("confidence >= threshold","confidence < threshold"),)+ scale_color_manual(values = c("confidence >= threshold" = "#00BFC4", "confidence < threshold" = "#F8766D"))+ - geom_point() + - geom_text(aes(x=Confidence,y=Agreement,label=nbGeoms), nudge_y=-2)+ + geom_point(size=rel(pointSize)) + + geom_text(aes(x=Confidence,y=Agreement,label=nbGeoms), nudge_y=-2,size=rel(pointSize),show.legend=FALSE)+ geom_hline(yintercept=NAPercAgr,linetype='dashed',color='grey')+ - geom_text(aes(x=0.50,y=NAPercAgr,label=etiquette,vjust=1.5),inherit.aes=F,color='darkgrey',size=4)+ + geom_text(aes(x=0.50,y=NAPercAgr,label=etiquette,vjust=1.5,), + inherit.aes=F,color='darkgrey',size=rel(6))+ ggtitle(label="Agreement according to the minimum confidence granted to LCZ level", - subtitle="Number of geoms used to compute agreement written under each point") + subtitle="Number of geoms used to compute agreement written under each point")+ + theme(axis.title.x=element_text(size=rel(1.8)), + axis.title.y=element_text(size=rel(1.8)), + axis.text=element_text(size=rel(2)), + plot.title = element_text(size=rel(2)), + plot.subtitle = element_text(size=rel(2)), + legend.title=element_text(size=rel(1.8)), + legend.text = element_text(size=rel(1.5)) ) ctOut<-list(ctPlot=confThreshPlot,ctData=data) return(ctOut) @@ -180,17 +190,25 @@ typeLevels<-unique(echIntConf[,column1]) %>% as.vector for (i in names(sortieParLCZ)){ output<-rbind(output,cbind(sortieParLCZ[[i]],LCZ=rep(i,nrow(sortieParLCZ[[i]])))) } - + + pointSize<-13/sqrt(nPoints) byLCZPLot<-ggplot(data=output, aes(x=Confidence, y=Agreement, color=Kept, shape=Kept))+ - labs(x="Confidence threshold", color = "Geom set", shape="Geom set")+ + labs(x="Confidence threshold", color = "Geom set", shape="Geom set",size=rel(1.3))+ scale_fill_discrete(breaks=c("confidence >= threshold","confidence < threshold"),)+ scale_color_manual(values = c("confidence >= threshold" = "#00BFC4", "confidence < threshold" = "#F8766D"))+ - geom_point() + - geom_text(aes(x=Confidence,y=Agreement,label=nbGeoms), nudge_y=-4.3)+ + geom_point(size=rel(pointSize)) + + geom_text(aes(x=Confidence,y=Agreement,label=nbGeoms), nudge_y=-6.3,show.legend=FALSE,size=rel(pointSize))+ ggtitle(label="Agreement by minimum confidence within LCZ level", subtitle="Number of geoms used to compute agreement written under each point")+ - facet_wrap(~LCZ, drop=TRUE) + facet_wrap(~LCZ, drop=TRUE)+ + theme(axis.title.x=element_text(size=rel(1.8)), + axis.title.y=element_text(size=rel(1.8)), + axis.text=element_text(size=rel(1.6)), + plot.title = element_text(size=rel(2)), + plot.subtitle = element_text(size=rel(1.8)), + legend.title=element_text(size=rel(1.8)), + legend.text = element_text(size=rel(1.5))) if (plot==TRUE){ diff --git a/R/produceAnalysis.R b/R/produceAnalysis.R index b2573da..850a78d 100644 --- a/R/produceAnalysis.R +++ b/R/produceAnalysis.R @@ -35,8 +35,7 @@ produceAnalysis<-function(location="Redon", wf1="bdtopo_2_2", wf2="osm",refYear1="2022",refYear2="2022",repr="standard",saveG=location,...) { - wd<-getwd() -#setwd(outDir) + args<-list(...) indSep<-names(args) indCol<-grep(x=indSep,pattern="colors") @@ -106,7 +105,7 @@ if(repr=="standard"){ nameG<-paste0(location,"_",wf1,"_",wf2,"_",repr) # Compare LCZ - condition<-((wf1=="osm" | wf1=="bdtopo_2_2") & (wf2=="bdtopo_2_2" | wf2=="osm")) + if((wf1=="osm" | wf1=="bdtopo_2_2") & (wf2=="bdtopo_2_2" | wf2=="osm")){ print("compareLCZ called") diff --git a/inst/tinytest/test_confidSensib.R b/inst/tinytest/test_confidSensib.R index 2452e86..ca0654a 100644 --- a/inst/tinytest/test_confidSensib.R +++ b/inst/tinytest/test_confidSensib.R @@ -20,7 +20,10 @@ confidTest1<-confidSensib(inputDf=testSourceFact, filePath="", nPoints=5, "containing missing values") expect_warning( - confidTest2<-confidSensib(filePath=paste0(system.file("extdata", package = "lczexplore"),"/bdtopo_2_2_osm.csv"), nPoints=5, + confidTest2<-confidSensib(filePath=paste0( + system.file("extdata", package = "lczexplore"), + "/bdtopo_2_2_osm.csv"), + nPoints=5, wf1="bdtopo_2_2", wf2="osm", geomID1="ID_RSU", column1="LCZ_PRIMARY", confid1="LCZ_UNIQUENESS_VALUE", geomID2="ID_RSU.1",column2="LCZ_PRIMARY.1", confid2="LCZ_UNIQUENESS_VALUE.1", diff --git a/vignettes/lczexplore_alter.Rmd b/vignettes/lczexplore_alter.Rmd index ca4bed9..1dff9eb 100644 --- a/vignettes/lczexplore_alter.Rmd +++ b/vignettes/lczexplore_alter.Rmd @@ -17,7 +17,7 @@ knitr::opts_chunk$set( comment = "#>" ) if (!require("png")) { - install.packages("png") + install.packages("png",repos = "http://cran.us.r-project.org") library("png") } diff --git a/vignettes/lczexplore_en.Rmd b/vignettes/lczexplore_en.Rmd index 9183d48..a0d16a6 100644 --- a/vignettes/lczexplore_en.Rmd +++ b/vignettes/lczexplore_en.Rmd @@ -17,7 +17,7 @@ knitr::opts_chunk$set( comment = "#>" ) if (!require("png")) { - install.packages("png") + install.packages("png",repos = "http://cran.us.r-project.org") library("png") } diff --git a/vignettes/lczexplore_fr.Rmd b/vignettes/lczexplore_fr.Rmd index e2d64f0..abd6997 100644 --- a/vignettes/lczexplore_fr.Rmd +++ b/vignettes/lczexplore_fr.Rmd @@ -20,7 +20,7 @@ knitr::opts_chunk$set( ) if (!require("png")) { - install.packages("png") + install.packages("png",repos = "http://cran.us.r-project.org") library("png") } diff --git a/vignettes/lczexplore_raster_vector.Rmd b/vignettes/lczexplore_raster_vector.Rmd index 446907f..68c4cca 100644 --- a/vignettes/lczexplore_raster_vector.Rmd +++ b/vignettes/lczexplore_raster_vector.Rmd @@ -17,7 +17,7 @@ knitr::opts_chunk$set( comment = "#>" ) if (!require("png")) { - install.packages("png") + install.packages("png",repos = "http://cran.us.r-project.org") library("png") }