Skip to content
Snippets Groups Projects
Commit bbe2f33a authored by ulc0011's avatar ulc0011
Browse files

ENH: Heatmap displays also key, displaying xLabel and funcLabel on click #3

parent 7866c3d1
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,7 @@ class Window(QtWidgets.QDialog):
self.layout = QtWidgets.QVBoxLayout()
self.plot_data = self.D[0]
self.keyList = self.plot_data[1]["config"][2:]
self.gl = QtWidgets.QGridLayout()
......@@ -153,7 +154,7 @@ class Window(QtWidgets.QDialog):
self.toolbar = NavigationToolbar(self.canvas, self)
self.h2 = QtWidgets.QHBoxLayout()
self.l1 = QtWidgets.QLabel("Indices of clicked cell: ")
self.l1 = QtWidgets.QLabel("Clicked cell info: ")
self.l1.setFont(self.bf)
self.l2 = QtWidgets.QLabel("Clicked cell value: ")
self.l2.setFont(self.bf)
......@@ -170,12 +171,18 @@ class Window(QtWidgets.QDialog):
#self.h3 = QtWidgets.QHBoxLayout()
self.nDecLabel = QtWidgets.QLabel('Number of decimals:')
self.nDecLabel.setFont(self.bf)
self.keyLab = QtWidgets.QLabel("Key:")
self.keyLab.setFont(self.bf)
self.keyLabVal = QtWidgets.QLabel(" ")
self.keyLabVal.setFont(self.nf)
self.gl.addWidget(self.nDecLabel,self.tmp_idx,0)
self.gl.addWidget(self.nDecimals,self.tmp_idx,1)
self.gl.addWidget(self.multLab,self.tmp_idx+1,0)
self.gl.addWidget(self.mult,self.tmp_idx+1,1)
self.gl.addWidget(self.unitLab,self.tmp_idx+1,2)
self.gl.addWidget(self.keyLab,self.tmp_idx+2,0)
self.gl.addWidget(self.keyLabVal,self.tmp_idx+2,1)
#self.h3.addWidget(QtWidgets.QLabel(' '))
self.gl.setVerticalSpacing(5)
......@@ -262,7 +269,11 @@ class Window(QtWidgets.QDialog):
tex_file.write('''\n\end{document}''')
tex_file.close()
print('TeX file created')
self.sendInfo.emit({'quantity': str(self.combo.currentText()), 'region': str(self.combo_reg.currentText())})
if str(self.combo_reg.currentText()) == "Overall summary":
reg = list(self.d['config']['main_reg'][0].keys())[0]
else:
reg = str(self.combo_reg.currentText())[9:]
self.sendInfo.emit({'quantity': str(self.combo.currentText()), 'region': reg})
......@@ -279,6 +290,11 @@ class Window(QtWidgets.QDialog):
for i in range(0,len(self.D)):
if str(self.combo.currentText()) == self.D[i][0]["arg"]:
self.plot_data = self.D[i]
if dataLabel == "Overall summary":
self.keyList = self.plot_data[1]["config"][2:]
else:
self.keyList = self.plot_data[1]['head_text_config'][1].replace('\\,', ' ')
self.keyList = self.keyList.split(',')[2:]
self.draw_heatmap()
......@@ -291,7 +307,9 @@ class Window(QtWidgets.QDialog):
idx = int(np.floor(event.xdata))
idy = int(np.floor(event.ydata))
#print('Indices and content of current cell [{},{}]: {}'.format(idy,idx,self.data[idy,idx]))
self.l3.setText("[{},{}]".format(idy,idx))
self.l3.setText("{}: {} {}, {}: {} {}".format(self.plot_data[1]["func_label_name"],self.ky[idx],
self.plot_data[1]["func_label_unit"],self.plot_data[1]["x_label_name"],
list(self.k)[idy],self.plot_data[1]["x_label_unit"]))
if self.sw:
self.l4.setText(str(self.numMult*self.data[idx,idy]))
else:
......@@ -320,6 +338,16 @@ class Window(QtWidgets.QDialog):
self.k = self.plot_data[1]["lines"]
self.ky = [h[0] for h in self.heat_data[0]]
self.keyStr = "None"
for i in range(len(self.keyList)):
if i == 0:
self.keyStr = ""
self.keyStr = self.keyStr + self.keyList[i].replace("\\,", " ")
if i < len(self.keyList)-1:
self.keyStr = self.keyStr + ", "
self.keyLabVal.setText(self.keyStr)
self.x = len(self.k)
self.y = len(self.ky)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment