Lines Matching refs:s

101     s = '%.*f' % (w, abs(x) / (10.0**p))
102 s = s.lstrip('0')
104 if '.' in s:
105 s = s[:max(s.find('.'), w-(2 if x < 0 else 1))]
106 s = s.rstrip('0')
107 s = s.rstrip('.')
108 return '%s%s%s' % ('-' if x < 0 else '', s, SI_PREFIXES[p])
120 s = '%.*f' % (w, abs(x) / (2.0**p))
121 s = s.lstrip('0')
123 if '.' in s:
124 s = s[:max(s.find('.'), w-(3 if x < 0 else 2))]
125 s = s.rstrip('0')
126 s = s.rstrip('.')
127 return '%s%s%s' % ('-' if x < 0 else '', s, SI2_PREFIXES[p])
130 def escape(s): argument
131 return codecs.escape_decode(s.encode('utf8'))[0].decode('utf8')
178 def write(self, s): argument
180 lines = s.split('\n')
602 other_xweights = [s*ratio for s in other_xweights]
624 for s in other.subplots:
625 if s.x+s.xspan-1 == new_i:
626 s.xspan += 1
627 elif s.x > new_i:
628 s.x += 1
642 for s in self.subplots:
643 if s.x+s.xspan-1 == new_i:
644 s.xspan += 1
645 elif s.x > new_i:
646 s.x += 1
671 self_yweights = [s*ratio for s in self.yweights]
675 for s in other.subplots:
676 s.y += len(self_yweights)
681 self.map = self_map | {(x, y+len(self_yweights)): s
682 for (x, y), s in other_map.items()}
684 for s in self.subplots:
685 s.y += len(other.yweights)
690 self.map = other_map | {(x, y+len(other.yweights)): s
691 for (x, y), s in self_map.items()}
700 other_yweights = [s*ratio for s in other_yweights]
722 for s in other.subplots:
723 if s.y+s.yspan-1 == new_i:
724 s.yspan += 1
725 elif s.y > new_i:
726 s.y += 1
740 for s in self.subplots:
741 if s.y+s.yspan-1 == new_i:
742 s.yspan += 1
743 elif s.y > new_i:
744 s.y += 1
769 self_xweights = [s*ratio for s in self.xweights]
773 for s in other.subplots:
774 s.x += len(self_xweights)
779 self.map = self_map | {(x+len(self_xweights), y): s
780 for (x, y), s in other_map.items()}
782 for s in self.subplots:
783 s.x += len(other.xweights)
788 self.map = other_map | {(x+len(other.xweights), y): s
789 for (x, y), s in self_map.items()}
793 self.xweights = [s*width for s in self.xweights]
794 self.yweights = [s*height for s in self.yweights]
900 for s in grid:
902 x2_ = s.args.get('x2', False) or x2
903 y2_ = s.args.get('y2', False) or y2
904 xunits_ = s.args.get('xunits', xunits)
905 yunits_ = s.args.get('yunits', yunits)
906 xticklabels_ = s.args.get('xticklabels', xticklabels)
907 yticklabels_ = s.args.get('yticklabels', yticklabels)
910 subtitle = s.args.get('title')
911 xsublabel = s.args.get('xlabel')
912 ysublabel = s.args.get('ylabel')
934 s.x2 = x2_
935 s.y2 = y2_
936 s.xunits = xunits_
937 s.yunits = yunits_
938 s.xticklabels = xticklabels_
939 s.yticklabels = yticklabels_
940 s.title = subtitle
941 s.xlabel = xsublabel
942 s.ylabel = ysublabel
945 for s in grid:
946 s.xmargin = (
947 len(s.ylabel) + (1 if s.ylabel else 0) # fit ysublabel
948 + (1 if s.x > 0 else 0), # space between
949 ((5 if s.y2 else 4) + len(s.yunits) # fit yticklabels
950 if s.yticklabels is None
951 else max((len(t) for t in s.yticklabels), default=0))
952 + (1 if s.yticklabels != [] else 0),
954 s.ymargin = (
955 len(s.xlabel), # fit xsublabel
956 1 if s.xticklabels != [] else 0, # fit xticklabels
957 len(s.title), # fit subtitle
960 for s in grid:
962 s.xmargin = (
963 max(s_.xmargin[0] for s_ in grid if s_.x == s.x),
964 max(s_.xmargin[1] for s_ in grid if s_.x == s.x),
966 s.ymargin = (
967 max(s_.ymargin[0] for s_ in grid if s_.y == s.y),
968 max(s_.ymargin[1] for s_ in grid if s_.y == s.y),
969 max(s_.ymargin[-1] for s_ in grid if s_.y+s_.yspan == s.y+s.yspan),
974 def writeln(s=''): argument
975 f.write(s)
1051 + max(sum(s.xmargin[:2]) for s in grid if s.x == 0)
1064 + max(sum(s.xmargin[:2]) for s in grid if s.x == 0)
1082 for s in grid:
1084 minwidth = sum(s.xmargin) + max(2,
1085 2*((5 if s.x2 else 4)+len(s.xunits))
1086 if s.xticklabels is None
1087 else sum(len(t) for t in s.xticklabels))
1089 minheight = sum(s.ymargin) + 2
1092 while minwidth > sum(widths[s.x:s.x+s.xspan]):
1093 widths[s.x+i] += 1
1094 i = (i + 1) % s.xspan
1097 while minheight > sum(heights[s.y:s.y+s.yspan]):
1098 heights[s.y+i] += 1
1099 i = (i + 1) % s.yspan
1105 for s in grid:
1107 define_ = define + s.args.get('define', [])
1108 xlim_ = s.args.get('xlim', xlim)
1109 ylim_ = s.args.get('ylim', ylim)
1110 xlog_ = s.args.get('xlog', False) or xlog
1111 ylog_ = s.args.get('ylog', False) or ylog
1149 subwidth = sum(widths[s.x:s.x+s.xspan]) - sum(s.xmargin)
1150 subheight = sum(heights[s.y:s.y+s.yspan]) - sum(s.ymargin)
1170 s.plot = plot
1171 s.width = subwidth
1172 s.height = subheight
1173 s.xlim = xlim_
1174 s.ylim = ylim_
1231 s = grid[x_, y_]
1232 subrow = row - sum(heights[s.y+s.yspan:])
1235 if subrow < s.ymargin[-1]:
1237 if subrow < len(s.title):
1239 sum(s.xmargin[:2]), '',
1240 s.title[subrow].center(s.width)))
1243 sum(s.xmargin[:2]), '',
1244 s.width, ''))
1246 elif subrow-s.ymargin[-1] < s.height:
1247 subrow = subrow-s.ymargin[-1]
1251 s.xmargin[0],
1253 line.center(s.height)[subrow]
1254 for line in s.ylabel)
1255 if s.ylabel else ''))
1258 if subrow == 0 and s.yticklabels != []:
1260 s.xmargin[1],
1261 ((si2 if s.y2 else si)(s.ylim[1]) + s.yunits
1262 if s.yticklabels is None
1263 else s.yticklabels[1])
1265 elif subrow == s.height-1 and s.yticklabels != []:
1267 s.xmargin[1],
1268 ((si2 if s.y2 else si)(s.ylim[0]) + s.yunits
1269 if s.yticklabels is None
1270 else s.yticklabels[0])
1274 s.xmargin[1], ''))
1277 f.write(s.plot.draw(subrow, color=color))
1281 subrow = subrow-s.ymargin[-1]-s.height
1284 if subrow < (1 if s.xticklabels != [] else 0):
1286 sum(s.xmargin[:2]), '',
1287 (5 if s.x2 else 4) + len(s.xunits)
1288 if s.xticklabels is None
1289 else len(s.xticklabels[0]),
1290 (si2 if s.x2 else si)(s.xlim[0]) + s.xunits
1291 if s.xticklabels is None
1292 else s.xticklabels[0],
1293 s.width - (2*((5 if s.x2 else 4)+len(s.xunits))
1294 if s.xticklabels is None
1295 else sum(len(t) for t in s.xticklabels)), '',
1296 (5 if s.x2 else 4) + len(s.xunits)
1297 if s.xticklabels is None
1298 else len(s.xticklabels[1]),
1299 (si2 if s.x2 else si)(s.xlim[1]) + s.xunits
1300 if s.xticklabels is None
1301 else s.xticklabels[1]))
1303 elif (subrow < s.ymargin[1]
1304 or subrow-s.ymargin[1] >= len(s.xlabel)):
1306 sum(s.xmargin[:2]), '',
1307 s.width, ''))
1310 sum(s.xmargin[:2]), '',
1311 s.xlabel[subrow-s.ymargin[1]].center(s.width)))