Hello,
I've developped an application that displays volume by using Axes3d module and plot() method. It runs well.
Volumes are expressed in axes x,y,z that represents respectively the latitude,longitude and altitude.
Taking a simple volume : a parallelepiped is defined by 2 series of points :
A1(x1,y1,z_upper), A2(x2,y2,z_upper), A3(x3,y3,z_upper), A4(x4,y4,z_upper)
A11(x1,y1,z_lower), A12(x2,y2,z_lower), A13(x3,y3,z_lower), A14(x4,y4,z_lower)
My objective is to displays the faces of such volume (6 faces in that case).
I suppose that I should trace my volume face by face and the following source code displays a single surface (a face of my volume):
···
##########################################
import gtk
import numpy as np
from matplotlib.patches import Polygon, PathPatch
import mpl_toolkits.mplot3d.art3d as art3d
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
class SectorDisplay2__:
def __init__(self):
win = gtk.Window()
win.set_default_size(800,800)
vbox = gtk.VBox()
win.add(vbox)
fig = Figure()
canvas = FigureCanvas(fig) # a gtk.DrawingArea
ax = fig.add_subplot(111, projection='3d')
a = np.array([[0,0],[10,0],[10,10],[0,10]])
p = Polygon(a,fill=True)
ax.add_patch(p)
art3d.pathpatch_2d_to_3d(p, z=3)
ax.set_xlim3d(0, 20)
ax.set_ylim3d(0, 20)
ax.set_zlim3d(0, 20)
vbox.pack_start(canvas)
win.show_all()
# Run the Gtk mainloop
gtk.main()
if __name__ == '__main__':
SectorDisplay2__()
##########################################
But two problems appears :
- the intruction "art3d.pathpatch_2d_to_3d(p, z=3)" can be called only once ! else message "AttributeError: 'PathPatch3D' object has no attribute '_path2d'" is issued
- the isntruction set_xlim3d(0, 20) has no effect : whatever the values supplied to set_slim3d, the minimum/maximum of axes are defined always by the minimum/maximum of the data to display (coordinates of my points).
Thank you for any suggestion (even to represent such volumes in a different way as I choose)