heatmap

Create heatmap by grouping two columns

Create heatmap by grouping two columns Question: I want to create a heatmap array using plt.imshow(). But I have some doubts about how to transform my dataframe and fill the 7×24 array. My goal is to count all the visits that have the same day and hour: visits = [ (1,13), (2,1), (1,13), (1,13), (2,18), …

Total answers: 2

Percentage of Row Total in Heatmap Python

Percentage of Row Total in Heatmap Python Question: I would like to show the numbers as percentage of Row (or Column) Total for this heatmap. I am using Plotly library for the plotting. I could find a way to get the percentage of row total using code below. I would really appreciate any help to …

Total answers: 1

How to add custom ticks on the right of a heatmap

How to add custom ticks on the right of a heatmap Question: Given the following sample data data = {‘q1’: [6, 4, 4, 4, 6, 6, 6, 4, 6, 6, 6, 6], ‘q2’: [3, 3, 3, 4, 3, 3, 4, 3, 4, 3, 4, 1], ‘q3’: [6, 3, 4, 4, 4, 4, 6, 6, 6, …

Total answers: 1

Shading specific "pixels" a different color in matplotlib's pcolormesh

Shading specific "pixels" a different color in matplotlib's pcolormesh Question: I have a heatmap that I plot with pcolormesh: import numpy as np import matplotlib.pyplot as plt # generate random array array = np.random.rand(10,10) x = np.arange(0,10) y = np.arange(0,10) fig, ax = plt.subplots(nrows=1,ncols=1) colormesh = ax.pcolormesh(x,y,array) ax.set_xticks(x) ax.set_yticks(y) cb_ax = fig.add_axes([0.93, 0.1, 0.02, 0.8]) …

Total answers: 1

How to interpolate heatmaps (with nonuniform pixels) to draw contour plots in python

How to interpolate heatmaps (with nonuniform pixels) to draw contour plots in python Question: I have data that I have been able to plot using heatmaps with nonuniform pixel sizes, using the answer here. I’m now wondering what would be the best way to go about interpolating the heatmap and drawing a contour plot at …

Total answers: 1

Pingouin rcorr heatmap

Pingouin rcorr heatmap Question: I’ve been using Pandas .corr() with Seaborn to generate a heatmap showing correlation, but want to switch to Pingouin’s .rcorr() to give a bit more control. import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pingouin as pg df_correlation = df.rcorr(method=’spearman’) This gives …

Total answers: 1

adding row colors to a heatmap

adding row colors to a heatmap Question: I’m trying to visualize different groups within my data, on the axis of a heatmap (using sns.heatmap). I want the ticks to be categorized according to a specific dictionary, with names and colors, and eventually to be presented in a legend. I know this can be obtained by …

Total answers: 1

How to map heatmap tick labels to a value and add those values as a legend

How to map heatmap tick labels to a value and add those values as a legend Question: I want to create a heatmap in seaborn, and have a nice way to see the labels. With ax.figure.tight_layout(), I am getting which is obviously bad. Without ax.figure.tight_layout(), the labels get cropped. The code is import matplotlib.pyplot as …

Total answers: 1

Creating a 2 colour heatmap with Python

Creating a 2 colour heatmap with Python Question: I have numerous sets of seasonal data that I am looking to show in a heatmap format. I am not worried about the magnitude of the values in the dataset but more the overall direction and any patterns that i can look at in more detail later. …

Total answers: 2

Show better representation of small values of 2D plot

Show better representation of small values of 2D plot Question: I am trying to make a 2D plot of a function 1/(xy) but the y values vary from 3 orders of magnitude which makes the graph look unreadable. On top of that, I am trying to emphasize the small values of 1/(xy) i.e. when x …

Total answers: 2