Heatmap in R (3 Examples) | Base R, ggplot2 & plotly Package | How to Create Heatmaps

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 57

  • @RUJedi
    @RUJedi 4 ปีที่แล้ว +5

    Thanks for the great walk-through! Many other videos go through so many unnecessary steps, but you kept it concise and still hit so many comparative points!

    • @StatisticsGlobe
      @StatisticsGlobe  4 ปีที่แล้ว

      That's some awesome feedback, thanks Shawn!

  • @einandaraung6860
    @einandaraung6860 2 ปีที่แล้ว +1

    Thank you for details explaining. I have known many kind of heatmap code.

    • @StatisticsGlobe
      @StatisticsGlobe  2 ปีที่แล้ว

      Thank you for the kind feedback, I'm happy to help!

    • @einandaraung6860
      @einandaraung6860 2 ปีที่แล้ว +1

      @@StatisticsGlobe Can I ask one I want to fix the legend (eg- -3,-1,0,1,3) (I mean the value). So, How should I do. When I run many data but the value is not same.

    • @StatisticsGlobe
      @StatisticsGlobe  2 ปีที่แล้ว

      Are you looking for this? statisticsglobe.com/change-labels-continuous-ggplot2-legend-r

    • @einandaraung6860
      @einandaraung6860 2 ปีที่แล้ว +1

      @@StatisticsGlobe Thanks a lot for your help.

  • @meseretmuche6984
    @meseretmuche6984 ปีที่แล้ว +1

    really thank you for providing us remakable video

    • @matthias.statisticsglobe
      @matthias.statisticsglobe ปีที่แล้ว

      Hi Meseret, thanks for the positive response! Great to hear that the video was helpful!

  • @ARASHIop77
    @ARASHIop77 2 ปีที่แล้ว +1

    Thanks, dear, you are a gem.

  • @eazycooking2140
    @eazycooking2140 3 ปีที่แล้ว +1

    Excellent explanation and content

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว

      This is great to hear, thanks a lot!

  • @elizabeth2918
    @elizabeth2918 ปีที่แล้ว +1

    This was very useful. thank you so much :)

  • @infotainment7246
    @infotainment7246 2 ปีที่แล้ว +1

    Great explanation. I have two groups (A and B). How can I get a heat map? For example, data

    • @StatisticsGlobe
      @StatisticsGlobe  2 ปีที่แล้ว +1

      Thanks mate! You would have to aggregate your data first, and then you would have to format it as a matrix. If you have only two groups, it probably doesn't make much sense, but here is an example based on your data:
      data

    • @infotainment7246
      @infotainment7246 2 ปีที่แล้ว +1

      @@StatisticsGlobe Thanks a lot for your time and support. The samples that I am dealing with are treated and untreated, and can be divided into two groups A and B. This sum function cannot be used. However, thanks to your explanation, I categorized them as A1, A2, A3, B1, etc. then ran the Heatmap(data) code and got what I wanted.

    • @StatisticsGlobe
      @StatisticsGlobe  2 ปีที่แล้ว

      Great to hear that you found a solution! :)

  • @RjAtifAyub
    @RjAtifAyub ปีที่แล้ว +1

    If we copy your script and apply on our original data not on the save data by R then it's gives numeric error. Please tell me how to resolve numeric error issues. Thanks in anticipation.💐

    • @cansustatisticsglobe
      @cansustatisticsglobe ปีที่แล้ว

      Hello Atif,
      What is the exact error that you get?
      Regards,
      Cansu

  • @rajaranidreamhome795
    @rajaranidreamhome795 6 หลายเดือนก่อน +1

    I did all the steps and finally the viewer doesn't shows the plot_ly heat map... What should I do... And also I wanted to change the direction and overlapping x1 axis value for that what I have to do

    • @StatisticsGlobe
      @StatisticsGlobe  6 หลายเดือนก่อน

      Hey, have you used exactly the same code as I did in the video?

    • @rajaranidreamhome795
      @rajaranidreamhome795 6 หลายเดือนก่อน +1

      @@StatisticsGlobe yes exactly the same

    • @StatisticsGlobe
      @StatisticsGlobe  6 หลายเดือนก่อน

      I just executed the code again, and everything worked fine. Did you get any error messages?

  • @Apsaalooke
    @Apsaalooke 3 ปีที่แล้ว +1

    Thank you for all your videos. They're all very useful. Can you explain, please, how to make a spectral analysis by R in one of your videos? Periodogram or something else. Or maybe you've already done it...

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว +1

      Thanks a lot for the very kind words Sergey! Also, thank you for the suggestion! I'm not an expert on this topic, but I'll put it on my to-do list for future tutorials. Regards, Joachim

    • @Apsaalooke
      @Apsaalooke 3 ปีที่แล้ว +1

      @@StatisticsGlobe Sounds great! Thanks in advance!

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว +1

      You are very welcome! :)

  • @YummiestOrphan
    @YummiestOrphan 3 ปีที่แล้ว +1

    Hi,
    How can I use the row names from my file on the heatmap, currently it just says Row 1 all the way to Row 6 rather than the actual title?
    heatmap(as.matrix(my data[, -1]))
    This is the script I'm using, its the only way I could get it to work as its not a matrix apparently. Thank you

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว

      Hey, please check out the labRow and labCol arguments as described here: www.rdocumentation.org/packages/stats/versions/3.6.2/topics/heatmap Regards, Joachim

  • @muhammadusmanali9069
    @muhammadusmanali9069 ปีที่แล้ว +1

    How to creat heat map analysis when i have more then 2 data (i mean to say i have 2 experiment data and i want to creat both data show in one heat map Graph )

    • @cansustatisticsglobe
      @cansustatisticsglobe ปีที่แล้ว

      Hello Muhammed,
      Could you give some more details by providing an example?
      Regards,
      Cansu

  • @samemery4370
    @samemery4370 3 ปีที่แล้ว +1

    What if you wanted more colors than 100 in example 3, how would you do that?

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว

      Hey Sam, I'm sorry for the late response, I just came back from holidays and did not have the chance to read your message earlier. Do you still have problems with this?

  • @shandrymmasetshaba8728
    @shandrymmasetshaba8728 3 ปีที่แล้ว +1

    Thank you for a detailed tutorial!!
    I have a question, what are the codes for inserting colour key on the heatmap?

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว +1

      Hi Shandry, thank you for the nice comment! Are you looking for this? statisticsglobe.com/change-colors-of-ranges-in-ggplot2-heatmap-r Regards, Joachim

    • @shandrymmasetshaba8728
      @shandrymmasetshaba8728 3 ปีที่แล้ว +1

      @@StatisticsGlobe Yes, thanks so much for the link, and the website is very useful.

    • @StatisticsGlobe
      @StatisticsGlobe  3 ปีที่แล้ว

      Thank you Shandry, glad it helped!

  • @Glaszg
    @Glaszg 4 ปีที่แล้ว +1

    Great tutorial! Thanks!

  • @lihe9695
    @lihe9695 4 ปีที่แล้ว +1

    thank you for the tutorial! but how can I create a heatmap with more than 2 colors using the ggplot2 package?

    • @StatisticsGlobe
      @StatisticsGlobe  4 ปีที่แล้ว

      Hi Li, Thanks for the comment! What would be reflected by the 3rd colors? Right now you are having a range of colors between two colors, so what would be the meaning of a completely different color? Regards, Joachim

  • @hugooliveira8234
    @hugooliveira8234 4 ปีที่แล้ว +1

    Great video!!! But when i do create some heatmap using ggplot2, how can i set the values? (in your video for example, the heatmap values were setted as -20 to +20). Thanks!!

    • @StatisticsGlobe
      @StatisticsGlobe  4 ปีที่แล้ว +1

      Hey Hugo, that's a great question! The legend (i.e. "value") is created automatically by the ggplot2 package and depends on the input values of your data frame (i.e. data_melt$value). If you change these values, the legend is changed as well. Regards, Joachim

  • @hr_foods
    @hr_foods 4 ปีที่แล้ว +1

    I want to change color for each columns how I do, because for some column I need positive value or some negative

    • @StatisticsGlobe
      @StatisticsGlobe  4 ปีที่แล้ว

      Hi Sabah, Thanks for the question. To make sure that I got you right: You want to assign a different color combination to each column of the heatmap? Regards, Joachim

    • @hr_foods
      @hr_foods 4 ปีที่แล้ว +1

      @@StatisticsGlobe yes for example In first column I need highest values and use red color and in second I need lowest values but color should be same for both column

    • @StatisticsGlobe
      @StatisticsGlobe  4 ปีที่แล้ว

      @@hr_foods Ah I think I got it. You may modify your data before creating the heatmap, i.e. convert those negative values to positives. Does this make sense? Regards, Joachim

    • @hr_foods
      @hr_foods 4 ปีที่แล้ว

      @@StatisticsGlobe yes

    • @hr_foods
      @hr_foods 4 ปีที่แล้ว

      @@StatisticsGlobe yes but how in R

  • @ankitkachchhi7293
    @ankitkachchhi7293 10 หลายเดือนก่อน

    Have made heatmap successfully except I have 68 labels in data instead I am getting only 34 row labels in the heatmap. Heatmap is perfect but this number of row labels are half

    • @Ifeanyi.StatisticsGlobe
      @Ifeanyi.StatisticsGlobe 9 หลายเดือนก่อน

      Hello, Ankitkachchchi. We are sorry for the late response to your comment. Do you still need help with your query?

    • @ankitkachchhi7293
      @ankitkachchhi7293 9 หลายเดือนก่อน

      @@Ifeanyi.StatisticsGlobe No thnx

    • @Ifeanyi.StatisticsGlobe
      @Ifeanyi.StatisticsGlobe 9 หลายเดือนก่อน

      @@ankitkachchhi7293 Great, Ankitkachchhi. Wish you the best going forward!

    • @ichrakhamdene
      @ichrakhamdene 8 หลายเดือนก่อน

      @@Ifeanyi.StatisticsGlobe Have made heatmap successfully except I have 111 labels in data instead I am getting only 37 row labels in the heatmap.