I cannot find any documentation about the key words in seaborn heat maps for either annot_kws
or cbar_kws
.
Is there a secret place where I can find such things?
A heatmap is a plot of rectangular data as a color-encoded matrix. As parameter it takes a 2D dataset. That dataset can be coerced into an ndarray. This is a great way to visualize data, because it can show the relation between variabels including time.
Displaying the cell values If we want to display the value of the cells, then we pass the parameter annot as True. fmt is used to select the datatype of the contents of the cells displayed.
The annot only help to add numeric value on python heatmap cell but fmt parameter allows to add string (text) values on the cell. Here, we created a 2D numpy array which contains string values and passes to annot along with that pass a string value “s” to fmt.
annot – an array of the same shape as data which is used to annotate the heatmap. cmap – a matplotlib colormap name or object. This maps the data values to the color space. fmt – string formatting code to use when adding annotations. linewidths – sets the width of the lines that will divide each cell.
The docstring of heatmap tells you:
annot_kws : dict of key, value mappings, optional Keyword arguments for ax.text when annot is True.
cbar_kws : dict of key, value mappings, optional Keyword arguments for fig.colorbar.
That means that those dictionaries pass keyword arguments directly to the underlying matplotlib
structures.
annot_kws
are keywords for ax.text
, cbar_kws
are keywords for fig.colorbar
.
So in order to find out possible arguments you have to look into the matplotlib
documentation for these objects.
Here is the documentation of figure.colorbar
.
Here is the documentation of axis.text
, which gives you a link where you can find an explanation for the keyword arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With