Set part scale of a drawing based on the complete drawing in matplotlib 3D
Good Night guys! I need to create a graphical interface where the user can insert lines and eventually circles at the ends of these lines, as the example shows, but depending on the size of the lines, my circles that are fixed in radius 0,5, get too large or too small. How could I adjust the size of the circle to be, for example, 10% of the size of the drawing size?I posted only part of the code because, as it has the built-in graphical interface, he'd get too big:
for i in range(0,12): #faz a plotagem das barras
self.p = np.array(self.p)
self.p = self.p.reshape(-1,3)
incid = [] #com o incid, obtenho os pontos que quero ligar e formar uma barra
falho = 0
for j in range(0,2):
try:
incid.append( int( self.ql_incid[str(i)+str(j)].text() ) )
except:
falho = 1
if falho == 0:
xi = self.p[incid[0]][0] # Coordenada X do ponto inicial
yi = self.p[incid[0]][1] # Coordenada Y do ponto inicial
zi = self.p[incid[0]][2] # Coordenada Z do ponto inicial
xf = self.p[incid[1]][0] # Coordenada X do ponto final
yf = self.p[incid[1]][1] # Coordenada Y do ponto final
zf = self.p[incid[1]][2] # Coordenada Z do ponto final
self.lista_incid.append([xi, yi, zi, xf, yf, zf])
self.lista_incid = (self.lista_incid)
self.axes.plot([xi, xf], [yi, yf], [zi, zf], color='b')
self.fig.canvas.draw()
for i in range(12): #circulos:
try: #circulo azul
if self.qg_restri[str(i)+str(3)].checkState() == qc.Qt.Checked:
x1 = self.p[i][0]
y1 = self.p[i][1]
z1 = self.p[i][2]
p = Circle((x1, y1), 1, alpha=0.7)
self.axes.add_patch(p)
art3d.pathpatch_2d_to_3d(p, z= z1, zdir='y')
self.fig.canvas.draw()
plt.show()
except:
pass
try: #circulo vermelho
if self.qg_restri[str(i)+str(4)].checkState() == qc.Qt.Checked:
x1 = self.p[i][0]
y1 = self.p[i][1]
z1 = self.p[i][2]
p = Circle((x1, y1), 1, facecolor= 'r', alpha=0.7)
self.axes.add_patch(p)
art3d.pathpatch_2d_to_3d(p, z= z1)
self.fig.canvas.draw()
except:
pass
try: #circulo verde
if self.qg_restri[str(i)+str(5)].checkState() == qc.Qt.Checked:
x1 = self.p[i][0]
y1 = self.p[i][1]
z1 = self.p[i][2]
p = Circle((x1, y1), 1, facecolor= 'g', alpha=0.7)
self.axes.add_patch(p)
art3d.pathpatch_2d_to_3d(p, z= z1, zdir='x')
self.fig.canvas.draw()
except:
pass
1
Author: Juliana Paula, 2018-09-12