Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

R language ggplot2 how to draw heat map and add color bar of grouping information

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

This article is about the R language ggplot2 how to draw heat maps to add grouping information color bar, the editor thinks it is very practical, so share it with you to learn, I hope you can get something after reading this article, not to say much, follow the editor to have a look.

Image.png

Earlier, someone left a message on the official account and asked how to realize this picture at the beginning of the article. The following figure B is a line chart plus a column chart, which is relatively easy to implement. The A figure above is a little complicated. I can think of a puzzle. Figure A can be seen as three heat maps, then add a stacked column chart, and finally combine the four graphs together. Then follow this line of thinking and try to see if it can be achieved.

The original idea is that the color bar on the left is realized with a stacked bar chart. I read the tweet of Uncle Y's official account about the aplot package again and found that it was realized with the geom_tile () function. It is more convenient to think about it or the geom_tile () function.

First of all, solve the problem left over from yesterday: how to add underscores when ggplot2 draws pictures and adds text content.

Thank you very much for your message.

A small example of underlining text

Df

Tags: Heat map color grouping language article information next three underline example public content function beginning data more knowledge article question face Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Docker Redmi NVidia MariaDB