We are trying to print some Finnish forestry maps using R. The map is drawn nicely but some of numbers in the legends are not shown in their full length, but in the format 3e+06.
This seem to happen when the size of a row in the legend is too long. This might be problem for some users.
I have been looking for how to change it to show the full numbers. Any ideas how to fix this will be appreciated as I have been battling with this for several days. Source below.
library(maptools)
library(RColorBrewer)
library(classInt)
Sys.setlocale(category = 'LC_ALL', locale = 'fi_FI@euro')
png(file="tupatmp/950fi_4.png", height=600, width=600, res=100)
basemap <- readShapePoly("shp/metsakeskus.shp",IDvar="mknro_1")
xx <- basemap[basemap$att.data$mknro_1 %in% c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)]
csv <- read.csv("tupatmp/950fi.csv")
plotvar <- csv$k_4
nclr <- 8
plotclr <- brewer.pal(nclr,"RdYlGn")
options(digits = 10)
class <- classIntervals(plotvar,
nclr,
style="fixed",
fixedBreaks=c(0,5000,10000,15000,20000,250000,3000000,3500000,40000000))
colcode <- findColours(class, plotclr,digits = getOption(digits))
plot(xx,col=colcode)
par(family="sans")
par(mgp = c(0,1,0))
title(main = "Nettotulojen nykyarvon maksimointi 5% korkokannalla 2037
Ahvenanmaa, Lounais-Suomi, Häme-Uusimaa, Kaakkois-Suomi, Pirkanmaa, Etelä-Savo, Etelä-Pohjanmaa, Keski-Suomi, Pohjois-Savo, Pohjois-Karjala, Kainuu, Pohjois-Pohjanmaa, Lappi, Rannikko (pohjanmaa), Rannikko (etelärannikko)",
sub = "Kantohinta-arvo Käytönrajoitus: Puuntuotannon ulkopuolella",
font.main=2,cex.main=0.9,cex.sub=0.9)
legend(2730000,7315000,
title="1000eur",legend=names(attr(colcode,"table")),
fill=attr(colcode,"palette"),
border="black", cex=0.8,bty="o", xpd="FALSE")
dev.off()