Chapter 12 Legend

12.1 Removing the legend

Removing the legend entirely can be achieved by setting legend = FALSE.

12.2 Size

Changing the size of the legend can be achieved by setting legend.height and legend.width. The size of the text can be set using legend.text.size.

12.3 Vertical spacing

You can increase or decrease the vertical space between the heatmap and the legend using the legeng.vspace argument. The default is set to 0.1.

12.4 Legend breaks

Sometimes it is nice to customize the legend even further. Superheat tries to provide pretty legend breaks, but sometimes fails to do so. You can specify the desired number of breaks presented in the legend using the legend.num.ticks argument. Unfortunately, if the underlying pretty() function that decides the legend breaks does not think your number is a good choice, it will veto your suggestion and do whatever it wants instead.

Alternatively, the legend.breaks argument can be used to manually specify the legend break values (i.e. where the numbers and ticks appear). This argument does not mess with the actual color range or presentation.