The plotly code in R:
a1 <- list(
size=1
)
a <- list(
title="BLAST Hit ID",
tickangle="45",
tickfont=a1
)
b <- list(
title="Query ID",
tickfont=a1
)
plot_ly(z=numericMatrix,
y=rownames(numericMatrix),
x=colnames(numericMatrix),
type="heatmap") %>% layout(xaxis=a,yaxis=b)
I would like to have a bar that runs down the left side of the heatmap that contains different colors, such as in the following plot made with heatmap.2
https://friends.manas.ca/Rplot37.png
This was generated with:
par(lend=1, xpd=TRUE)
heatmap.2(numeric_results,
Rowv=FALSE,
Colv=FALSE,
dendrogram="none",
trace="none",
margins=c(8,9),
cexRow=0.5,
cexCol=0.5,
srtCol=45,
RowSideColors = c(rep("gray", 8), rep("blue", 17),
rep("black", 16), rep("green", 3),
rep("purple", 31)))
legend(x=1.07, y=-0.07 ,
legend=c("Bundibugyo", "Reston", "Sudan", "Tai Forest", "Zaire"),
col=c("gray", "blue", "black", "green","purple"), lty = 1, lwd = 10,
bty="n", cex=0.5, seg.len=0.2, xjust=0)
Thanks.
(first asked here https://stackoverflow.com/questions/34449419/how-do-i-add-a-bar-of-categorical-colors-to-a-plotly-heatmap )