Ideally, the map shows 5 colors (using defined 5 patterns) and the legend shows 5 categories. Hower, the problem is that whenever the dataset does not have the value for a category in "sum&i" (e.g., variable "sum&i" contains no values of 0) , the legend will only show 4 categories instead of 5, and the colors will also be wrong (e.g., category "1-5 Patients" will then be mapped white instead of grayca).
Does anybody know how to show all categories in the legend even if the data set does not have all category values? Thanks!
In situations with discrete values, I'd recommend specifying the values you want in the legend via the "midpoints=" in gmap. But in this case where you have "ranges" of values that are being mapped into discrete bins using user-defined formats, I'm not sure that's possible.
But a sure-fire way to get what you're wanting is to insert "fake" values into the data - 1 value in each of the possible ranges. And by "fake", I mean assign them to a map area that doesn't actually exist in the geographical map (I like to use a map id of '.' (missing)).
Here is an example - the first map's data doesn't cover all the ranges in the user-defined format, and the 2nd map (with the addition of 'fake' data) does...