create account

R Language - How to Create Pheatmap Chart in R by devpress

View this thread on: hive.blogpeakd.comecency.com
· @devpress ·
$4.33
R Language - How to Create Pheatmap Chart in R
In this post, we take a look at How to Create Pheatmap Chart in R. This chart is often used by the people who are into the analytics and the people who are trying to find out the psychology behind the web page clicks. So this is handy chart. 

Previously we looked at how to create the waffle chart. That chart was something a lot of people wanted to do because it was like githubs progress chart. Now here we are going to be trying out one of the variation of the heatmap. So slight change in the heatmap variation there. 

Rstudio is the tool I am using for plotting the pheatmap. This would bea  good idea for you compared to using the command line of the R terminal for the plots. So use the rstudio if you are planning on making the chart. 

I have created a video to give you an overview on How to Create Pheatmap Chart in R. You should give this one a try.

---

https://www.youtube.com/watch?v=cHAOLrVIDVk

---

For this library you may want to make use of the pheatmap library. You have to install the package and then make sure to use the package for the calling the libarary. 

>install.packages("pheatmap")
library(pheatmap)

You can see the Rstudio after this action like this. 


![rs.png](https://images.hive.blog/DQmYp9Ciuo3mGezDxS3vuZf8Ku7tgqRh6RiR2rijyGFxsVo/rs.png)


Now once installed you are good to go for making the data for this chart. So let's focus on that part.

>set.seed(8)
m <- matrix(rnorm(200), 10, 10)
colnames(m) <- paste("Col", 1:10)
rownames(m) <- paste("Row", 1:10)

This would be making use of the seed and also the column and row each 1x10. So that would be a good start for you to work with. 

Now let's draw the chart using below code. 

>pheatmap(m)

Now take a look at the chart output below. 


![ph.png](https://images.hive.blog/DQmUxihjK1E8avnbUxE6aZyme1EbwSFU52fejVByVRkLZrN/ph.png)

As you can see this is one chart where you would have the dendrogram too. I'd be going in the detail about these in next tutorial. But for now look at the values and also the legend. So you get the gradient color for the legends too. 

That's it. You get the idea on how to draw the pheatmap. Now it's time to do more customization and you would be able to get more points and changes. Like even the orientation of the label is something you would make things cool. I'd say you should check out the those custom changes through documentation. 

Now I have managed to do some of the changes in the pheatmap with say legend colors etc. I can say you should experiment too. Because it'd be more cool based on your data. You can also find some test data on the kaggle. Like this you have option to plot different variations of this plot. 

Once I am done with the datasets and library tutorials, I'd be moving onto the Rstudio tutorials for the cloud too. Because that is something we have not much explored here as well. So that's one of the things that I have plans to explore with the R packages. 

Next in the tutorial series are - dendrogram and CalendR plots. So the plots I have few more in the pipeline. I think Power BI cloud and desktop is something I would going ahead with this year because I have some data connectors to cover as well. 

 If you happen to like this content, do give me feedback over there and that would help me improve my efforts in near future.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 127 others
properties (23)
authordevpress
permlinkr-language-how-to-create-pheatmap-chart-in-r
categoryhive-122108
json_metadata{"tags":["stem","neoxian","vyb","programming"],"image":["https://img.youtube.com/vi/cHAOLrVIDVk/0.jpg","https://images.hive.blog/DQmYp9Ciuo3mGezDxS3vuZf8Ku7tgqRh6RiR2rijyGFxsVo/rs.png","https://images.hive.blog/DQmUxihjK1E8avnbUxE6aZyme1EbwSFU52fejVByVRkLZrN/ph.png"],"links":["https://www.youtube.com/watch?v=cHAOLrVIDVk"],"app":"hiveblog/0.1","format":"markdown"}
created2023-02-25 10:10:06
last_update2023-02-25 10:10:06
depth0
children4
last_payout2023-03-04 10:10:06
cashout_time1969-12-31 23:59:59
total_payout_value2.186 HBD
curator_payout_value2.146 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,304
author_reputation55,061,325,071,240
root_title"R Language - How to Create Pheatmap Chart in R"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,106,399
net_rshares7,700,808,183,656
author_curate_reward""
vote details (191)
@curation-cartel ·
![1UP-PIZZA.png](https://files.peakd.com/file/peakd-hive/curation-cartel/23xediR4hotaNsS5pUJrmYVg3YGeTLpui41uCij2jhUDZ4uFT84zoGJf8a8VnfELXLJgt.png) |  <div class="phishy"><u><h4>You have received a __1UP__ from @gwajnberg!</h4></u></div> The @oneup-cartel will soon upvote you with:<hr> __@stem-curator, @vyb-curator, @neoxag-curator__ <hr>_And they will bring !PIZZA 🍕._
-|-

<sup>[Learn more](https://peakd.com/hive-102223/@flauwy/the-curation-cartel-1up-trigger-smart-voting-mana-and-high-delegation-returns-for-14-different-tribes) about our delegation service to earn daily rewards. Join the Cartel on [Discord](https://discord.gg/mvtAneE3Ca).</sup>
properties (22)
authorcuration-cartel
permlinkre-r-language-how-to-create-pheatmap-chart-in-r-20230227t181858z
categoryhive-122108
json_metadata"{"app": "beem/0.24.26"}"
created2023-02-27 18:18:57
last_update2023-02-27 18:18:57
depth1
children0
last_payout2023-03-06 18:18:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length654
author_reputation1,123,882,653,763
root_title"R Language - How to Create Pheatmap Chart in R"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,176,090
net_rshares0
@gwajnberg ·
thanks for bringing that tutorial! this library is very important to do heatmaps
!1UP
properties (22)
authorgwajnberg
permlinkrqr417
categoryhive-122108
json_metadata{"tags":["stem"],"app":"stemgeeks/0.1","canonical_url":"https://stemgeeks.net/@gwajnberg/rqr417"}
created2023-02-27 18:15:09
last_update2023-02-27 18:15:09
depth1
children0
last_payout2023-03-06 18:15:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length85
author_reputation368,832,952,476,989
root_title"R Language - How to Create Pheatmap Chart in R"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,175,943
net_rshares0
@pizzabot ·
<center>🍕 PIZZA !


I gifted <strong>$PIZZA</strong> slices here:
@curation-cartel<sub>(6/20)</sub> tipped @devpress (x1)


<sub>Learn more at https://hive.pizza!</sub></center>
properties (22)
authorpizzabot
permlinkre-r-language-how-to-create-pheatmap-chart-in-r-20230227t182003z
categoryhive-122108
json_metadata"{"app": "beem/0.24.19"}"
created2023-02-27 18:20:03
last_update2023-02-27 18:20:03
depth1
children0
last_payout2023-03-06 18:20:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length177
author_reputation7,525,271,330,931
root_title"R Language - How to Create Pheatmap Chart in R"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,176,129
net_rshares0
@stemsocial ·
re-devpress-r-language-how-to-create-pheatmap-chart-in-r-20230225t221356813z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-devpress-r-language-how-to-create-pheatmap-chart-in-r-20230225t221356813z
categoryhive-122108
json_metadata{"app":"STEMsocial"}
created2023-02-25 22:13:57
last_update2023-02-25 22:13:57
depth1
children0
last_payout2023-03-04 22:13:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,916,197,379,817
root_title"R Language - How to Create Pheatmap Chart in R"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,122,787
net_rshares0