plot country in white if their value is zero?

32 views
Skip to first unread message

helena jam

unread,
Oct 31, 2016, 4:12:51 PM10/31/16
to rworldmap
Guys, admittedly I am new to this, but since I spend a day looking at tutorials I now feel I can safely ask: I have values for countries, e.g. Olympic medals in gold - and most countries did not win one! But the legend always adds the faintest color to the value 0 - when i really want it to be without color! The legend and coloring should start at n= 1!
Hope you can help, and I am very pleased if you just guide me to a better tutorial/documentation!

Jean-Baka Domelevo Entfellner

unread,
Nov 1, 2016, 6:37:02 AM11/1/16
to helena jam, rworldmap
Hi Helena,

I would suggest you change your 0s into NAs before drawing and then use the missingCountryCol option of mapCountryData(), or alternatively you can use the colourPalette option to play with the colour you want for the countries with data 0.

And then to hide some levels in the legend, you can use the options coulourVector and cutVector of the addMapLegend() function to tweak the legend to your needs of not displaying the colour for value 0.

Please post code snippet if you're still unsuccessful on this.

Regards,
   JB

On Mon, Oct 31, 2016 at 10:12 PM, helena jam <hja...@gmail.com> wrote:
Guys, admittedly I am new to this, but since I spend a day looking at tutorials I now feel I can safely ask: I have values for countries, e.g. Olympic medals in gold - and most countries did not win one! But the legend always adds the faintest color to the value 0 - when i really want it to be without color! The legend and coloring should start at n= 1!
Hope you can help, and I am very pleased if you just guide me to a better tutorial/documentation!

--
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/16451384-5cb7-4b45-87df-6dda4f496f26%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages