By Neha ingale
It is a project about Plotting 3D bar char in Python using Matplotlib. The 3D bar chart is quite unique, this helps to plot multiple dimensions to visualize the plots better.
In this project, matplotlib will plot all the data points in the two-dimensional space. for that, we imported NumPy, matplotlib.Pyplot , mpl_toolkits.mplot3d library in the code. using np, plt and axes3d as the alias names for NumPy, matplotlib.pyplot and mpl_toolkits.mplot3d respectively.
For bar chart, we take parameters x, y, z, dx, dy and dz. Under this function, we created a figure object using the plt. figure() function. After that, we created axes for the figure using the axes () function. Under the axes function, we passed an argument projection=”3d”.
We plotted the three-dimensional bar charts using the bar3d () function. In this function, we passed all six arguments. We also set the color property to the function using the color in this function.for color using conditional statements if dimensions are less than 5 we apply red color else apply yellow color.
We set labels along the x-axis, y-axis and z-axis using xlabel(), ylabel() and zlabel() attributes. The finally we displayed the plot using the plt.show() function.