Current Struggle
I am currently building an extension for both Makie.jl and Plots.jl. While I have managed to get it working in Plots.jl, I have not had the same pleasant experience with Makie. I keep coming back to it and continue to run into issues.
The package I hope to create is found here: Dimensions.jl
Since the objects that I want to create recipes for are relatively straight forward, I will use them as the mwe…
Summary of Package
The package basically is centered around two structs and one is contained within the other.
struct TopDimensions
xs # vector of floats
ys # vector of floats
labels # see Labels struct below
minor_lines # will be mapped to yerror bars (high)
major_lines # will be mapped to yerror bars (low)
end
struct Labels
xs # vector of floats
ys # vector of floats
lbls # vector of strings
end
The idea is to plot dimension lines like so:
And you can see it is working with Plots.jl.
Here were the recipes used to create the dimensions shown:
TopDimensions Recipe
@recipe function f(dims::TopDimensions; with_mask=true, dim_color=:black)
legend := false
# points for dimensions
dim_xs, dim_ys = dims.xs, dims.ys
# plot dimensions
@series begin
seriestype := :path
linecolor := dim_color
markercolor := dim_color
yerror --> (dims.major_lines, dims.minor_lines)
markersize := 0
dim_xs, dim_ys
end
# plot labels
@series begin
dims.labels
end
end
Labels Recipe
@recipe function f(lbls::Labels; with_mask=true, font_color=:black, font_size=5)
legend := false
# points for labels
x_lbls, y_lbls, annos = labels_for_plots(lbls, with_mask, font_color, font_size)
# plot labels
@series begin
seriestype:= :scatter
markersize := 0
annotations --> annos
x_lbls, y_lbls
end
end
I can then do plot!(top_dims)
and I will see my dimensions plotted on top of the things I want to dimension.
Need Help
I have looked through the Makie docs and I believe I have the ext folder/ Project.toml file set up properly, but I don’t really have an idea of how to get the recipes working. Could anyone provide help or a solution?
Thanks