Reputation: 71
From this dataset:
data <- data.frame("type" = c("low_carbon", "high_carbon"),
"start" = c(0, 0.7 * pi),
"end" = c(0.7 * pi, pi)
)
I wanted to make a gauge with ggpllot2
and ggforce
library("ggplot2")
library("ggforce")
Here is the code:
ggplot(data = data) +
geom_arc_bar(
mapping = aes(
x0 = 1,
y0 = 1,
fill = type,
start = start - pi / 2,
end = end - pi / 2,
r0 = 0.75,
r = 1
)
) +
theme_minimal() +
theme(legend.position = "bottom", legend.text = element_text(size = 11))
So i want a width of 0.25
because r - r0 = 1 - 0.75 = 0.25
, but as you see the gauge width is not uniform everywhere.
See output plot:
So is it possible to make it the same with everywhere, for example 0.25
?
Thanks !
I tried to scale differently the y axis, but is there a more elegant way ?
Upvotes: 0
Views: 53