code: def drawAxis(self, painter, rect, axis):
          
          if not axis:
              return
          
          # draw the axis lines
          painter.save()
          pen = QPen(self.axisColor())
          pen.setWidth(3)
          painter.setPen(pen)
          
          # draw the vertical line
          if axis.orientation() == Qt.Vertical:
              line = QLineF(rect.right(), rect.top(),
                            rect.right(), rect.bottom())
              
              painter.drawLine(line)
              painter.setFont(axis.labelFont())
              for y, height, label in self._buildData.get('grid_h_labels', []):
                  painter.drawText(0, y - height / 2.0, rect.width() - 3, height,
                                   Qt.AlignRight | Qt.AlignVCenter, label)
              
              painter.translate(0, rect.center().y())
              painter.rotate(-90)
              
              painter.setFont(axis.titleFont())
              painter.drawText(-rect.height()/2, 0, rect.height(), rect.width(),
                               Qt.AlignHCenter | Qt.AlignTop, axis.title())
              
          # draw the horizontal line
          else:
              line = QLineF(rect.left(), rect.top(),
                            rect.right(), rect.top())
              
              painter.setFont(axis.titleFont())
              painter.drawText(rect,
                               Qt.AlignHCenter | Qt.AlignBottom,
                               axis.title())
              
              painter.drawLine(line)
              painter.setFont(axis.labelFont())
              for x, width, label in self._buildData.get('grid_v_labels', []):
                  painter.drawText(x - width / 2.0, 3, width, rect.height() - 6,
                                   Qt.AlignHCenter | Qt.AlignTop, label)
          painter.restore()
docs: Draws the axis for the given painter.
          
          :param      painter | <QPainter>
                      rect    | <QRect>