AxisX

class visualife.core.AxisX(screen_y, min_screen, max_screen, min_data, max_data, orientation)

Bases: visualife.core.Axis

Represents X axis of a plot.

Creates an instance of an X axis

Attributes Summary

are_tics_inside defines whether tics point inside the plot
axis_location a character that defines the location of this axis: either U, B, L or R
big_screen_tics Returns a list of tics positions in screen coordinates
label A label of an axis
label_font_size Define font size for the label (title) of this axis
label_shift A shift label
max_data_value the largest data value fitting into this axis, i.e.
max_screen_coordinate Returns the maximum coordinate of this axis in screen units
min_data_value the smallest data value fitting into this axis, i.e.
min_screen_coordinate Returns the minimal coordinate of this axis in screen units
n_tics
screen_y Screen Y coordinate for this axis
show_tics A flag to show / hide tics of this axis
show_tics_labels A flag to show / hide tics labels of this axis
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
tics_labels Returns a list of tics labels
tics_vertical True if tics are vertical, false if they are horizontal
tics_width the 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
draw(drawing) Draws axis on a given drawing.
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
screen_y

Screen Y coordinate for this axis

Getter:returns screen Y coordinate for this axis
Setter:sets new screen Y coordinate for this axis
Type:float
show_tics

A flag to show / hide tics of this axis

Note, that tics labels visibility is separately controlled by show_tics_labels property

Getter: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_tics property :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) coordinate
Returns:axis coordinate calculated for the given point
draw(drawing)

Draws axis on a given drawing.

Draws lines,tics lines, axis labeles and tics labels for this axis.

screen_coordinate(x)

Calculates a screen coordinate for a data point

Parameters:x (float) – arbitrary value to be converted
Returns: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
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
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
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