I am looking for way to create a colormap in python/matplotlib that is specific to a designated integer value and remains that integer value. Here is an example of how I define the matlab colormap:
c_map = [1 1 1;... % Integer assignment = 0 - Air - white
0.6 1 0.8;... % Integer assignment = 1 - Water - cyan
1 0.6 0.2]; % Integer assignment = 2 - Sediments - orange
it is later called during the plotting routine by:
colormap(c_map);
pcolor(xvec,zvec,ColorIntegers);
shading interp, colormap, caxis([0 3]), axis ij
The integer values always stay the same (i.e., Air = 0 , Water = 1, sediments = 2).
I've scoured the matplotlib documentation and stack, but haven't found a way to create this specific style colormap, which relates corresponding integers to a color. Most questions deal with diverging, jet, centering, linear, non-linear as opposed to a consistent coloring of specific colormaps. Each color must correspond to that specific integer value.
Any help will be appreciated, thank you in advance.

mapping.index(material)or something like that. Not a nice hack, but still.ywasarray([["water", "water", "sediment", ...]]), and you wanted to convert it to integers.mappingcould be a list (["air", "water", "sediment", "rock"]), or a dict ({"air": 0, "water": 1, "sediment": 2, "rock": 3}). Usingmapping.index(material)for a list, ormapping[material]for a dict, would allow you to automatically convert it to numbers for drawing.