Axis¶
-
class
visualife.core.Axis(min_screen, max_screen, min_data, max_data)¶ Bases:
objectRepresents an arbitrary axis of a plot.
The direction of the axis depends on the derived classes (X or Y).
Creates an instance of an axis
Parameters: - min_screen (
float) – starting point to draw this axis in screen coordinates - max_screen (
float) – end point to draw this axis in screen coordinates - min_data (
float) – minimum value covered by this axis, assigned tomin_screen - max_data (
float) – maximum value covered by this axis, assigned tomax_screen
Attributes Summary
are_tics_insidedefines whether tics point inside the plot axis_locationa character that defines the location of this axis: either U, B, L or R big_screen_ticsReturns a list of tics positions in screen coordinates labelA label of an axis label_font_sizeDefine font size for the label (title) of this axis label_shiftA shift label max_data_valuethe largest data value fitting into this axis, i.e. max_screen_coordinateReturns the maximum coordinate of this axis in screen units min_data_valuethe smallest data value fitting into this axis, i.e. min_screen_coordinateReturns the minimal coordinate of this axis in screen units n_ticsshow_ticsA flag to show / hide tics of this axis show_tics_labelsA flag to show / hide tics labels of this axis small_screen_ticsReturns a list of tics positions in screen coordinates tics_factortics_label_font_sizeDefine font size for the tics labels of this axis tics_labelsReturns a list of tics labels tics_verticalTrue if tics are vertical, false if they are horizontal tics_widththe length (vertical for X, horizontal for Y axis) of tics - the same value for all of them Methods Summary
add_tics_labels([format_string])Sets tics labels using the given format to convert real values into text axis_coordinate(p)Calculates an axis value that would be drawn at a given screen coordinate screen_coordinate(x)Calculates a screen coordinate for a data point set_range(min_value, max_value)Sets new extreme values for the data range tics(n_small_tics, n_big_tics[, format_string])Sets a given number of tics for this axis tics_at_fraction(fraction_values, labels_values)Sets tics for this axis at given fractions of the axis range tics_at_values(values[, format_string])Sets tics for this axis at arbitrary axis values Attributes Documentation
-
are_tics_inside¶ defines whether tics point inside the plot
Getter: returns True if tics are inside Setter: sets the value if tics are inside Type: boolean
-
axis_location¶ a character that defines the location of this axis: either U, B, L or R
Getter: Returns this axis’ location Setter: Sets this axis’ location Type: char - Allowed values:
- ‘U’ or ‘u’ - upper X axis
- ‘B’ or ‘B’ - bottom X axis
- ‘L’ or ‘l’ - left Y axis
- ‘R’ or ‘R’ - right Y axis
-
big_screen_tics¶ Returns a list of tics positions in screen coordinates
-
label¶ A label of an axis
Getter: returns a label of an axis Setter: sets new label of an axis Type: string
-
label_font_size¶ Define font size for the label (title) of this axis
Getter: returns the font size Setter: sets the font size Type: float
-
label_shift¶ A shift label
Getter: returns a shift label Setter: sets the new shift label Type: float
-
max_data_value¶ the largest data value fitting into this axis, i.e. the upper range limit of the plotted data
Getter: returns the right value of the data range Setter: sets the right value of the data range Type: float
-
max_screen_coordinate¶ Returns the maximum coordinate of this axis in screen units
For X axis this will position of the rightmost point, for Y axis - position of the highest point of this axis
-
min_data_value¶ the smallest data value fitting into this axis, i.e. the lower range limit of the plotted data
Getter: returns the left value of the data range Setter: sets the left value of the data range Type: float
-
min_screen_coordinate¶ Returns the minimal coordinate of this axis in screen units
For X axis this will position of the leftmost point, for Y axis - position of the lowest point of this axis
-
n_tics¶
-
show_tics¶ A flag to show / hide tics of this axis
Note, that tics labels visibility is separately controlled by
show_tics_labelspropertyGetter: returns tics state : tics will be drawn if true is returned Setter: sets the new tics visibility state Type: boolean
-
show_tics_labels¶ A flag to show / hide tics labels of this axis
Note, that tics visibility is separately controlled by
show_ticsproperty :getter: returns tics labels state : tics labels will be drawn if true is returned :setter: sets the new tics labels visibility state :type:boolean
-
small_screen_tics¶ Returns a list of tics positions in screen coordinates
-
tics_factor¶
-
tics_label_font_size¶ Define font size for the tics labels of this axis
Getter: returns the font size Setter: sets the font size Type: float
-
tics_labels¶ Returns a list of tics labels
-
tics_vertical¶ True if tics are vertical, false if they are horizontal
Getter: returns the current arrangement of tics Setter: sets the arrangement of tics Type: boolean
-
tics_width¶ the length (vertical for X, horizontal for Y axis) of tics - the same value for all of them
Getter: returns the current width of tics Setter: sets the width of tics Type: float
Methods Documentation
-
add_tics_labels(format_string='%.2f')¶ Sets tics labels using the given format to convert real values into text
-
axis_coordinate(p)¶ Calculates an axis value that would be drawn at a given screen coordinate
Parameters: p ( float) – arbitrary point (screen) coordinateReturns: axis coordinate calculated for the given point
-
screen_coordinate(x)¶ Calculates a screen coordinate for a data point
Parameters: x ( float) – arbitrary value to be convertedReturns: screen coordinate value calculated for the given x
-
set_range(min_value, max_value)¶ Sets new extreme values for the data range
Parameters: - min_value (
float) – minimum value covered by this axix - max_value (
float) – maximum value covered by this axix
- min_value (
-
tics(n_small_tics, n_big_tics, format_string='%.2f')¶ Sets a given number of tics for this axis
the tics are distributed uniformly
Parameters: - n_small_tics (
integer) – the number of small tics to be drawn at this axis - n_big_tics (
integer) – the number of big tics to be drawn at this axis
- n_small_tics (
-
tics_at_fraction(fraction_values, labels_values)¶ Sets tics for this axis at given fractions of the axis range
Parameters: - fraction_values (
float) – fractions of this axis range to put tics at - labels_values (
string) – tics labels
- fraction_values (
-
tics_at_values(values, format_string='%.2f')¶ Sets tics for this axis at arbitrary axis values
Parameters: - values (
float) – values to put tics at - in the units of this axis - labels_values (
string) – tics labels
- values (
- min_screen (