How to achieve grouped/hierarchical x-axis labels in Plotly

I’m building a dashboard in R Shiny using Plotly and I’m struggling to recreate a hierarchical x-axis structure. I want to reproduce something like this picture:

But all I’m getting at the moment is this:

Someone please help ?