Struct astrup::axis::Axis [] [src]

pub struct Axis { /* fields omitted */ }

Axis

An axis is a reference source for the plot.

Methods

impl Axis
[src]

[src]

[src]

[src]

Set the axis color

[src]

Set the axis color

[src]

Set the axis color

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Compute marks

Marks are used to determine the location of ticks and gridlines.

This method will return a list of evenly spaced marks according to the following method. This assumes that the data range is known, and that know how many marks we want. The latter is determined by a variable, and will be used more of a guide than as the actual number of marks we get in the end.

Method

  1. Find the orider of magnitude of the difference in the data range. Call this p. 2a. Let min_point be min(data) rounded down to nearest 10p - 2. 2b. Let max_point be max(data) rounded up to nearest 10p - 2.
  2. mark_distance = (max_point - min_point) / num_labels rounded to nearest 10p - 2
  3. Then, let mark_k = min_point + k*mark_distance, for k = 0 until mark_k is greater or equal to max(data).
  4. Transform between labels in the data framework (the above) and positions in the drawing framework using the data range and axis frame.

    • The user can now set data range, but this function will override it. With this, the output looks nicer, but I assume that when the user puts a data range, the user assumes that this range should be used.

[src]

Fit

This function is called just before draw(), and updates the default w.r.t. user input. and changes above in the hierarchy (canvas -> plot -> figure).

[src]

Draw axis on canvas.

Trait Implementations

impl Clone for Axis
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Axis
[src]

[src]

Formats the value using the given formatter.