添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
不敢表白的海豚  ·  韩再芬领衔 ...·  4 月前    · 
小猫猫  ·  Together AI – The AI ...·  5 月前    · 
温柔的上铺  ·  [Pyplot] ...·  1 年前    · 


open()打开文件。如果出现unicodedecodeerror,加上encoding='utf-8'选项。用spyder调试时,待打开文件存放目录应该放在源文件目录下?

close()关闭文件

readline()读取一行。

正则表达式用来分隔字符串

Import re
re.split()

‘ +’ 表示代替一个及以上的空格

鼠标选中那一行,"ctrl +["命令是向左缩进一个tab,“ctrl+]”是向右缩进一个tab
控制缩进的 距离 ,用鼠标选中很多行后,Tab可以向右缩,Shift+Tab可以向左缩

Plotly 绘图底层使用的是plotly.js,它是基于D3.sj、stack.gl和SVG,用JavaScript在网页上实现类似MATLAB和Python Matplotiib的图形展示功能。

支持2D、3D图形,交互流畅,可以满足一般科学计算的需要。目前,已经有python 、MATLAB 、R 语言、Jupyter等多种版本的API接口。

用plotly.offline.plot(figure object)即可生成html文件,包含离线的交互图形。

# -*- coding: utf-8 -*-
Spyder Editor
This is a temporary script file.
import re
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D  # 空间三维画图
#import plotly
import plotly.graph_objs as go
import plotly.offline
stepCounts = 790
#定义position数组
positionX = [0.0]*stepCounts
positionY = [0.0]*stepCounts
positionZ = [0.0]*stepCounts
f = open("OutPut.txt",'r',encoding='utf-8')
'''s = f.read()'''
s = f.readline()    #跳过第一行'''
for jj in range(0,stepCounts,1):
    s = f.readline()
    s1 = re.split(' +',s)
    positionX[jj] = float(s1[12])
    positionY[jj] = float(s1[13])
    positionZ[jj] = float(s1[14])
'''# 绘制散点图
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(positionX, positionY, positionZ, c='r', label='顺序点')
# 绘制图例
ax.legend(loc='best')
# 添加坐标轴(顺序是Z, Y, X)
ax.set_zlabel('Z', fontdict={'size': 15, 'color': 'red'})
ax.set_ylabel('Y', fontdict={'size': 15, 'color': 'red'})
ax.set_xlabel('X', fontdict={'size': 15, 'color': 'red'})
plt.show()
data = [go.Scatter3d(x=positionX,y=positionY,z=positionZ,mode='markers',
                 opacity=0.9,)]
layout = go.Layout(title='三维散点',
    autosize=False,
    width=900,
    height=900,
    margin=dict(
        l=65,
        r=50,
        b=65,
    yaxis=dict(title='y',#设置坐标轴的标签
            titlefont=dict(color='rgb(148, 103, 189)',size=24),#设置坐标轴标签的字体及颜色
            tickfont=dict(color='rgb(148, 103, 189)',size = 24,),#设置刻度的字体大小及颜色
            showticklabels=False,#设置是否显示刻度
            #设置刻度的范围及刻度
            autorange=False,range=[-1.0, 1.0],type='linear',
fig = go.Figure(data=data,layout = layout)
#fig.update_layout()
#fig.show()
plotly.offline.plot(fig)



Android天地图为啥没有sdk 天地图app无法使用

地图官网获取服务许可key;国家地理信息公共服务平台 天地图vue使用天地图报错Error in v-on handler: “TypeError: Cannot read property ‘_tdt_events‘ of null当我们调用地图时需要使用setTimeout做延迟mounted() { // 初始化天地图 setTimeout(()=>{