• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python proj3d.proj_transform函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mpl_toolkits.mplot3d.proj3d.proj_transform函数的典型用法代码示例。如果您正苦于以下问题:Python proj_transform函数的具体用法?Python proj_transform怎么用?Python proj_transform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了proj_transform函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: plot_function_and_solution

def plot_function_and_solution(func, area, first_point, solution, meshgrid):
    fig = plt.figure(figsize=(14, 8))
    ax1 = fig.add_subplot(121)
    ax2 = fig.add_subplot(122, projection="3d")

    fig.suptitle("My Function", size=24)

    # Color mesh
    ax1.set_axis_bgcolor("white")
#    ax1.pcolormesh(X, Y, Z, cmap=cm.jet, norm=LogNorm())
    ax1.contour(*meshgrid, zdir='z', offset=0, stride=0.1, cmap=cm.coolwarm)
    ax1.scatter(*first_point, color="k")
    ax1.annotate('First Point', xy=first_point, xytext=(-0.5, 1.25),
                 arrowprops=dict(facecolor='black', shrink=0.05))
    ax1.scatter(solution[0], solution[1], color="g")
    ax1.annotate('Solution', xy=(solution[0], solution[1]), xytext=(-1, -3),
                 arrowprops=dict(facecolor='blue', shrink=0.05))

    # Surface plot
    ax2.set_axis_bgcolor("white")
    ax2.plot_surface(*meshgrid, norm = LogNorm(), cmap=cm.jet, linewidth=1)

    first_point_3d = (first_point[0], first_point[1], func(first_point))

    ax2.view_init(azim=65, elev=25)
    ax2.scatter(*first_point_3d, color="k")
    xa, ya, _ = proj3d.proj_transform(first_point_3d[0], first_point_3d[1], first_point_3d[2], ax2.get_proj())
    ax2.annotate("First Point", xy = (xa, ya), xytext = (20, 120),
                 textcoords = 'offset points', ha = 'right', va = 'bottom',
                 arrowprops=dict(facecolor='black', shrink=0.05))
    ax2.scatter(*solution, color="k")
    xa, ya, _ = proj3d.proj_transform(solution[0], solution[1], solution[2], ax2.get_proj())
    ax2.annotate("Solution", xy = (xa, ya), xytext = (0, 100),
                 textcoords = 'offset points', ha = 'right', va = 'bottom',
                 arrowprops=dict(facecolor='blue', shrink=0.05))
开发者ID:idenx,项目名称:calc_methods,代码行数:35,代码来源:lab5.py


示例2: refresh

 def refresh(self):
     for l in self._labs:
         x, y, _ = proj3d.proj_transform(l[1][0], l[1][1], l[1][2], self.ax1.get_proj())
         x2, y2, _ = proj3d.proj_transform(l[2][0], l[2][1], l[2][2], self.ax1.get_proj())
         l[0].xytext = self._midp(x, y, x2, y2)
     
     for l in self._alabs:
         x, y, _ = proj3d.proj_transform(l[1][0], l[1][1], l[1][2], self.ax1.get_proj())
         l[0].xytext = (x+0.002,y+0.002)
     
     self.canvas.draw()
开发者ID:stufisher,项目名称:Proton8,代码行数:11,代码来源:Ligand.py


示例3: plot_surface

def plot_surface(ax, m, start, goal, title):
    t1 = np.arange(181)
    t2 = np.arange(361)
    X, Y = np.meshgrid(t1, t2, indexing='ij')
    surf = ax.plot_surface(X, Y, m, cmap=cm.jet)
    ax.set_title(title)
    ax.set_xlabel('theta1')
    ax.set_ylabel('theta2')
    x, y, _ = proj3d.proj_transform(start[0],start[1],m[start[0], start[1]], ax.get_proj())
    x2, y2, _ = proj3d.proj_transform(goal[0],goal[1],m[goal[0], goal[1]], ax.get_proj())
    l1 = ax.annotate('start', xy=(x, y))
    l2 = ax.annotate('goal', xy=(x2, y2))
