References

TapeMeasure.HDimensionsType
mutable struct HDimensions{T, S}

A mutable struct representing the horizontal dimensions for an object that can be shown on a plot using Plots.jl or Makie.jl.

Fields

  • xs::Vector{T}: A vector containing the x-coordinates.
  • ys::Vector{S}: A vector containing the y-coordinates.
  • labels::Labels{T, S}: An instance of Labels containing labels for the x and y coordinates.
  • minor_lines::Vector{S}: A vector containing the positions of minor grid lines.
  • major_lines::Vector{S}: A vector containing the positions of major grid lines.
  • offset::T: Stores the offset value of the dimension

Type Parameters

  • T: The type of the elements in the xs vector.
  • S: The type of the elements in the ys, minor_lines, major_lines vectors, and offset value.
source
TapeMeasure.LabelsType
mutable struct Labels{T, S}

A structure to hold labeled information for dimensions object.

Fields

  • xs::Vector{T}: A vector of x-coordinates of type T.
  • ys::Vector{S}: A vector of y-coordinates of type S.
  • lbls::Vector{String}: A vector of labels corresponding to the data points.
source
TapeMeasure.VDimensionsType
mutable struct VDimensions{T, S}

A mutable struct representing the right dimensions for an object that can be shown on a plot using Plots.jl or Makie.jl.

Fields

  • xs::Vector{T}: A vector containing the x-coordinates.
  • ys::Vector{S}: A vector containing the y-coordinates.
  • labels::Labels{T, S}: An instance of Labels containing labels for the x and y coordinates.
  • minor_lines::Vector{T}: A vector containing the positions of minor extension lines.
  • major_lines::Vector{T}: A vector containing the positions of major extension lines.
  • offset::T: Stores the offset value of the dimension

Type Parameters

  • T: The type of the elements in the xs, minor_lines, major_lines vectors and offset value.
  • S: The type of the elements in the ys vector.
source
TapeMeasure._dimensionsMethod
dimensions(
xs::Vector{Vector{T}},
ys::Vector{Vector{S}};
) where T where S

Finds the dimensions of a horizontally spaced set of objects with points xs and ys. Each vector in xs and ys represents a new object.

source
TapeMeasure._find_midpointsMethod
find_midpoints(xs::AbstractVector{T}) where T

Compute the midpoints of a vector xs, which consists of computing the average between adjacent values in the vector.

Example

julia> a = [10; 20; 30; 40; 50]
5-element Vector{Int64}:
 10
 20
 30
 40
 50

julia> find_midpoints(a)
4-element Vector{Int64}:
 15
 25
 35
 45
source
TapeMeasure._find_spacingMethod
find_spacing(xs::AbstractVector{T}) where T

Compute the spacing of a vector xs, which consists of computing the difference between adjacent values in the vector.

Example

julia> a = [1; 3; 7; 20; 30]
5-element Vector{Int64}:
  1
  3
  7
 20
 30

julia> find_spacing(a)
4-element Vector{Int64}:
  2
  4
 13
 10
source
TapeMeasure.dim_bottomMethod
dim_bottom(xs::Vector{T}, ys::Vector{S}; offset::S=0) -> Union{TopDimensions, BottomDimensions}
dim_bottom(object::Vector{Tuple{T, S}}; offset=zero(S)) where {T, S}

Computes the bottom dimension for a given set of x and y coordinates of an object.

Arguments

  • xs::Vector{T}: A vector of x coordinates.
  • ys::Vector{S}: A vector of y coordinates.
  • offset: An optional offset value of type S. Defaults to zero.

Returns

  • HDimensions object containing:
    • x_dims: The calculated x-dimensions.
    • y_dims: The adjusted y-dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects

If the offset is not provided, it is set to 10% of the range of x coordinates. The function then computes the x and y dimensions, major and minor lines, and labels, and returns the appropriate dimensions object based on the offset value.

source
TapeMeasure.dim_leftMethod
dim_left(xs::Vector{T}, ys::Vector{S}; offset::S=0) -> Union{RightDimensions, LeftDimensions}
dim_left(object::Vector{Tuple{T, S}}; offset=zero(T)) where {T, S}

Computes the left dimensions of a given set of x and y coordinates of an object.

Arguments

  • xs::Vector{T}: A vector of x coordinates.
  • ys::Vector{S}: A vector of y coordinates.
  • offset: An optional offset value of type S. Defaults to zero.

Returns

  • VDimensions object containing:
    • x_dims: The x dimensions adjusted by the offset.
    • y_dims: The y dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects

