mirror of
https://github.com/codex-storage/das-research.git
synced 2025-02-20 14:58:09 +00:00
fix heatmap when spacing in not equal
Histogram2d was binning data, even if axes values were not on a linear scale, creating some strange figures. We do not need the binning here. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
562ef5122f
commit
0dfbace655
@ -4,6 +4,7 @@ import time
|
||||
import xml.etree.ElementTree as ET
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import seaborn as sns
|
||||
from itertools import combinations
|
||||
from mplfinance.original_flavor import candlestick_ohlc
|
||||
@ -197,10 +198,9 @@ class Visualizer:
|
||||
ylabels = np.sort(np.unique(data[key][labels[1]]))
|
||||
if len(xlabels) < self.minimumDataPoints or len(ylabels) < self.minimumDataPoints:
|
||||
continue
|
||||
hist, xedges, yedges = np.histogram2d(data[key][labels[0]], data[key][labels[1]], bins=(len(xlabels), len(ylabels)), weights=data[key]['ttas'])
|
||||
hist = hist.T
|
||||
df = pd.DataFrame.from_dict(data[key]).pivot(labels[0], labels[1], 'ttas')
|
||||
fig, ax = plt.subplots(figsize=(10, 6))
|
||||
sns.heatmap(hist, xticklabels=xlabels, yticklabels=ylabels, cmap='hot_r', cbar_kws={'label': 'Time to block availability (ms)'}, linecolor='black', linewidths=0.3, annot=True, fmt=".2f", ax=ax, vmin=vmin, vmax=vmax)
|
||||
sns.heatmap(df, cmap='hot_r', cbar_kws={'label': 'Time to block availability (ms)'}, linecolor='black', linewidths=0.3, annot=True, fmt=".2f", ax=ax) #vmin=vmin, vmax=vmax
|
||||
plt.xlabel(self.formatLabel(labels[0]))
|
||||
plt.ylabel(self.formatLabel(labels[1]))
|
||||
filename = ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user