tmap icon indicating copy to clipboard operation
tmap copied to clipboard

Ways to control "log10" continuous color scale

Open hinojojojo opened this issue 3 years ago • 1 comments

Currently, "log10" option in style its kind of restrictive on the data ranges it can take, it literally can only go in breaks at 10^n, e.g. 10, 100, 1000, 10000, and spanning the whole data range in the raster... i.e. the user cannot fine control the breaks. There are situations where having but more control on the min and max values mapped in a "log" (10 or whatever) would be desirable, similar to what can be done in "cont" via breaks argument.

I am assuming that there is not yet a way to do it, as I have tried with different combinations of the arguments without success. It would be great if this functionality could be implemented... i.e. control the range, limits, breaks in the logarithmic color scale

hinojojojo avatar Jan 27 '22 04:01 hinojojojo

Working on this issue in tmap4. Related question: https://stackoverflow.com/questions/71212939/is-there-a-function-to-set-a-minimum-size-for-symbols-in-tmap/71233903?noredirect=1#comment126081646_71233903

The new scale function tm_scale_continuous (which can be applied to any visual variable (color, size, etc) will have arguments:

  • limits: the minimum and maximum data value to be mapped to the visual variable (color, size, etc)
  • outliers: what should happen to data values that are below the minimum or above the maximum limit? ggplot2 seems to set them to NA and doesn't plot them, but I will also add the option to show them at the minimum or maximum value (like a truncation of data values).
  • values.range: the minimum and maximum visual variable values, e.g. the minimum and maximum bubble size, or the brightest and darkest color of a sequential color scale (like the contrast argument in tmap3).

The most difficult part is how to create nicely rounded labels.

mtennekes avatar Mar 06 '22 21:03 mtennekes