heatmap

ggplot2 - Heatmap Table by Row

≡放荡痞女 提交于 2019-12-23 05:18:10
问题 I am trying to make a heatmap table, which is fairly easy, but I am wanting the gradient color to be confined within a single row, not over the entire data.frame. The result should be that each row should have the row max and min both present. Basically all examples of heatmaps I can find online create the gradient color scale from all values in the table. Here is an example dataframe: df <- data.frame('var' = paste0('var',1:3), 'group1' = c(1,500,3), 'group2' = c(2,300,1), 'group3' = c(3,100

griddata: QH6214 qhull input error: not enough points(2) to construct initial simplex

一曲冷凌霜 提交于 2019-12-23 04:39:12
问题 I am trying to create an above-head view heat map of relatively sparse EEG data (27 electrodes). I convert x,y cartesian coordinates of the EEG electrodes to polar, and attempt to map them as such. Each x,y coordinate corresponds to a given value (if you want to know: Hurst exponent) to which I would like the color around that location to correspond. I started with working code from this page and tried to adapt it to my problem. Unfortunately, my adaptation is not working. Here is my code:

Coloring the axis tick text by multiple colors

↘锁芯ラ 提交于 2019-12-23 02:30:50
问题 I'm trying to plot a heatmap using R 's plotly package, where I'd like to have specific colors to specific labels of the y-axis tick text. Here's an example dataset: set.seed(1) df <- reshape2::melt(matrix(rnorm(100),10,10,dimnames = list(paste0("G",1:10),paste0("S",1:10)))) And here's what I'm trying: library(plotly) library(dplyr) plot_ly(z=c(df$value),x=df$Var2,y=df$Var1,colors=grDevices::colorRamp(c("darkblue","gray","darkred")),type="heatmap",colorbar=list(title="Scaled Value",len=0.4))

PHP Red to Green RGB Color Heatmap

情到浓时终转凉″ 提交于 2019-12-23 02:28:30
问题 I can't seem to get this figured out. I have a scaled set of values (0...1) that I need to associate colors with. The highest (1) being red and the lowest (0) being green. I cannot seem to find how to get an RGB color between red and green for a value that is between 0 and 1. Here is my scaling function I am going to use to scale the values: function scale_value($value, $srcmin, $srcmax, $destmin = 0, $destmax = 1) { # How Far In Source Range Are We $pos = (($value - $srcmin) / ($srcmax -

Heatmap function in R dendrogram failure

喜欢而已 提交于 2019-12-23 02:19:49
问题 For the life of me I cannot understand why this method is failing, I would really appreciate an additional set of eyes here: heatmap.2(TEST,trace="none",density="none",scale="row", ColSideColors=c("red","blue")[data.test.factors], col=redgreen,labRow="", hclustfun=function(x) hclust(x,method="complete"), distfun=function(x) as.dist((1 - cor(x))/2)) The error that I get is: row dendrogram ordering gave index of wrong length If I don't include the distfun, everything works really well and is

Passing parameter to function in add.expr inside heatmap.2

被刻印的时光 ゝ 提交于 2019-12-23 01:41:30
问题 I'm generating clustering heatmap with heatmap.2 function (R gplots package). I'd like to add a vertical line(s) onto the image at variable location(s) using add.expr parameter. For example, xx=replicate(10, rnorm(10)) # some random matrix heatmap.2(xx, trace="none", add.expr=abline(v=c(3.5,6.5), lwd=3)) This works great. The problem is it doesn't work if I pass the lines location as a variable: linePosition = c(3.5,6.5) heatmap.2(..., add.expr=abline(v=linePosition, lwd=3)) It looks like

Pheatmap Color for Specific Value

不羁的心 提交于 2019-12-22 11:37:17
问题 I am very new to R and recently I have been playing around with the pheatmap library to generate, well, heatmaps. My problem is that I want to color my heatmap in a specific way. I'll describe below: Values < 1 should be a color ramp (e.g. dark blue to light blue) A value exactly equal to 1 should be dark grey Values > 1 should be a color ramp (e.g. dark red to light red) I have played around with the breaks parameter and the color parameter with various palettes but I can't seem to nail a

d3heatmap package error

末鹿安然 提交于 2019-12-22 11:03:14
问题 When I put in a matrix M that has dimensions of 634 by 2022, d3heatmap(M) spits out an error that says: all(vapply(s, is.integer, NA)) is not TRUE I debugged it and it led to this line: debug: colClust <- as.hclust(hm$Colv) Why is this? The matrix I pass in is all numeric. 来源: https://stackoverflow.com/questions/30354287/d3heatmap-package-error

Rotate upper triangle of a ggplot tile heatmap

醉酒当歌 提交于 2019-12-22 07:58:11
问题 I've plotted a heat-map like this: ggplot(test, aes(start1, start2)) + geom_tile(aes(fill = logFC), colour = "gray", size=0.05) + scale_fill_gradientn(colours=c("#0000FF","white","#FF0000"), na.value="#DAD7D3") This plots the upper triangle of a heatmap. What i'd like to plot is the very same triangle, but having the hypotenuse as the x-axis . How would I do that? Edit: Added reproducible example library(ggplot2) # dummy data df1 <- mtcars[, c("gear","carb", "mpg")] # normal tile plot gg1 <-

Python Matplotlib point colour

一世执手 提交于 2019-12-22 06:48:22
问题 I have been looking at temperature plotting with sensors and wanted to find how I can either construct a contour/heat map or edit the colours of my points based on a cmap? I have the following very basic plot: import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np from pylab import * figure(figsize=(15, 8)) # use ginput to select markers for the sensors matplotlib.pyplot.hot() markers = [(269, 792, 0.65), (1661, 800, 0.5), (1017, 457, 0.8)] x,y,t = zip(*markers)