I have the following:
library(tidyverse)
library(ggforce)
df <- data.frame(cat = c(1:4),
value = c(30000, 25000, 20000,
10000))
ggplot(df, aes(cat, value)) +
geom_link(aes(x = cat, y = 0, xend = cat, yend = value,
colour = stat(index)), lineend = "round", linewidth = 3) +
scale_colour_gradient(low = "red", high = "green") +
geom_point(aes(fill = value), shape = 21, size = 5, colour = "black") +
scale_fill_gradient(low = "red", high = "green")

I want the geom_point colour to be the same colour as the top of the geom_link line (which it is not in the above plot). I also want geom_link gradient colouring to be consistent across cat levels. If we compare cat 1 to cat 4 in the plot, the gradient colouring is incorrect (the top of the line for cat 4 should be orange, not green).
For my first question, I think it is simply a scaling issue, I want to make stat(index), which is currently 0-1, the same scale as value, but I don't know how to edit stat(index).
You need (or at least that's one possibility) to use after_stat(y) and edit your legend.
library(tidyverse)
library(ggforce)
df <- data.frame(cat = 1:4,
value = c(30000, 25000, 20000, 10000))
ggplot(df, aes(cat, value)) +
geom_link(aes(x = cat, y = 0, xend = cat, yend = value,
colour = after_stat(y)), lineend = "round", linewidth = 3) +
scale_colour_gradient(name = "index", low = "red", high = "green",
limits = c(0, max(df$value)),
breaks = seq(0, max(df$value), length.out = 5),
labels=seq(0,1,0.25)) +
geom_point(aes(fill = value), shape = 21, size = 5, colour = "black") +
scale_fill_gradient(low = "red", high = "green",
limits = c(0, max(df$value)))

Created on 2025-10-04 with reprex v2.1.1