#plotly #plotly-dash #orthographic
Вопрос:
[https://drive.google.com/file/d/1HE8tHeq0Jm7EF530VaYv7aesPS-DoC0N/view?usp=sharing][изображение]
Я попытался использовать Scattergeo вместо px.line_geo, но это дало тот же эффект. Кажется, я не могу просматривать данные в любом месте, где я наведу курсор на путь — > данные отображаются только на полюсах.
деф telem_data_fig(txt_file):
position_and_speed = np.loadtxt(txt_file, skiprows=6, usecols=(4,5,6,7,8,9), unpack=False)
(year, x, y, z, vx, vy, vz) = np.loadtxt(txt_file, skiprows=6, usecols=(2,4,5,6,7,8,9), unpack=True)
df = pd.DataFrame(position_and_speed, columns=['x','y','z','vx','vy','vz'])
time = []
date = []
month = []
#read time, month, amp; date data
with open(txt_file) as f:
f2 = f.readlines()[6:]
for line in f2:
l = line.rstrip('n')
colon_ind = l.index(":")
time_val = l[colon_ind-2:colon_ind 10]
time.append(time_val)
date.append(l[0:2])
month.append(l[3:6])
# insert time, date, amp; month info into dataframe
df['time'] = time
df['month'] = month
df['date'] = date
# original telem data is in efec (earth-fixed-earth-centered),
# so convert to geodetic (lon,lat,alt) coords and add new columns in df
lat_vals = []
lon_vals = []
alt_vals = []
for i in range(len(x)):
lat, lon, alt = pm.ecef2geodetic(x[i], y[i], z[i])
lat_vals.append(lat)
lon_vals.append(lon)
alt_vals.append(alt)
df['lat'] = lat_vals
df['lon'] = lon_vals
df['alt'] = alt_vals
fig = px.line_geo(df, lat='lat', lon='lon',
hover_data=hover_datainfo,
projection='orthographic',
title='Telemetry Data',
locationmode='country names',
)
fig.update_layout(
title_text = 'Satellite Path',
showlegend = True,
hoverlabel=dict(
bgcolor="white",
font_size=16,
font_family="Worksans"
),
geo = dict(
lonaxis = dict(
showgrid = True,
gridcolor = 'rgb(102, 102, 102)',
gridwidth = 0.5
),
lataxis = dict(
showgrid = True,
gridcolor = 'rgb(102, 102, 102)',
gridwidth = 0.5
)
)
)
fig.show()