heatmap

How to increase the cell size for annotation in Seaborn heatmap

亡梦爱人 提交于 2019-12-13 02:18:59
问题 I'd like to plot 66x66 confusion matrix with min=0 and max=15075 (shared here). Since I'd like to annotate the cells, I am using annot=True . But I can't seem to fit the values in the cell even after trying approaches suggested in other stack overflow posts like this, this and this. This is my current code: from sklearn.metrics import confusion_matrix conf_mat = confusion_matrix(y_test, y_pred) # please load the data from the pastebin [link above][1] # get the tick label font size fontsize_pt

Conditional coloring of cells in table

本秂侑毒 提交于 2019-12-13 00:23:39
问题 I am trying to create a data table whose cells are different colors based on the value in the cell. I can achieve this with the function addtable2plot from the plotrix package. The addtable2plot function lays a table on an already existing plot. The problem with that solution is that I don't want a plot, just the table. I've also looked at the heatmap functions. The problem there is that some of the values in my table are character, and the heatmap functions, from what I can tell, only accept

how to convert pair lists (to matrix) to heat map; python

江枫思渺然 提交于 2019-12-12 21:26:48
问题 How to convert pair lists (to matrix) to heat map? Say, I have a Dataframe (pandas) like following ... a x 0.63 a y 1.00 a z 0.22 b z 0.13 b x 0.20 b y 0.58 c y 0.21 c z 0.14 I want to generate heat map for this data. do I need to convert it into matrix (& how?) like following... x y z a 0.63 1.00 0.22 b 0.20 0.58 0.13 c 0.00 0.21 0.14 回答1: Something like the following would work, your df didn't have column names but I set them to be 'a','b','c' respectively: In [20]: df.pivot(index='a'

Color a heatmap in Python/Matplotlib according to requirement

青春壹個敷衍的年華 提交于 2019-12-12 19:23:00
问题 I'm trying to make a heatmap with a specified requirement of the coloring. I want to set an interval for the data and judge that as ok and color it green, the rest of the results should be colored as red. Does anyone have a clue of how to do this?? I have attache a simple example using pandas and matplotlib for better understanding. import numpy as np from pandas import * import matplotlib.pyplot as plt Index= ['aaa', 'bbb', 'ccc', 'ddd', 'eee'] Cols = ['A', 'B', 'C', 'D'] data= abs(np.random

google maps v3 heatmap not displaying on page load

人盡茶涼 提交于 2019-12-12 18:24:52
问题 I have a mapping page which retrieves a json response and creates the relevant array of points to load a heatmap. All of this is in the required initialize query which is loaded is called in a jquery document.ready. Here is the strange thing though, all the external data is returning fine and being populated fine, the points array is fine also. However when I call the setMap(map) method on the heatmap it does not display. But weirdly if I use an on page link to toggle it on or off it will

Seaborn heatmap reducing cell size

こ雲淡風輕ζ 提交于 2019-12-12 17:21:35
问题 Is there any way to change cell size of Seaborn heatmap? I found this but I cannot get it work as expected. So, I have long text in y-axis labels. Since all of the texts are chopped off, I would like to shrink cell size of the heatmap much smaller. I don't need that big rectangle. (Highlighted just for example.) (I hid label names.) When I change the figure size by something like, plt.figure(figsize=(8, 6)) or figure.set_size_inches(12, 12) the cell gets bigger as well so the texts remain

Control individual linewidths in seaborn heatmap

岁酱吖の 提交于 2019-12-12 11:31:52
问题 Is it possible to widen the linewidth for sepcific columns and rows in a seaborn heatmap? For example, can this heatmap import numpy as np; np.random.seed(0) import seaborn as sns; sns.set() uniform_data = np.random.rand(10, 12) ax = sns.heatmap(uniform_data, linewidths=1.0) be transformed into something like this: 回答1: It's possible, but may be a lot of work. A possible solution might look like shown below. It involves plotting 6 different heatmaps and adjusting the spacings such that it

Heat map generator of a floor plan image

匆匆过客 提交于 2019-12-12 09:54:44
问题 I want to generate a heat map image of a floor. I have the following things: A black & white .png image of the floor A three column array stored in Matlab. -- The first two columns indicate the X & Y coordinates of the floorpan image -- The third coordinate denotes the "temperature" of that particular coordinate I want to generate a heat map of the floor that will show the "temperature" strength in those coordinates. However, I want to display the heat map on top of the floor plan so that the

how to place colorlegend (corrplot) in graphic

谁说胖子不能爱 提交于 2019-12-12 09:49:03
问题 I am using corrplot to create a correlation heatmap, but I don't like the default legend - it is too big. So I was trying to use the colorlegend() to add the legend after I create the plot (and disable the default legend with cl.pos="n" ). Only problem is that I can't figure out how to change the position of the legend - it ends up on the lower left. Ideally, I could place it on the top right, but I looked through the options for colorlegend and plot and can't figure this out. For example: #

heatmap.2 with color key on top

别来无恙 提交于 2019-12-12 09:05:27
问题 I have the following code to show the color key above the heatmap. But the color key is not exact on top (a little shifted to the right) of the heatmap. Does anyone know how to make the color not shifted? Also, how to remove the white space on the right of the heatmap? Thanks. library(gplots) heatmap.2( matrix(rnorm(100*10), nrow=100) , dendrogram='none' , Colv = F , Rowv = F , trace='none' , col = colorRampPalette(c('blue', 'yellow'))(12) , labRow=NA , labCol=NA , density.info='none' , lmat