This module defines a class for drawing rulers.
Draws a line between two spatial positions from a start point (x1,y1) to an end point (x2,y2) with labels indicating a constant offset in world coordinates. The positions are either in pixels or in world coordinates. The start and end point can also be positions entered as a string which follows the syntax described in method positions.str2pos(). The ruler can also be given as a start point and a size and angle. These are distance and angle on a sphere.
The ruler is a straight line but the ticks are usually not equidistant because projection effects make the offsets non linear (e.g. the TAN projection diverges while the CAR projection shows equidistant ticks). By default, the zero point is exactly in the middle of the ruler but this can be changed by setting a value for lambda0. The step size for the ruler ticks in units of the spatial axes is entered in parameter step. At least one of the axes in the plot needs to be a spatial axis.
Size and step size can be entered in units given by a parameter units. The default unit is degrees.
Parameters: |
|
||
---|---|---|---|
Raises: |
|
||
Returns: | A ruler object of class ruler which is added to the plot container with Plotversion’s method Plotversion.add(). This ruler object has two methods to change the properties of the line and the labels:
|
||
Notes: | A bisection is used to find a new marker position so that the distance to a previous position is step.. We use a formula of Thaddeus Vincenty, 1975, for the calculation of a distance on a sphere accurate over the entire sphere. |
||
Examples: | Create a ruler object and change its properties
|
Set the ruler line properties. The keyword arguments are Matplotlib keywords for Line2D objects.
Parameters: | kwargs (Python keyword arguments) – Keyword argument(s) for changing the default properties of the ruler line. This line is a Line2D Matplotlib object with attributes like linewidth, color etc. |
---|
Set the ruler label properties. The keyword arguments are Matplotlib keywords for Text objects. Note that the properties apply to all labels. It is not possible to address a separate label.
Parameters: | kwargs (Python keyword arguments) – Keyword argument(s) for changing the default properties of the ruler labels. This line is a Text Matplotlib object with attributes like fontsize, color etc. |
---|