I have made a heatscatter plot in R (I am new to R) and it looks good but I would like to add a Key to label what the colours represent (datapoint depth). This would be a really good feature to help the reader of the figure to understand what it means quickly but I cannot see this feature in the documentation.
Any help would be great!
For_R_PSI_only <- read.table('For_R_PSI_only.txt', sep="\t", header=TRUE)
library(LSD)
heatscatter(For_R_PSI_only$WT_exp2,For_R_PSI_only$WT_exp3, colpal="bl2gr2rd", xlab='1',ylab='1')
Were you asking about legend by any chance?
I think OP is indeed referring to the legend.
Yes, a legend to indicate what density level the colours in the plot represent.
An alternative to a heatscatter plot is a plot with Hexagonal Binning. You can create such a plot using
stat_binhex()
function in the ggplot2 package orhexbinplot()
function in the hexbin package. You may also find this useful.The script you're using to generate the plot would help us get an idea of your approach and where a potential solution could be plugged in. Could you add that maybe?
Ah, sorry about that, here is the code (added to original post).
Please also add the line
library(LSD)
just so people are clear on the library in play here. The authors seem to have given no pointers to adding a legend. Maybe look for a different library that supports heat maps better (like MASS).These links might be of help: