From 8627738188c55ac6036385c6edae761b389d9f97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Fri, 9 Jul 2004 21:07:21 +0000 Subject: [PATCH] graph style + data reorganization completed git-svn-id: https://pyx.svn.sourceforge.net/svnroot/pyx/trunk/pyx@1794 069f4177-920e-0410-937b-c2a4a81bcd90 --- CHANGES | 8 +- pyx/box.py | 6 +- pyx/graph/axis/axis.py | 4 +- pyx/graph/data.py | 23 +++- pyx/graph/key.py | 31 +++-- pyx/graph/style.py | 291 ++++++++++++++++++++++++--------------- test/functional/test_bargraph.py | 4 +- 7 files changed, 232 insertions(+), 135 deletions(-) diff --git a/CHANGES b/CHANGES index ce3feae4..1b929286 100644 --- a/CHANGES +++ b/CHANGES @@ -17,10 +17,6 @@ TODO: - axis painter labelattrs=None + automatic axis partitioning leads to no valid partitioning - graph.style and graph.data modules - exceptions in drawsymbol & friends... - - caution: another reorganization round is in progress - (its goal is to make graph styles combinable which will also - split up the style code in smaller parts -- those will then be - easier to substitute by inheritance) - fix docu (or code) of gridattrs functionality of axis painters (how can one, e.g. draw a grid at the ticks and not at the subticks) - graph.data module: @@ -59,6 +55,9 @@ TODO: - is the early conversion with unit.topt unit-modification-save? - deformer module: - better names for the helper functions ? + - open discussion: + - clearly distingish between readers and writers. dvifile, epsfile, etc. might + be renamed to dvireader, epsreader ... Documentation: - path module: @@ -114,6 +113,7 @@ TODO: - create siteconfig on install to store positions of the shared data and the global pyxrc - graph modules: + - graph style + data reorganization - enum -> num renaming - allow for horizontally and vertically centered graph key alignment (TODO: documentation) - fix bug that graph was not finished automatically when a bbox was specified diff --git a/pyx/box.py b/pyx/box.py index 6319c7c9..852e4ebc 100644 --- a/pyx/box.py +++ b/pyx/box.py @@ -327,14 +327,16 @@ def tile_pt(polygons, a, dx, dy): extent = p.extent_pt(dx, dy) if extent > maxextent: maxextent = extent + delta = maxextent + a d = 0 for p in polygons: p.transform(trafo.translate_pt(d*dx, d*dy)) - d += maxextent + a + d += delta + return delta def tile(polygons, a, dx, dy): - tile_pt(polygons, unit.topt(a), dx, dy) + return unit.t_pt(tile_pt(polygons, unit.topt(a), dx, dy)) class polygon(polygon_pt): diff --git a/pyx/graph/axis/axis.py b/pyx/graph/axis/axis.py index 1c619f5c..587da0a0 100644 --- a/pyx/graph/axis/axis.py +++ b/pyx/graph/axis/axis.py @@ -751,9 +751,7 @@ class bar: self.relsizes = None return self.relsizes is not None - def adjustrange(self, points, index, subnames=None): - if subnames is None: - subnames = [] + def adjustrange(self, points, index, subnames=[]): for point in points: if index is not None: self.setname(point[index], *subnames) diff --git a/pyx/graph/data.py b/pyx/graph/data.py index 7b5dca0d..547c18fa 100644 --- a/pyx/graph/data.py +++ b/pyx/graph/data.py @@ -80,7 +80,9 @@ class _Idata: This method returns a title string for the data to be used in graph keys and probably other locations. The method might return None to indicate, that there is no title and the data - should be skiped in a graph key. A data title does not need + should be skiped in a graph key. Alternatively, the title + might contain a list of strings. The list should fit the + return value of the key_pt method. Data titles does not need to be unique.""" def setstyles(self, graph, styles): @@ -112,12 +114,14 @@ class _Idata: This method should draw the data.""" - def key_pt(self, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): """Draw graph key This method should draw a graph key at the given position x_pt, y_pt indicating the lower left corner of the given - area width_pt, height_pt.""" + area width_pt, height_pt. The styles might draw several + key entries shifted vertically by dy_pt. The method returns + the number of key entries.""" class styledata: @@ -224,9 +228,18 @@ class _data(_Idata): for style in self.styles: style.donedrawpoints(self.styledata, graph) - def key_pt(self, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): + i = None for style in self.styles: - style.key_pt(self.styledata, graph, x_pt, y_pt, width_pt, height_pt) + j = style.key_pt(self.styledata, graph, x_pt, y_pt, width_pt, height_pt) + if i is None: + if j is not None: + i = j + elif j is not None and i != j: + raise ValueError("different number of graph keys") + if i is None: + raise ValueError("no graph key available") + return i class list(_data): diff --git a/pyx/graph/key.py b/pyx/graph/key.py index 64cd0ea3..13c2ef6e 100644 --- a/pyx/graph/key.py +++ b/pyx/graph/key.py @@ -69,7 +69,7 @@ class key: def paint(self, plotdata): "creates the layout of the key" - plotdata = [plotdat for plotdat in plotdata if plotdat.title is not None] + plotdata = [x for x in plotdata if x.title is not None] c = canvas.canvas() self.dist_pt = unit.topt(self.dist) self.hdist_pt = unit.topt(self.hdist) @@ -77,16 +77,27 @@ class key: self.symbolwidth_pt = unit.topt(self.symbolwidth) self.symbolheight_pt = unit.topt(self.symbolheight) self.symbolspace_pt = unit.topt(self.symbolspace) + titleboxes = [] for plotdat in plotdata: - plotdat.temp_titlebox = c.texrunner.text_pt(0, 0, plotdat.title, self.defaulttextattrs + self.textattrs) - box.tile_pt([plotdat.temp_titlebox for plotdat in plotdata], self.dist_pt, 0, -1) - box.linealignequal_pt([plotdat.temp_titlebox for plotdat in plotdata], self.symbolwidth_pt + self.symbolspace_pt, 1, 0) + try: + plotdat.title + "" + except: + titles = plotdat.title + else: + titles = [plotdat.title] + plotdat.titlecount = len(titles) + for title in titles: + titleboxes.append(c.texrunner.text_pt(0, 0, title, self.defaulttextattrs + self.textattrs)) + dy_pt = box.tile_pt(titleboxes, self.dist_pt, 0, -1) + box.linealignequal_pt(titleboxes, self.symbolwidth_pt + self.symbolspace_pt, 1, 0) + y_pt = -0.5 * self.symbolheight_pt + titleboxes[0].center[1] for plotdat in plotdata: # TODO: loop over styles - plotdat.styles[-1].key_pt(plotdat.styledata, c, 0, -0.5 * self.symbolheight_pt + plotdat.temp_titlebox.center[1], - self.symbolwidth_pt, self.symbolheight_pt) - c.insert(plotdat.temp_titlebox) - - # for plotdat in plotdata: - # del plotdat.temp_titlebox + count = plotdat.styles[-1].key_pt(plotdat.styledata, c, 0, y_pt, + self.symbolwidth_pt, self.symbolheight_pt, dy_pt) + y_pt -= dy_pt*count + if count != plotdat.titlecount: + raise ValueError("key count/title count mismatch") + for titlebox in titleboxes: + c.insert(titlebox) return c diff --git a/pyx/graph/style.py b/pyx/graph/style.py index 8eeefec5..3d73ef81 100644 --- a/pyx/graph/style.py +++ b/pyx/graph/style.py @@ -106,13 +106,15 @@ class _style: drawn using the drawpoint method above.""" pass - def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): """Draw graph key This method draws a key for the style to graph at the given position x_pt, y_pt indicating the lower left corner of the - given area width_pt, height_pt.""" - pass + given area width_pt, height_pt. The style might draw several + key entries shifted vertically by dy_pt. The method returns + the number of key entries or None, when nothing was drawn.""" + return None # Provider is a dictionary, which maps styledata variable names @@ -168,7 +170,7 @@ class _pos(_style): styledata.vposavailable = styledata.vposvalid = 0 styledata.vpos[index] = None else: - if v < - self.epsilon or v > 1 + self.epsilon: + if v < -self.epsilon or v > 1+self.epsilon: styledata.vposvalid = 0 styledata.vpos[index] = v @@ -421,9 +423,10 @@ class symbol(_styleneedingpointpos): xpos, ypos = graph.vpos_pt(*styledata.vpos) styledata.symbol(styledata.symbolcanvas, xpos, ypos, styledata.size_pt, styledata.symbolattrs) - def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): if styledata.symbolattrs is not None: styledata.symbol(graph, x_pt+0.5*width_pt, y_pt+0.5*height_pt, styledata.size_pt, styledata.symbolattrs) + return 1 class line(_styleneedingpointpos): @@ -582,9 +585,10 @@ class line(_styleneedingpointpos): if styledata.lineattrs is not None and len(styledata.path.path): styledata.linecanvas.stroke(styledata.path) - def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): if styledata.lineattrs is not None: graph.stroke(path.line_pt(x_pt, y_pt+0.5*height_pt, x_pt+width_pt, y_pt+0.5*height_pt), styledata.lineattrs) + return 1 class errorbar(_style): @@ -755,7 +759,7 @@ class arrow(_styleneedingpointpos): styledata.arrowcanvas.stroke(path.line_pt(x1, y1, x2, y2), styledata.lineattrs + [deco.earrow(styledata.arrowattrs, size=self.arrowsize*size)]) - def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): raise "TODO" @@ -810,54 +814,145 @@ class rect(_style): else: styledata.rectcanvas.fill(p) - def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt): + def key_pt(self, styledata, graph, x_pt, y_pt, width_pt, height_pt, dy_pt): raise "TODO" -class bar(_style): +class barpos(_style): - provide = ["vpos", "vposmissing", "vposavailable", "vposvalid"] - - defaultfrompathattrs = [] - defaultbarattrs = [color.palette.Rainbow, deco.stroked([color.gray.black])] + provide = ["vpos", "vposmissing", "vposavailable", "vposvalid", "barcolumns", "barvalueindex", "vbarpos"] - def __init__(self, fromvalue=None, frompathattrs=[], barattrs=[], subnames=None, epsilon=1e-10): + def __init__(self, fromvalue=None, subindex=0, subnames=None, epsilon=1e-10): + # TODO: vpos configuration ... self.fromvalue = fromvalue - self.frompathattrs = frompathattrs - self.barattrs = barattrs self.subnames = subnames + self.subindex = subindex self.epsilon = epsilon def columns(self, styledata, graph, columns): - # TODO: remove limitation to 2d graphs - if len(graph.axesnames) != 2: - raise ValueError("bar style currently restricted on two-dimensional graphs") - styledata.barvalues = styledata.barname = None + # TODO: we might check whether barcolumns/barvalueindex is already available + styledata.barcolumns = [] + styledata.barvalueindex = None for dimension, axisnames in enumerate(graph.axesnames): for axisname in axisnames: if axisname in columns: - if styledata.barvalues is not None: + if styledata.barvalueindex is not None: raise ValueError("multiple values") - styledata.barvalues = [axisname] - styledata.valuepos = dimension + valuecolumns = [axisname] while 1: - nextvalue = "%sstack%i" % (axisname, len(styledata.barvalues)) - if nextvalue in columns: - styledata.barvalues.append(nextvalue) + stackedvalue = "%sstack%i" % (axisname, len(valuecolumns)) + if stackedvalue in columns: + valuecolumns.append(stackedvalue) else: break + styledata.barcolumns.append(valuecolumns) + styledata.barvalueindex = dimension break else: + found = 0 for axisname in axisnames: if (axisname + "name") in columns: - if styledata.barname is not None: - raise ValueError("multiple values") - styledata.barname = axisname + "name" - break - else: - raise ValueError("value nor name missing") + if found > 1: + raise ValueError("multiple names") + found = 1 + styledata.barcolumns.append(axisname + "name") + if not found: + raise ValueError("value/name missing") + if styledata.barvalueindex is None: + raise ValueError("missing value") + if self.subindex >= styledata.barvalueindex: + styledata.barpossubindex = self.subindex + 1 + else: + styledata.barpossubindex = self.subindex styledata.vposmissing = [] - return [styledata.barname] + styledata.barvalues + return styledata.barcolumns[styledata.barvalueindex] + [styledata.barcolumns[i] for i in range(len(styledata.barcolumns)) if i != styledata.barvalueindex] + + def selectstyle(self, styledata, graph, selectindex, selecttotal): + if selecttotal == 1: + if self.subnames is not None: + raise ValueError("subnames set for single-bar data") + styledata.barpossubname = [] + else: + if self.subnames is not None: + styledata.barpossubname = [self.subnames[selectindex]] + else: + styledata.barpossubname = [selectindex] + + def adjustaxis(self, styledata, graph, column, data, index): + if column in styledata.barcolumns[styledata.barvalueindex]: + graph.axes[styledata.barcolumns[styledata.barvalueindex][0]].adjustrange(data, index) + if self.fromvalue is not None and column == styledata.barcolumns[styledata.barvalueindex][0]: + graph.axes[styledata.barcolumns[styledata.barvalueindex][0]].adjustrange([self.fromvalue], None) + else: + try: + i = styledata.barcolumns.index(column) + except ValueError: + pass + else: + if i == styledata.barpossubindex: + graph.axes[column[:-4]].adjustrange(data, index, styledata.barpossubname) + else: + graph.axes[column[:-4]].adjustrange(data, index) + + def initdrawpoints(self, styledata, graph): + styledata.vpos = [None]*(len(styledata.barcolumns)) + styledata.vbarpos = [[None for i in range(2)] for x in styledata.barcolumns] + + if self.fromvalue is not None: + vfromvalue = graph.axes[styledata.barcolumns[styledata.barvalueindex][0]].convert(self.fromvalue) + if vfromvalue < 0: + vfromvalue = 0 + if vfromvalue > 1: + vfromvalue = 1 + else: + vfromvalue = 0 + + styledata.vbarpos[styledata.barvalueindex] = [vfromvalue] + [None]*len(styledata.barcolumns[styledata.barvalueindex]) + + def drawpoint(self, styledata, graph): + styledata.vposavailable = styledata.vposvalid = 1 + for i, barname in enumerate(styledata.barcolumns): + if i == styledata.barvalueindex: + for j, valuename in enumerate(styledata.barcolumns[styledata.barvalueindex]): + try: + styledata.vbarpos[i][j+1] = graph.axes[styledata.barcolumns[i][0]].convert(styledata.point[valuename]) + except (ArithmeticError, ValueError, TypeError): + styledata.vbarpos[i][j+1] = None + styledata.vpos[i] = styledata.vbarpos[i][-1] + else: + for j in range(2): + try: + if i == styledata.barpossubindex: + styledata.vbarpos[i][j] = graph.axes[barname[:-4]].convert(([styledata.point[barname]] + styledata.barpossubname + [j])) + else: + styledata.vbarpos[i][j] = graph.axes[barname[:-4]].convert((styledata.point[barname], j)) + except (ArithmeticError, ValueError, TypeError): + styledata.vbarpos[i][j] = None + try: + styledata.vpos[i] = 0.5*(styledata.vbarpos[i][0]+styledata.vbarpos[i][1]) + except (ArithmeticError, ValueError, TypeError): + styledata.vpos[i] = None + if styledata.vpos[i] is None: + styledata.vposavailable = styledata.vposvalid = 0 + elif styledata.vpos[i] < -self.epsilon or styledata.vpos[i] > 1+self.epsilon: + styledata.vposvalid = 0 + +provider["barcolumns"] = provider["barvalueindex"] = provider["barpos"] = barpos() + + +class bar(_style): + + need = ["barvalueindex", "vbarpos"] + + defaultfrompathattrs = [] + defaultbarattrs = [color.palette.Rainbow, deco.stroked([color.gray.black])] + + def __init__(self, frompathattrs=[], barattrs=[], subnames=None, multikey=0, epsilon=1e-10): + self.frompathattrs = frompathattrs + self.barattrs = barattrs + self.subnames = subnames + self.multikey = multikey + self.epsilon = epsilon def selectstyle(self, styledata, graph, selectindex, selecttotal): if selectindex: @@ -876,85 +971,63 @@ class bar(_style): if styledata.barselecttotal != 1 and self.subnames is not None: raise ValueError("subnames not allowed when iterating over bars") - def adjustaxis(self, styledata, graph, column, data, index): - if column in styledata.barvalues: - graph.axes[styledata.barvalues[0]].adjustrange(data, index) - if column == styledata.barname: - if styledata.barselecttotal == 1: - graph.axes[column[:-4]].adjustrange(data, index, subnames=self.subnames) - else: - for i in range(styledata.barselecttotal): - graph.axes[column[:-4]].adjustrange(data, index, subnames=[i]) - - def drawpoint(self, styledata, graph): - if self.fromvalue is not None: - vfromvalue = graph.axes[styledata.barvalues[0]].convert(self.fromvalue) - if vfromvalue < -self.epsilon: - vfromvalue = 0 - if vfromvalue > 1 + self.epsilon: - vfromvalue = 1 - if styledata.frompathattrs is not None and vfromvalue > self.epsilon and vfromvalue < 1 - self.epsilon: - if styledata.valuepos: + def initdrawpoints(self, styledata, graph): + styledata.bartmpvpos = [None]*4 + l = len(styledata.vbarpos[styledata.barvalueindex]) + if l > 1: + styledata.bartmplist = [] + for i in xrange(1, l): + barattrs = attr.selectattrs(styledata.barattrs, i-1, l) + if barattrs is not None: + styledata.bartmplist.append((i, barattrs)) + else: + styledata.bartmplist = [(1, styledata.barattrs)] + if styledata.frompathattrs is not None: + vfromvalue = styledata.vbarpos[styledata.barvalueindex][0] + if vfromvalue > self.epsilon and vfromvalue < 1 - self.epsilon: + if styledata.barvalueindex: p = graph.vgeodesic(0, vfromvalue, 1, vfromvalue) else: p = graph.vgeodesic(vfromvalue, 0, vfromvalue, 1) graph.stroke(p, styledata.frompathattrs) - else: - vfromvalue = 0 - l = len(styledata.barvalues) - if l > 1: - barattrslist = [] - for i in range(l): - barattrslist.append(attr.selectattrs(styledata.barattrs, i, l)) - else: - barattrslist = [styledata.barattrs] - - vvaluemax = vfromvalue - for barvalue, barattrs in zip(styledata.barvalues, barattrslist): - vvaluemin = vvaluemax - try: - vvaluemax = graph.axes[styledata.barvalues[0]].convert(styledata.point[barvalue]) - except: - continue - - if styledata.barselecttotal == 1: - try: - vnamemin = graph.axes[styledata.barname[:-4]].convert((styledata.point[styledata.barname], 0)) - except: - continue - try: - vnamemax = graph.axes[styledata.barname[:-4]].convert((styledata.point[styledata.barname], 1)) - except: - continue - else: - try: - vnamemin = graph.axes[styledata.barname[:-4]].convert((styledata.point[styledata.barname], styledata.barselectindex, 0)) - except: - continue - try: - vnamemax = graph.axes[styledata.barname[:-4]].convert((styledata.point[styledata.barname], styledata.barselectindex, 1)) - except: - continue + styledata.barcanvas = graph.insert(canvas.canvas()) - if styledata.valuepos: - p = graph.vgeodesic(vnamemin, vvaluemin, vnamemin, vvaluemax) - p.append(graph.vgeodesic_el(vnamemin, vvaluemax, vnamemax, vvaluemax)) - p.append(graph.vgeodesic_el(vnamemax, vvaluemax, vnamemax, vvaluemin)) - p.append(graph.vgeodesic_el(vnamemax, vvaluemin, vnamemin, vvaluemin)) - p.append(path.closepath()) - else: - p = graph.vgeodesic(vvaluemin, vnamemin, vvaluemin, vnamemax) - p.append(graph.vgeodesic_el(vvaluemin, vnamemax, vvaluemax, vnamemax)) - p.append(graph.vgeodesic_el(vvaluemax, vnamemax, vvaluemax, vnamemin)) - p.append(graph.vgeodesic_el(vvaluemax, vnamemin, vvaluemin, vnamemin)) - p.append(path.closepath()) - if barattrs is not None: - graph.fill(p, barattrs) - - def key_pt(self, styledata, c, x_pt, y_pt, width_pt, height_pt): - l = len(styledata.barvalues) - if l > 1: - for i in range(l): - c.fill(path.rect_pt(x_pt+i*width_pt/l, y_pt, width_pt/l, height_pt), attr.selectattrs(styledata.barattrs, i, l)) + def drawpoint(self, styledata, graph): + if styledata.barattrs is not None: + for i, barattrs in styledata.bartmplist: + if None not in styledata.vbarpos[1-styledata.barvalueindex]+styledata.vbarpos[styledata.barvalueindex][i-1:i+1]: + styledata.bartmpvpos[1-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][0] + styledata.bartmpvpos[ styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i-1] + styledata.bartmpvpos[3-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][0] + styledata.bartmpvpos[2+styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i] + p = graph.vgeodesic(*styledata.bartmpvpos) + styledata.bartmpvpos[1-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][0] + styledata.bartmpvpos[ styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i] + styledata.bartmpvpos[3-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][1] + styledata.bartmpvpos[2+styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i] + p.append(graph.vgeodesic_el(*styledata.bartmpvpos)) + styledata.bartmpvpos[1-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][1] + styledata.bartmpvpos[ styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i] + styledata.bartmpvpos[3-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][1] + styledata.bartmpvpos[2+styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i-1] + p.append(graph.vgeodesic_el(*styledata.bartmpvpos)) + styledata.bartmpvpos[1-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][1] + styledata.bartmpvpos[ styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i-1] + styledata.bartmpvpos[3-styledata.barvalueindex] = styledata.vbarpos[1-styledata.barvalueindex][0] + styledata.bartmpvpos[2+styledata.barvalueindex] = styledata.vbarpos[styledata.barvalueindex][i-1] + p.append(graph.vgeodesic_el(*styledata.bartmpvpos)) + p.append(path.closepath()) + styledata.barcanvas.fill(p, barattrs) + + def key_pt(self, styledata, c, x_pt, y_pt, width_pt, height_pt, dy_pt): + if self.multikey: + l = 0 + for i, barattrs in styledata.bartmplist: + c.fill(path.rect_pt(x_pt, y_pt-l*dy_pt, width_pt, height_pt), barattrs) + l += 1 + return l else: - c.fill(path.rect_pt(x_pt, y_pt, width_pt, height_pt), styledata.barattrs) + for i, barattrs in styledata.bartmplist: + c.fill(path.rect_pt(x_pt+(i-1)*width_pt/styledata.bartmplist[-1][0], y_pt, + width_pt/styledata.bartmplist[-1][0], height_pt), barattrs) + return 1 diff --git a/test/functional/test_bargraph.py b/test/functional/test_bargraph.py index f580e76c..dcd5691f 100755 --- a/test/functional/test_bargraph.py +++ b/test/functional/test_bargraph.py @@ -9,11 +9,11 @@ text.set(mode="latex") def test_bar(c, x, y): g = c.insert(graph.graphxy(x, y, height=5, width=5, x=graph.axis.bar(title="Month", painter=graph.axis.painter.bar(nameattrs=[text.halign.right, trafo.rotate(90)])))) - g.plot(graph.data.file("data/testdata2", xname=1, y=2), [graph.style.bar(fromvalue=0)]) + g.plot(graph.data.file("data/testdata2", xname=1, y=2, text=2), [graph.style.barpos(fromvalue=0), graph.style.bar(), graph.style.text()]) def test_bar2(c, x, y): g = c.insert(graph.graphxy(x, y, height=5, width=5, y=graph.axis.bar(title="Month"))) - g.plot(graph.data.file("data/testdata2", x=2, yname=1), [graph.style.bar()]) + g.plot(graph.data.file("data/testdata2", x=2, dx="1", yname=1), [graph.style.bar(), graph.style.errorbar()]) def test_bar3(c, x, y): g = c.insert(graph.graphxy(x, y, height=5, width=12, x=graph.axis.bar(multisubaxis=graph.axis.bar(dist=0), painter=graph.axis.painter.bar(innerticklength=0.2)))) -- 2.11.4.GIT