Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 268

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report