I'm working with a dataset in R that includes various parameters related to agricultural practices and outcomes. Here's a simplified structure of my data frame:
df <- structure(list(peanutSeedToFood = c(1.41896783664886, 1.45277228739953,
2.45130326046724, 1.05434906990347, 2.5, 1.18856873091444), rotationCycle = c("ThreeYears",
"ThreeYears", "ThreeYears", "ThreeYears", "ThreeYears", "ThreeYears"), ownFallowUse = c("UseFallowIfNeeded", "UseFallowIfNeeded",
"UseFallowIfNeeded", "UseFallowIfNeeded", "UseFallowIfNeeded", "NeverUseFallow"), loanStrategy = structure(c(2L, 2L, 1L, 2L,
1L, 1L), .Label = c("AllExtraParcelsLoaner", "ExtraParcelsExceptFallowLoaner", "Selfish"), class = "factor"), ...), class = "data.frame")
The dataframe includes a factor variable loanStrategy with three levels: "AllExtraParcelsLoaner", "ExtraParcelsExceptFallowLoaner", and "Selfish". I'm interested in visualizing the 3D space occupied by each of these groups based on three continuous variables: objective.lastPopulation, objective.lastEffectiveFallowRatio, and objective.lastMilYield.
I've been able to create a 3D scatter plot using Plotly in R.
plyply<- plot_ly(df, x=~objective.lastPopulation,
y=~objective.lastMilYield,
z=~-objective.lastEffectiveFallowRatio,
color=~loanStrategy, size=~rainFall)
plyply <- plyply %>% add_markers()
plyply
But now I want to go a step further and visualize the convex hull that encompasses the points of each group in this 3D space, essentially visualizing the volume occupied by each group.

You can use the cxhull package to get a mesh of the convex hull, and you can plot such a mesh with plotly using
add_tracewithtype = "mesh3d".However it seems that the
colorargument has no effect.