-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc5186a
commit 25a611a
Showing
4 changed files
with
438 additions
and
392 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from PySide2.QtCore import * | ||
from PySide2.QtGui import * | ||
from PySide2.QtWidgets import * | ||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas | ||
import matplotlib.pyplot as plt | ||
import matplotlib as mpl | ||
import numpy as np | ||
|
||
|
||
class ColorMap(QWidget): | ||
def __init__(self, minv, maxv, parent=None): | ||
self.max = maxv | ||
self.min = minv | ||
super(ColorMap, self).__init__(parent) | ||
self.figure = plt.figure() | ||
self.canvas = FigureCanvas(self.figure) | ||
|
||
self.draw_colormap() | ||
|
||
# set the layout | ||
layout = QVBoxLayout() | ||
layout.addWidget(self.canvas) | ||
self.setLayout(layout) | ||
|
||
def draw_colormap(self): | ||
# axes | ||
ax = self.figure.add_axes([0.05, 0.10, 0.2, 0.8]) | ||
cmap = mpl.cm.jet | ||
norm = mpl.colors.Normalize(vmin=self.min, vmax=self.max) | ||
ticks_cm = np.linspace(self.min, self.max, 10, endpoint=True) | ||
cb1 = mpl.colorbar.ColorbarBase(ax, cmap=cmap, | ||
norm=norm, | ||
ticks=ticks_cm, | ||
orientation='vertical') | ||
# label_cm = 'punch ratio' | ||
# cb1.set_label(label=label_cm,weight='bold') | ||
cb1.ax.tick_params(labelsize=8) | ||
self.canvas.draw() |
Oops, something went wrong.