Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to draw a heat map with blank space in R language ggplot2

Shulou Source: shulou.com Published: 2022-06-01 22:06:28 10月03日 Update

This article shows you how R language ggplot2 draws a heat map with white space, concise and easy to understand, absolutely can make your eyes shine, through the detailed introduction of this article I hope you can gain something.

image.png

Before someone in the public number message asked how to achieve this picture at the beginning of the article, the following B picture is a broken line chart plus a column chart, relatively easy to achieve, the above A picture is a little more complex, I think of the way is puzzle, Figure A can be regarded as three heat maps, then add a stacked column chart, and finally combine the four pictures together. Let's try this idea and see if it can be realized.

First draw a heat map

This heat map is slightly different from the conventional one. It can be simply understood as a heat map with missing values. Missing values are blank cells, and other values are filled in colors.

So let's structure the data along these lines.

image.png

Organize the data set according to the above format and store it in csv file.

The first is to read in the data df

Tags: Heat map data format missing blank article face language content method beginning idea skill knowledge color complexity conciseness next concise three Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Linux Shulou Information NVidia vpn