Really enjoying tmap, and very happy to see the inclusion of histograms. Can that hist object be modified in any way? See below how the natural histogram object is somewhat squished.

enter image description here

this_name = "Cumberland"
this_county = nc_cr[nc_cr$NAME == this_name,]
tm_shape(this_county) +
  tm_shape(this_county) +
  tm_borders("black") + 
           size=2)+ #spectral or set1 RdYlGn
  tm_dots(col="type", palette="Spectral", legend.hist=T, title="Environmental Exposure Type", scale=1.2,size=.1)+
  #tm_markers(col="type", legend.hist=T, title="Environmental Exposure Type", scale=1.2,size=.1)+
  tm_layout(frame = F, inner.margins = 0, outer.margins = 0, asp = 0, legend.text.size = 1)+
  tm_legend(legend.outside=T, legend.outside.position="right")

1 Answer 1


Yes. The width can be adjusted using "legend.hist.width" under the tm_layout function in tmap. You might want to try tm_layout(legend.hist.width = .5) or something like that. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.