开发者ID:ozanarkancan,项目名称:path-planning,代码行数:12,代码来源:main.py


示例4: update_position

        def update_position(e):
            for i, x, y, z, l in zip(i_s, xs, ys, zs, labels):
                x2, y2, _ = proj3d.proj_transform(x, y, z, ax.get_proj())
                l.xy = x2,y2
                l.update_positions(fig.canvas.renderer)

            fig.canvas.draw()
开发者ID:davidshepherd7,项目名称:oomph-lib-micromagnetics,代码行数:7,代码来源:generate_tetgen_cylinder_input.py


示例5: update_position

def update_position(e):
    for a in range(len(all_position)):
        x2, y2, _ = proj3d.proj_transform(all_position[a][0],all_position[a][1],all_position[a][2], ax.get_proj())
        all_label[a].xy = x2,y2

    label.update_positions(fig.canvas.renderer)
    fig.canvas.draw()
开发者ID:yuxiang2025,项目名称:HS-DP,代码行数:7,代码来源:HW2-2.py


示例6: annotatePlot

    def annotatePlot(X, index, annotes, button):
        """Create popover label in 3d chart

        Args:
            X (np.array) - array of points, of shape (numPoints, 3)
            index (int) - index (into points array X) of item which should be printed
        Returns:
            None
        """
        # If we have previously displayed another label, remove it first
        if hasattr(annotatePlot, 'label'):
            annotatePlot.label.remove()

        if button == 2:
            # Get data point from array of points X, at position index
            x2, y2, _ = proj3d.proj_transform(X[index, 0], X[index, 1], X[index, 2], ax.get_proj())

            annote = annotes[index]

            annotatePlot.label = plt.annotate(annote,
                                              xy=(x2, y2), xytext=(-20, 20), textcoords='offset points', ha='right',
                                              va='bottom',
                                              bbox=dict(boxstyle='round,pad=0.5', fc='yellow', alpha=0.5),
                                              arrowprops=dict(arrowstyle='->', connectionstyle='arc3,rad=0'))
        # if we press another button (i.e. to pan the axis we need to create a dummy (blank) annotate
        # this is because the annotePlot still has an attribute (it has previously been called
        elif button != 2:
            annotatePlot.label = plt.annotate('', xy=(0, 0), xytext=(0, 0))

        fig.canvas.draw()
开发者ID:outdoorpet,项目名称:3D_click_annotate,代码行数:30,代码来源:_3D_mouseclick.py


示例7: draw

 def draw(self, renderer):
     #xs3d, ys3d, zs3d = self._verts3d
     for coords in self._verts3d:
         xs3d, ys3d, zs3d = coords[0], coords[1], coords[2]
         xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
         self.set_positions((xs[0], ys[0]), (xs[1], ys[1]))
         FancyArrowPatch.draw(self, renderer)
开发者ID:wgurecky,项目名称:spyTran,代码行数:7,代码来源:ordplot.py


