Hi, Thank you for responding.
Here’s a snippet off my code:
using GLMakie
using DelaunayTriangulation
using GeometryBasics
using JSON
using StableRNGs
using Plots
data = JsonReader.read_json_data("data.json")
mean_data = data["mean"]
std_data = data["std"]
series_index = 1
axis, fig = PlotConfig.configure_plot("Uncertain time series", "years", "value")
mean_data_float32 = Float32.(mean_data[series_index])
std_data_float32 = Float32.(std_data[series_index])
time_range_float32 = Float32.(1:length(mean_data[series_index]))
mean_color = GLMakie.RGB(rand(), rand(), rand())
lines!(axis, time_range_float32, mean_data_float32, color = GLMakie.RGBA(mean_color, 0.8), label = "Mean")
# band!(axis, time_range_float32, mean_data_float32 .- std_data_float32, mean_data_float32 .+ std_data_float32, color = GLMakie.RGBA(mean_color, 0.6), label = "Error")
function boundary_points(x, y_lower, y_upper)
xs = Float32[]
ys = Float32[]
push!(xs, x - 0.5)
push!(ys, y_lower)
push!(xs, x + 0.5)
push!(ys, y_lower)
push!(xs, x + 0.5)
push!(ys, y_upper)
push!(xs, x - 0.5)
push!(ys, y_upper)
return xs, ys
end
rng = StableRNG(2)
all_xs = Float32[]
all_ys = Float32[]
for j in 1:20
x = time_range_float32[j]
y_mean = mean_data_float32[j]
y_lower = y_mean - std_data_float32[j]
y_upper = y_mean + std_data_float32[j]
num_points = max(3, Int(ceil(std_data_float32[j])))
xs, ys = boundary_points(x, y_lower, y_upper)
points = [(xs[k], ys[k]) for k in eachindex(xs, ys)]
tri = triangulate(points; rng)
refine!(tri; max_area = 1e-3, min_angle = 29.871, rng)
vorn = voronoi(tri)
smooth_vorn = centroidal_smooth(vorn; maxiters = 2500)
voronoiplot!(axis, smooth_vorn, show_generators = true, markersize = 4)
resize_to_layout!(fig)
end
Here i’m getting the boundaries of the error and constructing a voronoi. But i need them only to get the dots placement, Also it takes a lot of time to compute as well. Can you please suggest better ways to do.