how to set more levels: factor level is duplicated

a <- seq(0, 6, 0.2)
b <- seq(0, 360 - 360/256, 360/256)
tibble(aa = rep(a, each = length(b)),
bb = rep(b, length(a)),
x = aacos(bb),
y = aa
sin(bb),
z = c(as.vector(volcano), head(as.vector(volcano), n = 2629))
) |>
ggplot(aes(x, y, z = z)) +
geom_contour()

Warning messages: duplicated rows have been dropped
error in levels<-: factor level 11 is duplicated

how to figure it out. thanks.

geom_contour requires that the x and y points be on an equally spaced grid. The x and y values in your tibble are not on a grid. If you use aa and bb for x and y, you will not get an error.