Hi Ani, Blame Mercator. Maps draws an approximately 2x1 plot. Maybe this: mappar<-par("usr") rect(mappar[1],mappar[3],mappar[2],mappar[4])
Jim On Fri, Jan 7, 2022 at 6:25 PM ani jaya <gaaa...@gmail.com> wrote: > > Dear R expert, > > I try to box a figure using box(). However it box the default margin, > not the specified margin. > > #working as expected > barplot(1:20) > box() > > #working as expected, the box follow the margin > par(mar=c(2, 6, 5, 4)) > barplot(1:20) > box() > > #not working > install.packages("maps") > library(maps) > par(mar=c(2, 6, 5, 4)) > m<-map('world', xlim = c(91, 142), ylim = c(25, 40), > lwd=1.5, col = "grey",border=NA, fill = T, bg="white") > box() > > #the turnaround > par(mar=c(2, 6, 5, 4)) > m<-map('world', xlim = c(91, 142), ylim = c(25, 40), > lwd=1.5, col = "grey",border=NA, fill = T, bg="white") > par(mar=c(2, 6, 5, 4)) > box() > > I just curious with this behavior. Is it the problem with the package > "map" or box() function? > Thank you. > > > sessionInfo() > R version 4.0.2 (2020-06-22) > Platform: i386-w64-mingw32/i386 (32-bit) > Running under: Windows 10 x64 (build 19043) > > > > Ani > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.