[R] Dividing a map by electoral results with R?
Jim Lemon
drjimlemon at gmail.com
Fri Mar 6 10:21:00 CET 2015
Hi Evelyne,
Not really easy, as you have to work out the upper (55) and lower (47.27)
latitudes of Germany, but try this:
DEylim<-c(47.27,55)
DENS<-diff(DEylim)
clip(5.8,15.1,DEylim[2]-0.494*DENS,DEylim[2])
abline(h=60)
map("worldHires","Germany",fill=TRUE,col="blue")
text(10.3,52.5,"CDU/CSU",col="white")
clip(5.8,15.1,DEylim[2]-0.799*DENS,DEylim[2]-0.494*DENS)
abline(h=60)
map("worldHires","Germany",fill=TRUE,col="red",add=TRUE)
text(10.3,50,"SPD",col="white")
clip(5.8,15.1,DEylim[2]-0.9*DENS,DEylim[2]-0.799*DENS)
abline(h=60)
map("worldHires","Germany",fill=TRUE,col="orange",add=TRUE)
text(10.3,48.5,"LINKE",col="white")
clip(5.8,15.1,DEylim[1],DEylim[2]-0.9*DENS)
abline(h=60)
map("worldHires","Germany",fill=TRUE,col="green",add=TRUE)
text(10.3,47.8,"GRUENE",col="white")
Jim
On Fri, Mar 6, 2015 at 8:12 AM, David Winsemius <dwinsemius at comcast.net>
wrote:
>
> On Mar 5, 2015, at 10:09 AM, Evelyne1991 wrote:
>
> > Hi everyone,
> >
> > I would like to divide a map of Germany vertically by the electoral
> results
> > of 2013:
> >
> >> VoteGermany2013
> > Party Result
> > 1 CDU/CSU 49.4
> > 2 SPD 30.5
> > 3 LINKE 10.2
> > 4 GRUENE 10.0
> >
> > What I'm looking for is very simple: a map divided like a one-bar graph,
> > with 49.4% of the lenght for CDU/CSU, 30.5% for SPD and so on. It would
> be
> > like a single bar divided in parts, but with the form of a country (quite
> > simple in fact).
> >
> > For the map, I'm using:
> >
> > library(maps)
> > library(mapdata)
> > map("worldHires","Germany")
> >
> > Would someone be able to help me?
>
> Please do not crosspost to Rhelp and StackOverflow.
> >
> > View this message in context:
> http://r.789695.n4.nabble.com/Dividing-a-map-by-electoral-results-with-R-tp4704211.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ####
> > R-help at 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.
>
> David Winsemius
> Alameda, CA, USA
>
> ______________________________________________
> R-help at 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.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list