Changeset 87cc73a in sasview for src/sas/qtgui/PlotUtilities.py
- Timestamp:
- Jan 11, 2017 9:31:58 AM (8 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- db5cd8d
- Parents:
- b46f285
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/PlotUtilities.py
r9290b1a r87cc73a 1 1 import sys 2 2 import numpy 3 3 from collections import OrderedDict 4 5 SHAPES = OrderedDict([ 6 ('Circle' , 'o'), 7 ('Point' , '.'), 8 ('Pixel' , ','), 9 ('Triangle Down' , 'v'), 10 ('Triangle Up' , '^'), 11 ('Triangle Left' , '<'), 12 ('Triangle Right' , '>'), 13 ('Octagon' , '8'), 14 ('Square' , 's'), 15 ('Pentagon' , 'p'), 16 ('Star' , '*'), 17 ('Hexagon1' , 'h'), 18 ('Hexagon2' , 'H'), 19 ('Cross +' , 'p'), 20 ('Cross X ' , 'x'), 21 ('Diamond' , 'D'), 22 ('Thin Diamond' , 'd'), 23 ('Line' , '-'), 24 ('Dash' , '--'), 25 ('Vline' , 'vline'), 26 ('Step' , 'step'), 27 ]) 28 29 COLORS = OrderedDict([ 30 ('Blue', 'b'), 31 ('Green', 'g'), 32 ('Red', 'r'), 33 ('Cyan', 'c'), 34 ('Magenta', 'm'), 35 ('Yellow', 'y'), 36 ('Black', 'k'), 37 ('Custom', 'x'), 38 ]) 4 39 5 40 def build_matrix(data, qx_data, qy_data): … … 57 92 if loop >= max_loop: # this protects never-ending loop 58 93 break 59 image = fillup _pixels(image=image, weights=weights)94 image = fillupPixels(image=image, weights=weights) 60 95 loop += 1 61 96 … … 108 143 return x_bins, y_bins 109 144 110 def fillup _pixels(image=None, weights=None):145 def fillupPixels(image=None, weights=None): 111 146 """ 112 147 Fill z values of the empty cells of 2d image matrix … … 221 256 return (lo, hi) 222 257 258 def getValidColor(color): 259 ''' 260 Returns a valid matplotlib color 261 ''' 262 263 if color is not None: 264 # Check if it's an int 265 if isinstance(color, int): 266 # Check if it's within the range 267 if 0 <= color <=6: 268 color = COLORS.values()[color] 269 # Check if it's an RGB string 270 elif isinstance(color, str): 271 # Assure the correctnes of the string 272 assert(color[0]=="#" and len(color) == 7) 273 import string 274 assert(all(c in string.hexdigits for c in color[1:])) 275 else: 276 raise AttributeError 277 278 return color
Note: See TracChangeset
for help on using the changeset viewer.