I worked on a simple 3D diagram using the following code:
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111, projection = "3d") ax.set_xlabel("x") ax.set_ylabel("y") ax.set_zlabel("z") ax.set_xlim3d(0,10) ax.set_ylim3d(0,10) ax.set_zlim3d(0,2) xpos = [2,5,8,2,5,8,2,5,8] ypos = [1,1,1,5,5,5,9,9,9] zpos = np.zeros(9) dx = np.ones(9) dy = np.ones(9) dz = np.ones(9) ax.bar3d(xpos, ypos, zpos, dx, dy, dz) plt.gca().invert_xaxis() plt.show()
Thinking of it as a test, everything seems clear so far. I just wondered how I can build each of these 9 bars in a complex way, so, for example, each bar is divided into 4 parts, which make up the whole bar.
Basically, I think about it in the example here.
But instead of two stacks, I want to have 4. Any ideas how to proceed from what I am now? Every hint would be so appreciated.
Thanks!
edit: if I want to implement the given values ββfor each laid out line, for example:
... z = [np.array([ 0.2, 0.6, 0.3, 0.6, 0.4, 0.3, 0.8, 0.5, 0.7]), np.array([ 0.8, 0.4, 0.5, 0.2, 0.8, 0.7, 0.4, 0.2, 0.9]), np.array([ 0.1, 0.2, 0.4, 0.4, 0.2, 0.6, 0.3, 0.6, 0.9]), np.array([ 0.9, 0.5, 0.7, 0.2, 0.5, 0.6, 0.7, 0.9, 0.7])] dz = [z for i in range(4)] ...
This doesn't seem to work, and I don't know why?