1
0
Fork 0

Fix heatmap ambiguity: xx's for null data.

This commit is contained in:
Casper V. Kristensen 2019-12-13 20:50:31 +01:00
parent 04528a928a
commit 0a7f5e20d4
11 changed files with 14 additions and 7 deletions

View file

@ -3,7 +3,6 @@ import re
import statistics
from collections import defaultdict
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.artist import setp
@ -174,7 +173,7 @@ def matrixify(results: list, x_func: callable, y_func: callable, z_func: callabl
x_labels = list(sorted(set(x_func(r) for r in results)))
y_labels = list(sorted(set(y_func(r) for r in results)))
data = {y: {x: 1 for x in x_labels}
data = {y: {x: 0 for x in x_labels}
for y in y_labels}
for r in results:
@ -200,7 +199,6 @@ def plot_scheme_heatmap(results: list, title: str, bandwidth: int):
cbarlabel="Time (ms)",
logcolor=True,
origin="lower",
cmap=cm.gray
)
save_fig(plt, title)
@ -221,7 +219,12 @@ def plot_old_vs_new_heatmap(all_results: dict, old_func: callable, new_func: cal
def calc(i, j):
try:
return data_new[i, j] - data_old[i, j]
if (data_new[i, j], data_old[i, j]) == (0, 0):
return 0
diff = data_new[i, j] - data_old[i, j]
if diff == 0:
return 1
return diff
except IndexError:
return 0

View file

@ -28,6 +28,7 @@ def heatmap(data, row_labels, col_labels, ax=None,
**kwargs
All other arguments are forwarded to `imshow`.
"""
data = np.ma.masked_where(data == 0, data)
if not ax:
ax = plt.gca()
@ -39,7 +40,7 @@ def heatmap(data, row_labels, col_labels, ax=None,
if logcolor:
pcm = ax.pcolor(data,
norm=colors.LogNorm(vmin=data.min(), vmax=data.max()),
cmap='gray_r')
cmap='Blues')
cbar = ax.figure.colorbar(pcm, ax=ax, extend="max", ticks=LogLocator(base=2), format=LogFormatterSciNotation(base=2))
elif sym_logcolor:
linthresh = 1.0
@ -76,9 +77,12 @@ def heatmap(data, row_labels, col_labels, ax=None,
ax.set_xticks(np.arange(data.shape[1]+1)-.5, minor=True)
ax.set_yticks(np.arange(data.shape[0]+1)-.5, minor=True)
ax.grid(which="minor", color="w", linestyle='-', linewidth=3)
ax.tick_params(which="minor", bottom=False, left=False)
ax.patch.set(hatch="xx", edgecolor="gray")
ax.grid(which="minor", color="w", linestyle='-', linewidth=0) # set linewidth=0.1 if annotating
#annotate_heatmap(im, data, fontsize=2)
return im, cbar

View file

@ -103,7 +103,7 @@ public class Driver {
}
try {
boolean interPolySchemeShouldFuckOff = false;
boolean interPolySchemeShouldFuckOff = true;
if (numServers != 1 && !interPolySchemeShouldFuckOff) {
try {
profiler.reset();