MCPcopy Create free account
hub / github.com/holoviz/hvplot / heatmap

Method heatmap

hvplot/plotting/core.py:602–660  ·  view source on GitHub ↗

`heatmap` visualises tabular data indexed by two key dimensions as a grid of colored values. This allows spotting correlations in multivariate data and provides a high-level overview of how the two variables are plotted. The data can either be shaped as a 2-D array (

(self, x=None, y=None, C=None, colorbar=True, logz=False, **kwds)

Source from the content-addressed store, hash-verified

600 return self(kind='ohlc', x=x, y=y, **kwds)
601
602 def heatmap(self, x=None, y=None, C=None, colorbar=True, logz=False, **kwds):
603 """
604 `heatmap` visualises tabular data indexed by two key dimensions as a grid of colored values.
605 This allows spotting correlations in multivariate data and provides a high-level overview
606 of how the two variables are plotted. The data can either be shaped as a 2-D array
607 (in which case no aggregate will be computed) or as a set of two axis variables and one
608 aggregation variable (on which an aggregation is computed).
609
610 Reference: https://hvplot.holoviz.org/ref/api/manual/hvplot.hvPlot.heatmap.html
611
612 Plotting options: https://hvplot.holoviz.org/ref/plotting_options/index.html
613
614 Parameters
615 ----------
616 x : string, optional
617 Field name to draw x-positions from. In the data as an array
618 case, setting x to None assumes drawing x labels from the column names,
619 which can be explicitly declared by setting x to ``'columns'``.
620 Can refer to continuous and categorical data.
621 y : string, optional
622 Field name to draw y-positions from. In the data as an array
623 case, setting y to None assumes drawing y labels from the index,
624 which can be explicitly declared by setting y to ``'index'`` or
625 to the index name. Can refer to continuous and categorical data.
626 C : string, optional
627 Field to draw heatmap color from. If not specified a simple count will be used.
628 colorbar: boolean, optional
629 Whether to display a colorbar. Default is True.
630 logz : bool
631 Whether to apply log scaling to the z-axis. Default is False.
632 reduce_function : function, optional
633 Function to compute statistics for heatmap, for example ``np.mean``.
634 If omitted, no aggregation is applied and duplicate values are dropped.
635 **kwds : optional
636 Additional keywords arguments are documented in :ref:`plot-options`.
637 Run ``hvplot.help('heatmap')`` for the full method documentation.
638
639 Returns
640 -------
641 :class:`holoviews:holoviews.element.HeatMap` / Panel object
642 You can `print` the object to study its composition and run:
643
644 .. code-block::
645
646 import holoviews as hv
647 hv.help(the_holoviews_object)
648
649 to learn more about its parameters and options.
650
651 References
652 ----------
653
654 - Bokeh: https://docs.bokeh.org/en/latest/docs/examples/topics/categorical/heatmap_unemployment.html
655 - HoloViews: https://holoviews.org/reference/elements/bokeh/HeatMap.html
656 - Matplotlib: https://matplotlib.org/stable/gallery/images_contours_and_fields/image_annotated_heatmap.html
657 - Plotly: https://plotly.com/python/heatmaps/
658 - Wiki: https://en.wikipedia.org/wiki/Heat_map
659 """

Calls

no outgoing calls