4242from PyMca5 .PyMcaGui .plotting import PyMcaPrintPreview
4343from PyMca5 import PyMcaDirs
4444
45- from matplotlib import cm
45+ from matplotlib import colormaps as mpl_colormaps
4646from matplotlib .font_manager import FontProperties
4747from PyMca5 .PyMcaGraph .backends .MatplotlibBackend import FigureCanvas
4848from matplotlib .figure import Figure
@@ -278,7 +278,7 @@ def __init__(self, parent=None, options=['1', '2', '3']):
278278 def setOptions (self ,options = ['1' ,'2' ,'3' ]):
279279 self .clear ()
280280 for item in options :
281- self .addItem (item )
281+ self .addItem (item )
282282
283283 def setCurrentText (self , text ):
284284 for i in range (self .count ()):
@@ -335,12 +335,12 @@ def __init__(self, parent = None):
335335 options = ['Temperature' ,'Grey' , 'Yerg' ,\
336336 'Red' , 'Green' , 'Blue' ,\
337337 'Rainbow' , 'Jet' ,'Hot' , 'Cool' , 'Copper' ]
338- for candidate in ['spectral ' , 'Paired' , 'Paired_r' ,
338+ for candidate in ['Spectral ' , 'Paired' , 'Paired_r' ,
339339 'PuBu' , 'PuBu_r' , 'RdBu' , 'RdBu_r' ,
340340 'gist_earth' , 'gist_earth_r' ,
341341 'Blues' , 'Blues_r' ,
342342 'YlGnBu' , 'YlGnBu_r' ]:
343- if hasattr ( cm , candidate ) :
343+ if candidate in mpl_colormaps :
344344 options .append (candidate )
345345 elif self .labelList [i ] in ['Lin/Log Colormap' ]:
346346 options = ['Linear' ,'Logarithmic' ]
@@ -653,27 +653,27 @@ def updateFigure(self):
653653 origin = self .config ['origin' ]
654654
655655 cmap = self .__temperatureCmap
656- ccmap = cm . gray
656+ ccmap = mpl_colormaps [ ' gray' ]
657657 if self .config ['colormap' ] in ['grey' ,'gray' ]:
658- cmap = cm . gray
658+ cmap = mpl_colormaps [ ' gray' ]
659659 ccmap = self .__temperatureCmap
660660 elif self .config ['colormap' ] in ['yarg' ,'yerg' ]:
661661 cmap = self .__reversedGrayCmap
662662 ccmap = self .__temperatureCmap
663663 elif self .config ['colormap' ]== 'jet' :
664- cmap = cm . jet
664+ cmap = mpl_colormaps [ ' jet' ]
665665 elif self .config ['colormap' ]== 'hot' :
666- cmap = cm . hot
666+ cmap = mpl_colormaps [ ' hot' ]
667667 elif self .config ['colormap' ]== 'cool' :
668- cmap = cm . cool
668+ cmap = mpl_colormaps [ ' cool' ]
669669 elif self .config ['colormap' ]== 'copper' :
670- cmap = cm . copper
670+ cmap = mpl_colormaps [ ' copper' ]
671671 elif self .config ['colormap' ]== 'spectral' :
672- cmap = cm . spectral
672+ cmap = mpl_colormaps [ 'Spectral' ]
673673 elif self .config ['colormap' ]== 'hsv' :
674- cmap = cm . hsv
674+ cmap = mpl_colormaps [ ' hsv' ]
675675 elif self .config ['colormap' ]== 'rainbow' :
676- cmap = cm . gist_rainbow
676+ cmap = mpl_colormaps [ ' gist_rainbow' ]
677677 elif self .config ['colormap' ]== 'red' :
678678 cmap = self .__redCmap
679679 elif self .config ['colormap' ]== 'green' :
@@ -683,29 +683,29 @@ def updateFigure(self):
683683 elif self .config ['colormap' ]== 'temperature' :
684684 cmap = self .__temperatureCmap
685685 elif self .config ['colormap' ] == 'paired' :
686- cmap = cm . Paired
686+ cmap = mpl_colormaps [ ' Paired' ]
687687 elif self .config ['colormap' ] == 'paired_r' :
688- cmap = cm . Paired_r
688+ cmap = mpl_colormaps [ ' Paired_r' ]
689689 elif self .config ['colormap' ] == 'pubu' :
690- cmap = cm . PuBu
690+ cmap = mpl_colormaps [ ' PuBu' ]
691691 elif self .config ['colormap' ] == 'pubu_r' :
692- cmap = cm . PuBu_r
692+ cmap = mpl_colormaps [ ' PuBu_r' ]
693693 elif self .config ['colormap' ] == 'rdbu' :
694- cmap = cm . RdBu
694+ cmap = mpl_colormaps [ ' RdBu' ]
695695 elif self .config ['colormap' ] == 'rdbu_r' :
696- cmap = cm . RdBu_r
696+ cmap = mpl_colormaps [ ' RdBu_r' ]
697697 elif self .config ['colormap' ] == 'gist_earth' :
698- cmap = cm . gist_earth
698+ cmap = mpl_colormaps [ ' gist_earth' ]
699699 elif self .config ['colormap' ] == 'gist_earth_r' :
700- cmap = cm . gist_earth_r
700+ cmap = mpl_colormaps [ ' gist_earth_r' ]
701701 elif self .config ['colormap' ] == 'blues' :
702- cmap = cm . Blues
702+ cmap = mpl_colormaps [ ' Blues' ]
703703 elif self .config ['colormap' ] == 'blues_r' :
704- cmap = cm . Blues_r
704+ cmap = mpl_colormaps [ ' Blues_r' ]
705705 elif self .config ['colormap' ] == 'ylgnbu' :
706- cmap = cm . YlGnBu
706+ cmap = mpl_colormaps [ ' YlGnBu' ]
707707 elif self .config ['colormap' ] == 'ylgnbu_r' :
708- cmap = cm . YlGnBu_r
708+ cmap = mpl_colormaps [ ' YlGnBu_r' ]
709709 else :
710710 _logger .warning ("Unsupported colormap %s" , self .config ['colormap' ])
711711
0 commit comments