heatmap

ggplot2: Quick Heatmap Plotting, reshape?

雨燕双飞 提交于 2019-12-21 05:08:57
问题 I'm trying to reproduce the heatmap presented on this blog by following their tutorial, but when I try to run their Jan 2010-code I get an error when asking for, nba.m <- ddply(nba.m, .(variable), transform, rescale = rescale(value)) Error in eval(expr, envir, enclos) : could not find function "rescale" Reproducible code is available on the blog mentioned above I'm using ggplot2_0.9.0 and R 2.14.2. Also, I did read this thread here on stackoverflow.com. Any ideas to what might be wrong? 回答1:

how to superimpose heatmap on a base image?

蹲街弑〆低调 提交于 2019-12-21 04:24:05
问题 Please look at this github page. I want to generate heat maps in this way using Python PIL,open cv or matplotlib library. Can somebody help me figure it out? I could create a heat map for my network at the same size as the input, but I am not able superimpose them. The heatmap shape is (800,800) and the base image shape is (800,800,3) 回答1: You can superimpose your heatmap on the image using the function cv2.addweighted() available in OpenCV. Here is an example Sample image: img = cv2.imread(

How to add a label to Seaborn Heatmap color bar?

让人想犯罪 __ 提交于 2019-12-21 03:12:06
问题 If I have the following data and Seaborn Heatmap: import pandas as pd data = pd.DataFrame({'x':(1,2,3,4),'y':(1,2,3,4),'z':(14,15,23,2)}) sns.heatmap(data.pivot_table(index='y', columns='x', values='z')) How do I add a label to the colour bar? 回答1: You could set it afterwards after collecting it from an ax , or simply pass a label in cbar_kws like so. import seaborn as sns import pandas as pd data = pd.DataFrame({'x':(1,2,3,4),'y':(1,2,3,4),'z':(14,15,23,2)}) sns.heatmap(data.pivot_table

heat map with image as background

我只是一个虾纸丫 提交于 2019-12-21 02:56:18
问题 I am trying to make a heat map with R. I am trying with ggplot2.My actual dataframe is much larger but in here I only include a small part x <- c(502.9, 512.1, 716.6, 759.7, 776.1, 776.5, 736.1, 271.3, 304.7, 279.9, 263.8, 726.6, 767.6, 778.8, 779.2, 263.6, 291.8, 472.6, 499.9, 684.9) y <- c(374.6, 367.4, 378.1, 373.7, 381.4, 395.7, 412.1, 399.2, 364.6, 382.1, 409.1, 410.4, 411.1, 429.4, 477.4, 468.6, 406.5, 343.2, 356.9, 365.2) a <- data.frame(x,y) ggplot(a, aes(x = x, y =y)) + stat

R - Smoothing color and adding a legend to a scatterplot

泪湿孤枕 提交于 2019-12-20 15:26:10
问题 I have a scatterplot in R. Each (x,y) point is colored according to its z value. So you can think of each point as (x,y,z) , where (x,y) determines its position and z determines its color along a color gradient. I would like to add two things A legend on the right side showing the color gradient and what z values correspond to what colors I would like to smooth all the color using some type of interpolation, I assume. In other words, the entire plotting region (or at least most of it) should

Offline heat map with map background

試著忘記壹切 提交于 2019-12-20 04:21:31
问题 I am trying to find if we can have background set (as 2D map) for a heat map ? Read data from a file and plot heat map (which is pretty simple) But in offline mode can we have the heat map imposed on the real map ? Any useful suggestion appreciated. 回答1: You use a heat map as the background for a geographical map (which I think is what you are asking about) using basemap and imshow. from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np m = Basemap(width

python bokeh, how to make a correlation plot?

这一生的挚爱 提交于 2019-12-20 02:53:07
问题 How can I make a correlation heatmap in Bokeh? import pandas as pd import bokeh.charts df = pd.util.testing.makeTimeDataFrame(1000) c = df.corr() p = bokeh.charts.HeatMap(c) # not right # try to make it a long form # (and it's ugly in pandas to use 'index' in melt) c['x'] = c.index c = pd.melt(c, 'x', ['A','B','C','D']) # this shows the right 4x4 matrix, but values are still wrong p = bokeh.charts.HeatMap(c, x = 'x', y = 'variable', values = 'value') By the way, can I make a colorbar on the

Show R heatmap outliers in a different colour

时光怂恿深爱的人放手 提交于 2019-12-19 11:42:29
问题 Looking to mark outliers in R matrix in a different color. Say I have the data as 1 2 4 2 5 5 4 3 2 3 1 500 5 4 2 Now I want to mark the 500 with a different color and the remaining of the matrix with default color of the heatmap. Can someone guide me through the process? 回答1: If you want to clearly see the 500, you should specify no scaling. For example, m <- matrix(c(1, 5, 1, 2, 4, 500, 4, 3, 5, 2, 2, 4, 5, 3, 2), ncol=5) heatmap((m<500)+0, scale="none", Rowv=NA, Colv=NA) 回答2: Here's a

Show R heatmap outliers in a different colour

a 夏天 提交于 2019-12-19 11:42:05
问题 Looking to mark outliers in R matrix in a different color. Say I have the data as 1 2 4 2 5 5 4 3 2 3 1 500 5 4 2 Now I want to mark the 500 with a different color and the remaining of the matrix with default color of the heatmap. Can someone guide me through the process? 回答1: If you want to clearly see the 500, you should specify no scaling. For example, m <- matrix(c(1, 5, 1, 2, 4, 500, 4, 3, 5, 2, 2, 4, 5, 3, 2), ncol=5) heatmap((m<500)+0, scale="none", Rowv=NA, Colv=NA) 回答2: Here's a

How to generate a custom color scale for plotly heatmap in R

≡放荡痞女 提交于 2019-12-19 10:28:27
问题 I would like to get a custom color scale which looks like for plotly heatmap ( plot_ly(z = data, colors = customcolors, type = "heatmap") ) palette <- colorRampPalette(c("darkblue", "blue", "lightblue1", "green","yellow", "red", "darkred")) plot(rep(1,50),col=palette(50), pch=19, cex=3, xlab = "", ylab ="", axes = F) and where the blue end represents 1 and red end represents 10^6 and plotted data would have varying values on this interval. 回答1: The code you use to generate a color palette