GMT Question: Choropleth Map Does not Show Color

Hi all,

I am trying tutorial from this:

First of all, it actually needs to have .shx file besides .shp files, but when I try to plot it the colors are missing. Why?

using GMT, DataFrames, CSV

Pt = gmtread("/home/browni/LasthrimProjection/testjulia185/concelhos.shp", no_islands=true);
incidence ="/home/browni/LasthrimProjection/testjulia185/data_concelhos_incidencia.csv", DataFrame);

#Get the rate of incidence in number of infected per 100,000 habitants for the last reported week.

r = collect(incidence[end, 20:end]);
ids = names(incidence)[20:end];

#  the names in dataconcelhosincidencia.csv and the concelhos.shp do not use the same case 
# (one is full upper case) so we need to use the nocase=truenocase=true below

zvals = polygonlevels(Pt, ids, r, att="NAME_2", nocase=true);

# Create a Colormap to paint the district polygons

C = makecpt(range=(0,1500,10), inverse=true, cmap=:oleron, hinge=240, bg=:o);

# Get the date for the data being represented to use in title
date = incidence[end,1];

plot(Pt, level=zvals, cmap=C, pen=0.5, 
	title="Infected / 100.000 habitants " * date)

	offset=(-2.4,-4)), color=C, axes=(annot=100,), show=true)

Don’t use that link. Use the official manual Choropleths And that example is more complicated because we need to have the data used to create it. It’s there to show what-and-how we can do that type of choropleths. The other examples are simpler and you can download the data used in them.

1 Like

Thanks for this, I didn’t know the link is not official one

The official link is the one shown in the GMT.jl site


1 Like