Overlay mapCountryData with mapBars is not working.

74 views
Skip to first unread message

j p_

unread,
Apr 27, 2017, 6:08:52 AM4/27/17
to rworldmap
Dear all,

I am trying to overlay bar charts with a country data map. This does not work , the only thing that works is overlaying the bar chart with the map picture.

Here you find the not working code.

 CP = colorRampPalette(brewer.pal(9,"Blues"))(100)
  worldmap = joinCountryData2Map(raw_data,
                                 joinCode = "ISO3",
                                 nameJoinColumn = "ISO3")
  #mapDevice("x11")
  mapCountryData(worldmap,
                 nameColumnToPlot = "data",
                 catMethod = 'fixedWidth',
                 numCats = 100,
                 colourPalette = CP)

## some code to get  the new data for the barchart


mapBars(dF = df
            , nameX = "LON"
            , nameY = "LAT"
            , nameZs=c("A","B","C")
            , zColours=c(1:3)        
            , addCatLegend = TRUE
            , symbolSize = 4
            , barWidth = 4
            , borderCol = NA
            , add=T                                        
            )

Any ideas why this fails would be very welcome
Thank you
JP




Auto Generated Inline Image 1
Auto Generated Inline Image 2

Wei Zhang

unread,
Apr 27, 2017, 5:10:39 PM4/27/17
to j p_, rworldmap

--
You received this message because you are subscribed to the Google Groups "rworldmap" group.
To post to this group, send email to rwor...@googlegroups.com.
Visit this group at https://groups.google.com/group/rworldmap.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rworldmap/939d744a-a4e5-4fe0-bb25-1182df4f3ac5%40googlegroups.com.

j p_

unread,
Apr 28, 2017, 2:21:13 AM4/28/17
to rworldmap, cerve...@gmail.com
Thank you for the suggestion, i will play with the settings a bit. I was under the impression that the add=T flag in mapBars would take care of everything.

Jp

j p_

unread,
Apr 29, 2017, 9:44:53 AM4/29/17
to rworldmap, cerve...@gmail.com
Actually it doenst really work for me. I cant get the bars to overlap the countries where i want them, also I would have to manually redo this every time i want a larger or smaller version of the map
:-(
JP


On Thursday, 27 April 2017 23:10:39 UTC+2, Wei Zhang wrote:
Reply all
Reply to author
Forward
0 new messages