示例8: LabelEvent

    def LabelEvent(self, GraphicsObject, PlotOptions):
        EventTypeFormatted = self.EventType
        if EventTypeFormatted == 'upwr_flyby':
            EventTypeFormatted = 'unpowered flyby'
        elif EventTypeFormatted == 'pwr_flyby':
            EventTypeFormatted = 'powered flyby'
        elif EventTypeFormatted == 'chem_burn':
            EventTypeFormatted = 'chemical burn'
        elif EventTypeFormatted == 'LT_rndzvs':
            EventTypeFormatted = 'LT rendezvous'
        elif EventTypeFormatted == 'begin_spiral':
            EventTypeFormatted = 'begin spiral'
        elif EventTypeFormatted == 'end_spiral':
            EventTypeFormatted = 'end spiral'

        description = EventTypeFormatted + '\n' + self.Location + '\n' + self.GregorianDate

        #for launches a C3 and DLA are needed
        if self.EventType == 'launch':
            description += '\nC3 = ' + "{0:.3f}".format(self.C3) + ' $km^2/s^2$'
            #add the LV to the description?
            description += '\nDLA = ' + "{0:.1f}".format(self.Declination) + '$^{\circ}$'

        #for non-launch departures only the C3 is needed
        if self.EventType == 'departure':
            description += '\nC3 = ' + "{0:.3f}".format(self.C3) + ' $km^2/s^2$'

        #for spirals output only the delta-v
        if self.EventType == 'begin_spiral' or self.EventType == 'end_spiral':
            description += '\n$\Delta v$ = ' + "{0:.3f}".format(self.DVmagorThrottle) + ' $km/s$'

        #for other events, output v-infinity and DLA
        if self.EventType == 'upwr_flyby' or self.EventType == 'pwr_flyby' or self.EventType == 'intercept' or self.EventType == 'interface' or self.EventType == 'insertion':
            description += '\n$v_\infty$ = ' + "{0:.3f}".format(math.sqrt(self.C3)) + ' $km/s$'
            description += '\nDEC = ' + "{0:.1f}".format(self.Declination) + '$^{\circ}$'

        #for flybys, altitude should be outputed
        if self.EventType == 'upwr_flyby' or self.EventType == 'pwr_flyby':
            description += '\naltitude = ' + "{0:.0f}".format(self.Altitude) + ' $km$'


        #for propulsive events, a deltaV is needed
        if self.EventType == 'departure' or self.EventType == 'pwr_flyby' or self.EventType == 'insertion' or self.EventType == 'chem_burn' or self.EventType == 'rendezvous':
                description += '\n$\Delta v$ = ' + "{0:.3f}".format(self.DVmagorThrottle) + ' $km/s$'

        #always append the spacecraft Mass
        description += '\nm = ' + "{0:.0f}".format(self.Mass) + ' $kg$'

        #draw the text
        #note, do not draw anything for chemical burns below 10 m/s
        if not (self.EventType == "chem_burn" and self.DVmagorThrottle < 0.001):
            x2D, y2D, _ = proj3d.proj_transform(self.SpacecraftState[0],self.SpacecraftState[1],self.SpacecraftState[2], GraphicsObject.get_proj())

            self.eventlabel = plt.annotate(description, xycoords = 'data', xy = (x2D, y2D), xytext = (20, 20), textcoords = 'offset points', ha = 'left', va = 'bottom',
                                           bbox = dict(boxstyle = 'round,pad=0.5', fc = 'white', alpha = 0.5), arrowprops = dict(arrowstyle = '->',
                                           connectionstyle = 'arc3,rad=0'), size=PlotOptions.FontSize)

            self.AnnotationHelper = self.eventlabel.draggable(use_blit=True)
            self.pcid = GraphicsObject.figure.canvas.mpl_connect('button_press_event', self.ClickAnnotation)
            self.rcid = GraphicsObject.figure.canvas.mpl_connect('button_release_event', self.ReleaseAnnotation)
开发者ID:kartikkumar,项目名称:emtg,代码行数:60,代码来源:MissionEvent.py


示例9: plot_emotions

