|
| 1 | +.. _heatmap-chart-ref: |
| 2 | + |
| 3 | +================= |
| 4 | +Heatmap Reference |
| 5 | +================= |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :depth: 1 |
| 13 | + :class: singlecol |
| 14 | + |
| 15 | +A heatmap represents data in a tabular format as a range of color. A |
| 16 | +darker, or more intense, color represents a larger aggregated value |
| 17 | +for a particular data point. |
| 18 | + |
| 19 | +Heatmap Encoding Channels |
| 20 | +------------------------- |
| 21 | + |
| 22 | +Heatmaps provide the following :ref:`encoding channels |
| 23 | +<encoding-channels>`: |
| 24 | + |
| 25 | +.. list-table:: |
| 26 | + :header-rows: 1 |
| 27 | + :widths: 20 80 |
| 28 | + |
| 29 | + * - Encoding Channel |
| 30 | + - Description |
| 31 | + |
| 32 | + * - X Axis |
| 33 | + - A :guilabel:`category` encoding channel that creates a category |
| 34 | + along the X axis for each unique value in this field. |
| 35 | + |
| 36 | + * - Y Axis |
| 37 | + - A :guilabel:`category` encoding channel that creates a category |
| 38 | + along the Y axis for each unique value in this field. |
| 39 | + |
| 40 | + * - Intensity |
| 41 | + - An :guilabel:`aggregation` encoding channel that changes the |
| 42 | + shading of the matrix elements to reflect the aggregated value |
| 43 | + of this field. Darker colors in the visualization reflect |
| 44 | + greater aggregated values. |
| 45 | + |
| 46 | +.. note:: |
| 47 | + |
| 48 | + Heatmaps support :ref:`sorting <charts-sort-data>` and |
| 49 | + :ref:`limiting <charts-limit-data>` for the |
| 50 | + :guilabel:`X Axis` encoding channel, but not the |
| 51 | + :guilabel:`Y Axis` channel. |
| 52 | + |
| 53 | +Use Cases |
| 54 | +--------- |
| 55 | + |
| 56 | +Heatmaps reveal patterns or trends within your data. Use heatmaps |
| 57 | +when the exact data values are not as important as depicting |
| 58 | +higher-level trends and relationships between your data points. They |
| 59 | +can also highlight any significant outliers, or points which strongly |
| 60 | +go against the general direction of your data. A heatmap is a good |
| 61 | +choice to display: |
| 62 | + |
| 63 | +- A comparison of average room rental prices based on location and |
| 64 | + property type. |
| 65 | + |
| 66 | +- Geographic data, such as election results across different districts |
| 67 | + or population density. |
| 68 | + |
| 69 | +- The number of customer orders across various store locations by month |
| 70 | + of the year. |
| 71 | + |
| 72 | +.. tip:: |
| 73 | + |
| 74 | + Heatmaps work especially well with :ref:`binned <charts-bin-data>` |
| 75 | + data. With naturally ordered datasets, heatmaps highlight areas of |
| 76 | + concentration within the data. |
| 77 | + |
| 78 | +Example |
| 79 | +------- |
| 80 | + |
| 81 | +The following chart visualizes data pertaining to movies. Each |
| 82 | +document in the collection represents a movie and contains general |
| 83 | +information about the film as well as ratings from critics. This |
| 84 | +heatmap shows the mean (average) `Metacritic |
| 85 | +<http://www.metacritic.com/>`_ rating for different movie genres |
| 86 | +(Y Axis) over time (X Axis): |
| 87 | + |
| 88 | +.. figure:: /images/charts/heatmap-example.png |
| 89 | + :figwidth: 720px |
| 90 | + :alt: Heatmap example |
| 91 | + |
| 92 | +We :ref:`bin <charts-bin-data>` the years along the X Axis into |
| 93 | +decades and aggregate to find the :guilabel:`mean` ``metacritic`` score |
| 94 | +of films from each genre released in each decade. |
| 95 | + |
| 96 | +The :guilabel:`intensity` field of ``metacritic`` shades each grid |
| 97 | +element based on the mean ``metacritic`` field of all of the |
| 98 | +intersecting documents based on the :guilabel:`X` and |
| 99 | +:guilabel:`Y axes` fields. Based on the chart, we see that |
| 100 | +from ``1930-1940`` there are a few genres with very high |
| 101 | +average Metacritic scores, and over time a more even distribution of |
| 102 | +film ratings begins to occur. |
| 103 | + |
| 104 | +.. note:: |
| 105 | + |
| 106 | + If the space is white, there are no movies from that decade of that |
| 107 | + particular genre in the dataset. |
0 commit comments