Skip to content

Commit

Permalink
Merge pull request #356 from wpfff/fix/pyqtgraphcolors
Browse files Browse the repository at this point in the history
fix: pyqtgraph colormaps
  • Loading branch information
wpfff committed Dec 6, 2022
2 parents b2cd882 + de18c45 commit 3635c6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions plottr/config/plottrcfg_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
'line_symbols': ['o', ],
'line_symbol_size': 7,
'minimum_plot_size': (400, 400),
'default_colormap': 'magma',
}
}
11 changes: 8 additions & 3 deletions plottr/plot/pyqtgraph/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import pyqtgraph as pg

from plottr import QtCore, QtWidgets
from plottr import QtCore, QtWidgets, config_entry

__all__ = ['PlotBase', 'Plot']

Expand Down Expand Up @@ -73,9 +73,14 @@ class PlotWithColorbar(PlotBase):
def __init__(self, parent: Optional[QtWidgets.QWidget] = None) -> None:
super().__init__(parent)

cmap = pg.colormap.get('viridis', source='matplotlib')
cmap_name = config_entry('main', 'pyqtgraph', 'default_colormap')
try:
cmap = pg.colormap.get(cmap_name)
except:
cmap = pg.colormap.get('CET-L1')

self.colorbar: pg.ColorBarItem = pg.ColorBarItem(interactive=True, values=(0, 1),
cmap=cmap, width=15)
colorMap=cmap, width=15)
self.graphicsLayout.addItem(self.colorbar)

self.img: Optional[pg.ImageItem] = None
Expand Down

0 comments on commit 3635c6c

Please sign in to comment.