def plot_emotions(emotions, X, Y, Z, plot_labels = True):
    emos = emotions
    import matplotlib
    matplotlib.use('TkAgg')
    from matplotlib import pyplot as plt 
    from mpl_toolkits.mplot3d import Axes3D
    from mpl_toolkits.mplot3d import proj3d
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')    
    ax.scatter(X, Y, Z)
    ax.set_xlabel('Serotonin')
    ax.set_ylabel('Noradrenaline')
    ax.set_zlabel('Dopamine')
    
    if plot_labels:
        labels = []
        for i in range(len(X)):
            x2, y2, _ = proj3d.proj_transform(X[i],Y[i],Z[i], ax.get_proj())
            label = plt.annotate(
                emos[i], 
                xy = (x2, y2), xytext = (-5, 5),
                textcoords = 'offset points', ha = 'right', va = 'bottom',
                bbox = dict(boxstyle = 'round,pad=0.1', fc = 'yellow', alpha = 0.5),
                arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
            labels.append(label)
        
        def update_position(e):
            for i in range(len(X)):
                x2, y2, _ = proj3d.proj_transform(X[i],Y[i],Z[i], ax.get_proj())
                labels[i].xy = (x2, y2)
                labels[i].update_positions(fig.canvas.renderer)
            fig.canvas.draw()
        fig.canvas.mpl_connect('button_release_event', update_position)
    plt.tight_layout()
    plt.show()
开发者ID:assamite,项目名称:TwatBot,代码行数:35,代码来源:loevheim_cube.py


示例10: draw

 def draw(self, renderer):
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         xs3d, ys3d, zs3d = self._verts3d
         xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
         self.set_positions((xs[0], ys[0]), (xs[1], ys[1]))
         FancyArrowPatch.draw(self, renderer)
开发者ID:askerry,项目名称:FGE_MISC,代码行数:7,代码来源:vizfuncs.py


示例11: annotatedScatter3d

def annotatedScatter3d(labels,xs,ys,zs):
    """3d scatter plot, sadly rotating breaks the association of dots and annotations"""
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    sc = ax.scatter(xs,ys,zs)
    for txt, x, y, z in zip(labels, xs, ys, zs):
        x2, y2, _ = proj3d.proj_transform(x,y,z, ax.get_proj())
        label = plt.annotate(txt, xy = (x2, y2))
开发者ID:wechselstrom,项目名称:MusicRecommender,代码行数:8,代码来源:MusicRecommender.py


示例12: draw

 def draw(self, renderer):
     xs3d, ys3d, zs3d = self._verts3d
     xs, ys, zs = proj3d.proj_transform(xs3d, 
                                        ys3d, 
                                        zs3d, 
                                        renderer.M)
     self.set_positions((xs[0], ys[0]), (xs[1], ys[1]))
     mp.FancyArrowPatch.draw(self, renderer)
开发者ID:sci2u,项目名称:api,代码行数:8,代码来源:arrows3d.py


示例13: update_position

def update_position(e):
    global fig
    global ax
    global labels_and_points
    for label, x, y, z in labels_and_points:
        x2, y2, _ = proj3d.proj_transform(x, y, z, ax.get_proj())
        label.xy = x2,y2
        label.update_positions(fig.canvas.renderer)
    fig.canvas.draw()
开发者ID:RDharmaTeja,项目名称:parallel-solver,代码行数:9,代码来源:hexahedron.py


示例14: update_position

def update_position(e):
    print "In update"
    x2, y2, _ = proj3d.proj_transform(x, y, z, ax.get_proj())
    for i in range(0, np.size(z)):
        if i % 800 == 0:
            labels[(i / 800)].xy = x2[i], y2[i]
            labels[(i / 800)].update_positions(fig.canvas.renderer)

    fig.canvas.draw()
开发者ID:elgoon7,项目名称:Scripts,代码行数:9,代码来源:distance_3dplot.py


示例15: update_position

 def update_position(e):
     x2, y2, _ = proj3d.proj_transform(data3N[:, 0], data3N[:, 1],
                                       data3N[:, 2], ax.get_proj())
     
     for i in range(len(data3N[:, 0])):
         label = Labels[i]
         label.xy = x2[i],y2[i]
         label.update_positions(fig.canvas.renderer)
     fig.canvas.draw()
开发者ID:I2PC,项目名称:scipion,代码行数:9,代码来源:viewer_structure_mapping.py


示例16: update_position

						def update_position(e):
							print('update')
							#Transform co-ordinates to get new 2D projection
							Tx, Ty, _ = proj3d.proj_transform(xp, yp, zp, ax.get_proj())
							for i in range(len(xp)):
								label = label_list[i]
								label.xy = Tx[i],Ty[i]
								label.update_positions(fig.canvas.renderer)
							fig.canvas.draw()
							return
开发者ID:pwbryant,项目名称:meals,代码行数:10,代码来源:meal_funcs.py


示例17: _load_residue

    def _load_residue(self, event):
        r = self._ligands[self.res_type.GetValue()]
        
        self.ax1.cla()
        self.ax1.mouse_init()
        self.ax1.set_frame_on(False)
        self.ax1.set_axis_off()
        
        for a in (self.ax1.w_xaxis, self.ax1.w_yaxis, self.ax1.w_zaxis):
            a.line.set_visible(False)
            a.pane.set_visible(False)
            a.set_major_locator(ticker.NullLocator())
        
        self.ax1.scatter3D(r['c'][:,0], r['c'][:,1], r['c'][:,2], c=r['col'], s=400)
        
        m = max([max(r['c'][:,i])-min(r['c'][:,i]) for i in range(3)])

        for i,ax in enumerate(['set_xlim', 'set_ylim', 'set_zlim']):
            mid = min(r['c'][:,i])+((max(r['c'][:,i]) - min(r['c'][:,i]))/2)
            getattr(self.ax1, ax)(mid-(m/2), mid+(m/2))
                
        self._labs = []
        self._alabs = []
        for i,a in enumerate(r['at']):
            ac = r['c'][i]
            x2, y2, _ = proj3d.proj_transform(ac[0],ac[1],ac[2], self.ax1.get_proj())
            for j,b in enumerate(r['at']):
                if a is not b:
                    bc = r['c'][j]
                    if a.distance(b) < 1.8:
                        std = ''
                        
                        n = a.name.strip()+'-'+b.name.strip()
                        if n in r['stdevs']:
                            std = ' (' + str(r['stdevs'][n]) + ')'
                        
                        self.ax1.plot([ac[0], bc[0]], [ac[1], bc[1]], [ac[2], bc[2]], 'k-')
                        x3, y3, _ = proj3d.proj_transform(bc[0],bc[1],bc[2], self.ax1.get_proj())
                        self._labs.append([self.ax1.annotate('%.2f' % a.distance(b) + std, xy=self._midp(x2,y2,x3,y3), size=6), ac, bc])
            
            self._alabs.append([self.ax1.annotate(a.name.strip(), xy=(x2+0.002,y2+0.002), size=7), ac])

        self.canvas.draw()
开发者ID:stufisher,项目名称:Proton8,代码行数:43,代码来源:Ligand.py


示例18: flatten3DPoint

 def flatten3DPoint(self, px, py, pz):
     """project a point in 3D space onto a 2D screen"""
     # convert 3D spave to 2D space
     x2, y2, _ = proj3d.proj_transform(px, py, pz, self.threeDAx.get_proj())
     # convert 2d space to screen space
     [x2,y2] = self.threeDAx.transData.transform((x2, y2))
     # adjust for image dimensions
     x2 = x2/self.twoDImgWidth
     y2 = y2/self.twoDImgHeight
     return [x2, y2]
开发者ID:alneberg,项目名称:GroopM,代码行数:10,代码来源:groopmUtils.py


示例19: update_position

    def update_position(self, e):

        labels = self.labels

        for ii, c in enumerate(self.points):

            x_proj, y_proj, _ = proj3d.proj_transform(c[0], c[1], c[2], self.ax.get_proj())
            labels[ii].xy = x_proj, y_proj

            labels[ii].update_positions(self.fig.canvas.renderer)

        self.fig.canvas.draw()
开发者ID:AminKhribi,项目名称:matplotlib_visual,代码行数:12,代码来源:visual.py


示例20: update_position

def update_position(e):
    """
    A callback handler to update positions of the labels projected into 2d space
    when the graph is rotated
    """
    for k in LABELS_MAP:
        x1, y1, z1 = LABELS_MAP[k][0:3]
        x2, y2, _ = proj3d.proj_transform(x1, y1, z1, AXES.get_proj())
        annotation = LABELS_MAP[k][3]
        annotation.xy = x2, y2
        annotation.update_positions(FIG.canvas.renderer)
    FIG.canvas.draw()
开发者ID:AAAI2016Submission,项目名称:AutoencoderViz,代码行数:12,代码来源:visualizeFeatures.py



注:本文中的mpl_toolkits.mplot3d.proj3d.proj_transform函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mpld3.fig_to_dict函数代码示例发布时间:2022-05-27
下一篇:
Python axes3d.get_test_data函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap