heatmap

Create a congressional district map of a state in R

半腔热情 提交于 2019-12-25 01:45:58
问题 I would like to create visual maps of congressional districts within R. I would like to give it data on the number of people voting in each district and make a heat map by district as a visual via R. Here are some generic examples of state maps divided by congressional district (without voting data or a heat map) but I would want to create a fairly minimalistic map to plot off of so these are similar in feel to what I want to create: Texas Minnesota Here is some sample code for a base map in

R gplots heatmap.2 - key is unstable using breaks parameter (warning: unsorted 'breaks' will be sorted before use)

岁酱吖の 提交于 2019-12-24 17:53:15
问题 I'm visualizing a data set with the heatmap.2 function from the gplots package in R. Basically I'm performing a hierarchical clustering analysis on the original data, while forcing the heatmap to display a limited version of the data (between -3 and +3) to limit the effect of outliers on the appearance of the heatmap, while still retaining the original clustering. When I use the full data set ( fullmousedatamat ), it works just fine. However, when I use a partial data set (

Hierarchical clustering of heatmap in python

好久不见. 提交于 2019-12-24 14:49:52
问题 I have a NxM matri with values that range from 0 to 20. I easily get an heatmap by using Matplotlib and pcolor. Now I'd like to apply a hierarchical clustering and a dendogram using scipy. I'd like to re-order each dimension (rows and columns) in order to show which element are similar (according to the clustering result). If the matrix would be square (NxN) the code would be something like: clustering = linkage(matrix, method="average") dendrogram(clustering, orientation='right') How can I

Heatmap of categorical variable counts

谁说我不能喝 提交于 2019-12-24 14:05:45
问题 I have a data frame of items, and each has multiple classifier columns that are categorical variables. ID test1 test2 test3 1 A B A 2 B A C 3 C C C 4 A A B 5 B B B 6 B A C I want to generate a heatmap for each combination of test columns (test1 v test2, test1 v test3, etc.) using ggplot2. The heatmap would have all factors in that test's column (in this case A,B,C) on the x-side and all factors of the other test on the y-side, and the boxes in the heatmap should be colored based on the count

matplotlib correlation matrix heatmap with grouped colors as labels

瘦欲@ 提交于 2019-12-24 10:43:54
问题 I have a correlation matrix hat I am trying to visualize with matplotlib. I can create a heatmap style figure just fine, but I am running into problems with how I want the labels. I'm not even sure if this is possible, but this is what I'm trying to do and can't seem to make it work: My correlation matrix is 150 X 150. On either the x or y (or both...this doesn't matter) axis, I would like to group the labels and then simply label them with a color, or a white label on a color background. To

heatmap based on ratios in Python's seaborn

梦想的初衷 提交于 2019-12-24 09:16:20
问题 I have data in Cartesian coordinates. To each Cartesian coordinate there is also binary variable. I wan to make a heatmap, where in each polygon (hexagon/rectangle,etc.) the color strength is the ratio of number of occurrences where the boolean is True out of the total occurrences in that polygon. The data can for example look like this: df = pd.DataFrame([[1,2,False],[-1,5,True], [51,52,False]]) I know that seaborn can generate heatmaps via seaborn.heatmap, but the color strength is based by

how to set two x axis and two y axis using ggplot2

孤街浪徒 提交于 2019-12-24 08:57:02
问题 My data looks like this: d <- data.frame(X=c('x1','x2','x3','x1','x2','x3','x1','x2','x3'), Y=c('y1','y1','y1','y2','y2','y2','y3','y3','y3'), Value=c(1,2,1,3,1,4,3,5,2)) I use the following code to generate a heat map: ggplot(d,aes(x=X,y=Y,fill=Value)) + geom_tile() + scale_fill_gradient2(low='green',mid='white',high='red',midpoint=3) + theme(axis.text.x = element_text(angle = 90), axis.text = element_text(size = 10), panel.background = element_blank()) + labs(x='',y='') The graph is: But,

16bit greyscale image to heatmap

久未见 提交于 2019-12-24 05:36:08
问题 I'm working on a scientific imaging software for my university, and I've encountered a major problem. Scientific camera (Apogee Alta U57) at my lab provides images as 16bpp array - it's 0-65535 values per pixel! We want to keep this range, but in fact we can't display them on monitor (0-255 grayscale range). So I found a way to resolve this problem - simply to make use of colors, and to display whole image as a heatmap (from black, blue, through green and red, to pure white). I mean something

seaborn heatmap pandas calculation on isnull

北城余情 提交于 2019-12-24 05:12:10
问题 producing a series calculation of a dataframe to provide a percentage of NaN's to the total amount of rows as shown: data = df.isnull().sum()/len(df)*100 RecordID 0.000000 ContactID 0.000000 EmailAddress 0.000000 ExternalID 100.000000 Date 0.000000 Name 0.000000 Owner 67.471362 Priority 0.000000 Status 0.000000 Subject 0.000000 Description 0.000000 Type 0.000000 dtype: float64 What I'm keen to do is represent this as a heatmap in seaborn sns.heatmap(data) , drawing the readers attention those

seaborn heatmap pandas calculation on isnull

家住魔仙堡 提交于 2019-12-24 05:12:05
问题 producing a series calculation of a dataframe to provide a percentage of NaN's to the total amount of rows as shown: data = df.isnull().sum()/len(df)*100 RecordID 0.000000 ContactID 0.000000 EmailAddress 0.000000 ExternalID 100.000000 Date 0.000000 Name 0.000000 Owner 67.471362 Priority 0.000000 Status 0.000000 Subject 0.000000 Description 0.000000 Type 0.000000 dtype: float64 What I'm keen to do is represent this as a heatmap in seaborn sns.heatmap(data) , drawing the readers attention those