Define part scale of a drawing based on the complete drawing in 3D matplotlib

1

Good evening everyone! I need to create a graphical interface where the user can insert lines and eventually circles at the ends of these lines, as shown in the example, but, depending on the size of the lines, my circles that are fixed at radius 0.5 become very large or very large small. How can I adjust the size of the circle to be, for example, 10% of the size of the drawing? I just put some of the code, because it has the built-in graphical interface, it would be too large:

    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
    
asked by anonymous 13.09.2018 / 00:41

0 answers