If the offset is not provided, it is set to 10% of the range of x coordinates. The function then computes the x and y dimensions, major and minor lines, and labels, and returns the appropriate dimensions object based on the offset value.

source
TapeMeasure.dim_rightMethod
dim_right(xs::Vector{T}, ys::Vector{S}; offset::S=0) -> Union{RightDimensions, LeftDimensions}
dim_right(object::Vector{Tuple{T, S}}; offset=zero(T)) where {T, S}

Computes the right dimension of a given set of x and y coordinates of an object.

Arguments

  • xs::Vector{T}: A vector of x coordinates.
  • ys::Vector{S}: A vector of y coordinates.
  • offset: An optional offset value of type S. Defaults to zero.

Returns

  • VDimensions object containing:
    • x_dims: The x dimensions adjusted by the offset.
    • y_dims: The y dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects

If the offset is not provided, it is set to 10% of the range of x coordinates. The function then computes the x and y dimensions, major and minor lines, and labels, and returns the appropriate dimensions object based on the offset value.

source
TapeMeasure.dim_topMethod
dim_top(xs::Vector{T}, ys::Vector{S}; offset::S=0) -> Union{TopDimensions, BottomDimensions}
dim_top(object::Vector{Tuple{T, S}}; offset=zero(S)) where {T, S}

Computes the top dimensions for a given set of x and y coordinates of an object.

Arguments

  • xs::Vector{T}: A vector of x coordinates.
  • ys::Vector{S}: A vector of y coordinates.
  • offset: An optional offset value of type S. Defaults to zero.

Returns

  • HDimensions object containing:
    • x_dims: The calculated x-dimensions.
    • y_dims: The adjusted y-dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects

If the offset is not provided, it is set to 10% of the range of x coordinates. The function then computes the x and y dimensions, major and minor lines, and labels, and returns the appropriate dimensions object based on the offset value.

source
TapeMeasure.h_dimMethod
h_dim(objects::Vector{Vector{Tuple{T, S}}}; offset = zero(S)) where {T, S}

Calculate the horizontal dimension of a collection of objects.

Arguments

  • objects::Vector{Vector{Tuple{T, S}}}: A vector of vectors, where each inner vector contains tuples of type (T, S).
  • offset: An optional offset value of type S. Defaults to zero(S).

Returns

  • HDimensions object containing:
    • x_dims: The calculated x-dimensions.
    • y_dims: The adjusted y-dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects
source
TapeMeasure.h_dimMethod
h_dim(xs::Vector{Vector{T}}, ys::Vector{Vector{S}}; offset = zero(S)) where {T, S}

This function calculates the horizontal dimensions based on the input vectors xs and ys.

Arguments

  • xs::Vector{Vector{T}}: A vector of vectors containing the x-coordinates.
  • ys::Vector{Vector{S}}: A vector of vectors containing the y-coordinates.
  • offset: An optional parameter with a default value of zero(S), used to adjust the y-dimensions.

Returns

  • HDimensions object containing:
    • x_dims: The calculated x-dimensions.
    • y_dims: The adjusted y-dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects
source
TapeMeasure.v_dimMethod
v_dim(objects::Vector{Vector{Tuple{T, S}}}; offset = zero(S)) where {T, S}

Calculate the vertical dimension of a collection of objects.

Arguments

  • objects::Vector{Vector{Tuple{T, S}}}: A vector of vectors, where each inner vector contains tuples of type (T, S).
  • offset: An optional offset value of type S. Defaults to zero(S).

Returns

  • VDimensions object containing:
    • x_dims: The x dimensions adjusted by the offset.
    • y_dims: The y dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects
source
TapeMeasure.v_dimMethod
v_dim(xs::Vector{Vector{T}}, ys::Vector{Vector{S}}; offset = zero(T)) where {T, S}

Calculate the vertical dimensions for a given set of x and y coordinates.

Arguments

  • xs::Vector{Vector{T}}: A vector of vectors containing the x coordinates.
  • ys::Vector{Vector{S}}: A vector of vectors containing the y coordinates.
  • offset: An optional parameter with a default value of zero(S), used to adjust the x-dimensions.

Returns

  • VDimensions object containing:
    • x_dims: The x dimensions adjusted by the offset.
    • y_dims: The y dimensions.
    • labels: The dimension labels.
    • minor_lines: The minor lines for the dimensions.
    • major_lines: The major lines for the dimensions.
    • offset: offset from reference objects
source