References
TapeMeasure.HDimensions
TapeMeasure.Labels
TapeMeasure.VDimensions
TapeMeasure._dimensions
TapeMeasure._find_midpoints
TapeMeasure._find_spacing
TapeMeasure._find_theta
TapeMeasure._get_major_minor_lines
TapeMeasure.dim_bottom
TapeMeasure.dim_left
TapeMeasure.dim_right
TapeMeasure.dim_top
TapeMeasure.h_dim
TapeMeasure.h_dim
TapeMeasure.v_dim
TapeMeasure.v_dim
TapeMeasure.HDimensions
— Typemutable 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 ofLabels
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 thexs
vector.S
: The type of the elements in theys
,minor_lines
,major_lines
vectors, andoffset
value.
TapeMeasure.Labels
— Typemutable struct Labels{T, S}
A structure to hold labeled information for dimensions object.
Fields
xs::Vector{T}
: A vector of x-coordinates of typeT
.ys::Vector{S}
: A vector of y-coordinates of typeS
.lbls::Vector{String}
: A vector of labels corresponding to the data points.
TapeMeasure.VDimensions
— Typemutable 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 ofLabels
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 thexs
,minor_lines
,major_lines
vectors andoffset
value.S
: The type of the elements in theys
vector.
TapeMeasure._dimensions
— Methoddimensions(
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.
TapeMeasure._find_midpoints
— Methodfind_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
TapeMeasure._find_spacing
— Methodfind_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
TapeMeasure._find_theta
— Methodfind_theta(xs, ys)
Not implemented.
TapeMeasure._get_major_minor_lines
— Methodget_major_minor_lines(x_or_y_dims, offset::T) where T
TapeMeasure.dim_bottom
— Methoddim_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 typeS
. 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.
TapeMeasure.dim_left
— Methoddim_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 typeS
. 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.
TapeMeasure.dim_right
— Methoddim_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 typeS
. 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.
TapeMeasure.dim_top
— Methoddim_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 typeS
. 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.
TapeMeasure.h_dim
— Methodh_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 typeS
. Defaults tozero(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
TapeMeasure.h_dim
— Methodh_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 ofzero(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
TapeMeasure.v_dim
— Methodv_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 typeS
. Defaults tozero(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
TapeMeasure.v_dim
— Methodv_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 ofzero(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