2

I am trying to plot 2D bars in a Plotly 3D figure. I understand that Plotly's 3D figures do not yet support bar charts out of the box, but I have come across some examples from other people on the Plotly forums which have shown how this might be achieved.

Please see the post Adding a shape to a 3D plot. This is close to what I am trying to achieve, but I am not trying to plot a histogram.

It appears plotting traces as a mesh3d, adding in the missing points and triangulating is the way to go for Plotly's 3D chart, according to other examples I have seen. Below is an example of what I am looking for that I created using Matplotlib.

Matplotlib 2D bar in 3D chart

As you can see, x axis is the date, y axis is the trace name and z axis is the value. I would like to see if I can achieve something similar using Plotly's 3D charts, which are so much better of course because of the client side interactivity.

Is there a working example for what I'm trying to achieve? I am simply looking to plot simple (date, value) per trace as 2D bars in the 3D figure.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mark377
  • 91
  • 8
  • 1
    Does this answer your question? [How to plot 3D Bar chart/ Pie Chart/ Donut using Plotly](https://stackoverflow.com/questions/50597139/how-to-plot-3d-bar-chart-pie-chart-donut-using-plotly) – Blue Robin Jun 12 '22 at 23:30
  • 1
    This is very close to what i want to be able to do, but it only allows me to create the finished figure from a dataset, rather than being able to plot rows of bars per trace, like how you would add a scatter plot for each trace to an existing plotly figure. I will have a play with the code he has provided and see if i can modify it for my needs, but I'm really not the expert when working with vertices. Thanks for the suggestion. – mark377 Jun 15 '22 at 11:36

1 Answers1

0

There isn't any current way to have a bar chart in 3D with Plotly (at least that I am aware of).

Documentation: Plotly Python Open Source Graphing Library 3D Charts

As shown in the documentation, there aren’t any options for a bar chart. There are, however, alternatives like a bubble chart.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Blue Robin
  • 847
  • 2
  • 11
  • 31
  • Thanks, I understand that plotly does not yet offer this solution for their 3d plots which is a shame but I have seen some examples done with mesh3d (like the example from Blue Robin) that attempt to fill in the missing points. I will continue to look for more examples, thanks. – mark377 Jun 15 '22 at 11:39
  • @mark377 Could you update the tags in your post (To add mesh 3d)? – Blue Robin Jun 15 '22 at 17:16