Ask Your Question
1

Is there a bar3 from Matlab equivalent in Sage?

asked 2014-06-21 10:13:52 +0200

Eugene gravatar image

To look like this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-06-21 21:24:10 +0200

Shashank gravatar image

I don't think there is a sage command for that, but you can use matplotlib(present by default in sage) to make these kind of plots. I have pasted a sample code from this site. If you run the code below you will see 3D bar plot.

http://pythonprogramming.net/3d-bar-c...

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax1 = fig.add_subplot(111, projection='3d')

xpos = [1,2,3,4,5,6,7,8,9,10]
ypos = [2,3,4,5,1,6,2,1,7,2]
num_elements = len(xpos)
zpos = [0,0,0,0,0,0,0,0,0,0]
dx = np.ones(10)
dy = np.ones(10)
dz = [1,2,3,4,5,6,7,8,9,10]

ax1.bar3d(xpos, ypos, zpos, dx, dy, dz, color='#00ceaa')
plt.savefig('test.png')
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-06-21 10:13:52 +0200

Seen: 624 times

Last updated: Jun 21 '14