Rayon line objects encode information about where and how line segments should be drawn. They are used throughout Rayon, notably in borders, grid lines and plots.
Lines are created using the new_line method.
The rendering backends Rayon uses generally perform antialiasing on images to remove distracting artifacts. This results in smooth diagonal lines, corners and curves.
When drawing straight vertical and horizontal lines, however, antialiasing can cause a lines edges to be blurred. This can sometimes be avoided (e.g., by aligning the edges of the line exactly on a pixel boundary).
If the fixup parameter is specified in the new_line method and the line is perfectly horizontal or vertical, Rayon will attempt to adjust the line’s position to avoid anti-aliasing. Note, however, that this may introduce problems of its own, for instance by introducing gaps between objects that should be contiguous.
Lines can be created using one of two methods on the Toolbox object. The first is the new_line method, which creates a line from a label and set of arguments, similarly to most methods in the toolbox.
Alternatively, the new_line_from_spec method takes a string line specification (see Specifying Line Styles) and uses that to create a line. The string specification method is useful for programs which create lines based on user input.
Renders a dashed line.
color is the color of the line.
width is the width of the line in pixels/points.
If fixup is True, Rayon will attempt to “fix up” perfectly horizontal and vertical lines to avoid anti-aliasing. This behavior is disabled if fixup is False.
Renders a dotted line.
color is the color of the line.
width is the width of the line in pixels/points.
If fixup is True, Rayon will attempt to “fix up” perfectly horizontal and vertical lines to avoid anti-aliasing. This behavior is disabled if fixup is False.
Renders a line that is a mixture of dots and dashes.
color is the color of the line.
width is the width of the line in pixels/points.
If fixup is True, Rayon will attempt to “fix up” perfectly horizontal and vertical lines to avoid anti-aliasing. This behavior is disabled if fixup is False.