Changeset 693 for branches/Release-2-fixes/python/asaplot.py
- Timestamp:
- 09/29/05 16:35:59 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release-2-fixes/python/asaplot.py
r671 r693 17 17 from matplotlib.numerix import sqrt 18 18 from matplotlib import rc, rcParams 19 from asap import rcParams as asaprcParams 19 20 20 21 # Force use of the newfangled toolbar. … … 58 59 self.set_panels(rows, cols) 59 60 60 61 # Set matplotlib default colour sequence. 62 self.colormap = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black', 'purple', 'orange', 'pink'] 61 # Set matplotlib default colour sequence. 62 self.colormap = "green red black cyan magenta orange blue purple yellow pink".split() 63 64 c = asaprcParams['plotter.colours'] 65 if isinstance(c,str) and len(c) > 0: 66 self.colormap = c.split() 67 68 self.lsalias = {"line": [1,0], 69 "dashdot": [4,2,1,2], 70 "dashed" : [4,2,4,2], 71 "dotted" : [1,2], 72 "dashdotdot": [4,2,1,2,1,2], 73 "dashdashdot": [4,2,4,2,1,2] 74 } 75 76 styles = "line dashed dotted dashdot".split() 77 c = asaprcParams['plotter.linestyles'] 78 if isinstance(c,str) and len(c) > 0: 79 styles = c.split() 80 s = [] 81 for ls in styles: 82 if self.lsalias.has_key(ls): 83 s.append(self.lsalias.get(ls)) 84 else: 85 s.append('-') 86 self.linestyles = s 87 63 88 self.color = 0; 89 self.linestyle = 0; 64 90 self.attributes = {} 65 91 self.loc = 0 … … 80 106 self.axes.clear() 81 107 self.color = 0 108 self.linestyle = 0 82 109 self.lines = [] 83 110 84 85 def palette(self, color, colormap=None): 111 def palette(self, color, colormap=None, linestyle=0, linestyles=None): 86 112 if colormap: 87 self.colormap = colormap 113 if isinstance(colormap,list): 114 self.colormap = colormap 115 elif isinstance(colormap,str): 116 self.colormap = colormap.split() 88 117 if 0 <= color < len(self.colormap): 89 118 self.color = color 119 if linestyles: 120 self.linestyles = [] 121 if isinstance(linestyles,list): 122 styles = linestyles 123 elif isinstance(linestyles,str): 124 styles = linestyles.split() 125 for ls in styles: 126 if self.lsalias.has_key(ls): 127 self.linestyles.append(self.lsalias.get(ls)) 128 else: 129 self.linestyles.append(self.lsalias.get('line')) 130 if 0 <= linestyle < len(self.linestyles): 131 self.linestyle = linestyle 90 132 91 133 def delete(self, numbers=None): … … 244 286 for segment in self.lines[i]: 245 287 getattr(segment, "set_color")(self.colormap[self.color]) 246 288 if len(self.colormap) == 1: 289 getattr(segment, "set_dashes")(self.linestyles[self.linestyle]) 247 290 self.color += 1 248 291 if self.color >= len(self.colormap): 249 292 self.color = 0 293 294 if len(self.colormap) == 1: 295 self.linestyle += 1 296 if self.linestyle >= len(self.linestyles): 297 self.linestyle = 0 250 298 251 299 self.show()
Note: See TracChangeset
for help on using the changeset viewer.