Hello. I wrote earlier this year about the inability to do one-sided errorbars. 
I have made changed to bar.py to draw one sided errorbars. Basically, it checks 
to see whether minval and maxval exist and sets ignoreMin and ignoreMax 
respectively. It then checks both of these prior to plotting the crossbars. 
Here are the changes to drawErrorBars(). Please consider incorporating these 
changes if you feel that they are useful.

    def drawErrorBars(self, painter, posns, barwidth,
                      yvals, dataset, axes, widgetposn):
        """Draw (optional) error bars on bars."""
        s = self.settings
        if s.errorstyle == 'none':
            return

        minval, maxval = self.calculateErrorBars(dataset, yvals)
        if minval is None and maxval is None:
            return

        # handle one sided errors (better) ignore None min/maxVal instead of 
plotting zero length//PJK
        if minval is None:
            minval = yvals
            ignoreMin = True
        else:
            ignoreMin = False
        if maxval is None:
            maxval = yvals
            ignoreMax =True
        else:
            ignoreMax = False

        # convert errors to coordinates
        ishorz = s.direction == 'horizontal'

        mincoord = axes[not ishorz].dataToPlotterCoords(widgetposn, minval)
        mincoord = N.clip(mincoord, -32767, 32767)

        maxcoord = axes[not ishorz].dataToPlotterCoords(widgetposn, maxval)
        maxcoord = N.clip(maxcoord, -32767, 32767)

        # draw error bars
        painter.setPen( self.settings.ErrorBarLine.makeQPenWHide(painter) )
        w = barwidth*0.25
        if ishorz:
            utils.plotLinesToPainter(painter, mincoord, posns,
                                     maxcoord, posns)
            if s.errorstyle == 'barends':
                if ignoreMin is False:
                    utils.plotLinesToPainter(painter, mincoord, posns-w,
                                         mincoord, posns+w)
                if ignoreMax is False:
                    utils.plotLinesToPainter(painter, maxcoord, posns-w,
                                         maxcoord, posns+w)
        else:
            utils.plotLinesToPainter(painter, posns, mincoord,
                                     posns, maxcoord)
            if s.errorstyle == 'barends':
                if ignoreMin is False:
                    utils.plotLinesToPainter(painter, posns-w, mincoord,
                                         posns+w, mincoord)
                if ignoreMax is False:
                    utils.plotLinesToPainter(painter, posns-w, maxcoord,
                                         posns+w, maxcoord)
_______________________________________________
Veusz-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/veusz-discuss

Répondre à