KDE 4.7 PyKDE API Reference

- KDE's Python API

# KPlotAxis Class Reference

`from PyKDE4.kdeui import *`

## Detailed Description

Axis for KPlotWidget

Contains all data for drawing an axis including format specification axis labels.

Author:
  Andreas Nicolai

Version: 1.0

## Methods
| __init__ (self, QString label=QString())
| __init__ (self, KPlotAxis a0)
bool | areTickLabelsShown (self)
bool | isVisible (self)
QString | label (self)
[float] | majorTickMarks (self)
[float] | minorTickMarks (self)
| setLabel (self, QString label)
| setTickLabelFormat (self, QString format='g', int fieldWidth=0, int precision=-1)
| setTickLabelsShown (self, bool b)
| setTickMarks (self, float x0, float length)
| setVisible (self, bool visible)
QString | tickLabel (self, float value)
QString | tickLabelFormat (self)
int | tickLabelPrecision (self)
int | tickLabelWidth (self)

## Method Documentation

__init__ | ( | self, |
|  | QString | label=QString()
| ) |  |  |

Constructor, constructs an axis with the label label.

__init__ | ( | self, |
|  | KPlotAxis | a0
| ) |  |  |

bool areTickLabelsShown | ( |  | self ) |

Returns:
  whether tick labels will be drawn for this axis

bool isVisible | ( |  | self ) |

Returns:
  whether the axis is visible or not

QString label | ( |  | self ) |

Returns:
  the label string for this axis

[float] majorTickMarks | ( |  | self ) |

Returns:
  the list of coordinates of the major tickmarks for this axis

Note:
  the positions of tickmarks are automatically computed by setTickMarks().

@sa setTickMarks() @sa minorTickMarks()

[float] minorTickMarks | ( |  | self ) |

Returns:
  the list with the minor tickmarks

Note:
  the positions of tickmarks are automatically computed by setTickMarks().

@sa setTickMarks() @sa majorTickMarks()

setLabel | ( | self, |
|  | QString | label
| ) |  |  |

Sets the axis label. Set the label to an empty string to omit the axis label.

Parameters:

  | label | a string describing the data plotted on the axis.

setTickLabelFormat | ( | self, |
|  | QString | format='g',
|  | int | fieldWidth=0,
|  | int | precision=-1
| ) |  |  |

Set the display format for converting the double value of the tick's position to the QString for the tick label.

Normally, the format character is one of 'e', 'E', 'f', 'g', or 'G' (see the documentation for QString.arg(double) for details).

In addition, it is possible to set the format character to 't'; in this case the tickmark value is interpreted as a time in hours, and the ticklabel string will be in "hh:mm" clock format. Note that when the format character is 't', the fieldWidth and prec values are ignored.

Parameters:

  | format | the format specification character
  | fieldWidth | the number of characters in the output string. If set to 0, the string will be as wide as it needs to be to fully render the value.
  | precision | the number of characters following the decimal point.

setTickLabelsShown | ( | self, |
|  | bool | b
| ) |  |  |

Determine whether tick labels will be drawn for this axis.

Parameters:

  | b | if true, tick labels will be drawn.

setTickMarks | ( | self, |
|  | float | x0,
|  | float | length
| ) |  |  |

Determine the positions of major and minor tickmarks for this axis.

Note:
  this function is called by KPlotWidget whenever the plot's limits are modified.

Parameters:

  | x0 | the minimum data coordinate of the axis.
  | length | the range covered by the axis, in data units.

@sa majorTickMarks() @sa minorTickMarks()

setVisible | ( | self, |
|  | bool | visible
| ) |  |  |

Sets the "visible" property of the axis.

Parameters:

  | visible | if true, this axis will be drawn on the KPlotWidget

QString tickLabel | ( | self, |
|  | float | value
| ) |  |  |

Returns:
  the ticklabel string for the given value, rendered according to the current format specification.

Parameters:

  | the | value to be rendered as a tick label.

@sa setTickLabelFormat()

QString tickLabelFormat | ( |  | self ) |

Returns:
  the number format of the tick labels

int tickLabelPrecision | ( |  | self ) |

Returns:
  the number precision of the tick labels

int tickLabelWidth | ( |  | self ) |

Returns:
  the field width of the tick labels