亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Python:如何在地圖上的特定點繪制散點圖?

Python:如何在地圖上的特定點繪制散點圖?

慕田峪7331174 2022-08-16 18:42:21
我正在研究有關地球磁場的地面觀測數據。我在Jupyter Notebook的Python中工作。每個天文臺都有一個數據系列,繪制如下圖:plt.scatter法典:# Function that plots the time series and the data series from a .mat data file # (in the dB-direction based on the out-variable), that is associated with the observatory code (based on the sta-variable)# It also takes an optional argument 'showdatapoints' so its possible to show data points mainly for debuggingdef plotdata_stations(filename, sta, out, start, stop, *args):# Makes the function use one of the three columns (and thus directions of field) in the data series based on inputif out == 'radial':    dat = 0elif out == 'theta':    dat = 1elif out == 'phi':    dat = 2# If the user inputs something else than one of these three, it returns an error and a hint to resolve the errorelse:    print('\nError: Component ' + "'" + out + "'" + ' not recognized...')    print('\nHint: Try using ' + "'" + 'radial' + "', " + "'" + 'theta' + "' or " + "'" + 'phi' + "'.")# Try to load file in case the file does not existtry:    nam = DataLoad(filename, 'obs_all')# If the file does not exist, it returns an error and a hint to resolve the errorexcept:    print('\nError: File ' + "'" + filename + "'" + ' not recognized...')     print('\nHint: Try putting your file in the same folder as this script.')# If the observatory code is not in the data file, it returns an error and a hint to resolve the errorif sta not in nam and sta != 'all':    print('\nError: Observatory Code ' + "'" + sta + "'" + ' not recognized...')        print('\nHint: Try using an Observatory Code from the Observatory Locations map.')
查看完整描述

1 回答

?
瀟湘沐

TA貢獻1816條經驗 獲得超6個贊

我用數學的方式做了,就像這樣:


# Scaling data down to point of obs

###########################################

scax = 3

scay = 4

ntim=np.subtract(ntim,2000)

ntim=np.multiply(ntim,scax)

ndat=np.divide(ndat,scay)

###########################################


# Plots data from obs at the location of obs

# Plot at locations by adding coordinates of obs and subtracting the mean of each axis of data set

plt.scatter(ntim-np.mean(ntim)+phi, ndat-np.mean(ndat)+the, color='blue', marker='.')

plt.scatter(phi, the, color='red', marker='.')

但是,如果有人知道一種更“科學”的方法,我會歡迎您的回復。


查看完整回答
反對 回復 2022-08-16
  • 1 回答
  • 0 關注
  • 143 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號