is it possible to generate a 3D bar chart in r

could you please help me how to generate the 3D plot something as below

dat <- tibble::tribble(
  ~subject, ~response, ~duration,
  '1', 10, 20,
  '2', -7, 30,
  '3', 5, 20,
  '4', 7, 50,
  '5', -5, 40
)

1 Like

Yes, although a different style is more usual.

dat <- tibble::tribble(
  ~subject, ~response, ~duration,
  '1', 10, 20,
  '2', -7, 30,
  '3', 5, 20,
  '4', 7, 50,
  '5', -5, 40)
dat$cluster <- factor(kmeans(dat,3)$cluster)
dat$subject <- as.factor(dat$subject)
p <- plotly::plot_ly(dat, x=~subject, y=~response, 
             z=~duration, color=~cluster) |>
  plotly::add_markers(size=1.5)
print(p)

Drag the object Plotly 3D demonstration

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.