From: <qu...@gm...> - 2009-09-28 22:23:14
|
Greetings, I would like to plot to make a figure with 3 subplots of the form (221) to (223): - each subplot should show a bar3d plot of a matrix - each subplot should have it's own title The problems: a) I don't see (nor did i find something) how i can use subplots combined with bar3d (from the mpl_toolkits.mplot3d) package. b) I don't manage to give the 3d bar plot a title. In the attached code you will see that a title is set, but it does not show up in the figure Could someone please help me out with these problems? Thanks, q --------------------- The code for the basic plot of the matrix: from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib.ticker import FixedFormatter, LinearLocator, FixedLocator from numpy import * psi=1/sqrt(2)*array([1, 0, 0, 1]) rho=outer(psi,psi) fig = plt.figure() ax = Axes3D(fig) elements = (len(rho) * len(rho)) xpos, ypos = meshgrid(array(range(len(rho)))+0.25, array(range(len(rho)))+0.25) xpos = xpos.flatten() ypos = ypos.flatten() zpos = zeros(elements) dx = 0.5 * ones_like(zpos) dy = dx.copy() dz = absolute(rho.flatten()) ax.set_title('absolute') ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#F8F800') plt.show() |