乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Python學(xué)生物統(tǒng)計---數(shù)據(jù)可視化---學(xué)習(xí)筆記5

       育種數(shù)據(jù)分析 2021-11-18

      5.1 作圖的重要性

      在分析一個數(shù)據(jù)之前, 我們首先要對數(shù)據(jù)進(jìn)行檢查, 在統(tǒng)計上看一下匯總統(tǒng)計, 比如最大值, 最小值, 中位數(shù), 平均值, 方差, 標(biāo)準(zhǔn)差, 變異系數(shù)等等.

      • 直方圖, 看一下數(shù)據(jù)的分布情況

      • 箱線圖, 看一下數(shù)據(jù)的分布, 有無異常值

      所謂一圖勝千言.

      python中的作圖工具

      • plot.ly

      • bokeh是交互式的包

      • ggplot 是類似R語言的ggplot包

      5.2 散點圖

      # Import standard packagesimport numpy as npimport matplotlib.pyplot as pltimport pandas as pdimport scipy.stats as statsimport seaborn as sns

      這里生成了500個隨機(jī)數(shù), 使用plot進(jìn)行作圖

      # Generate the data x = np.random.randn(500) # Plot-command start --------------------- plt.plot(x, '.') # Plot-command end ----------------------- # Show plot a2 = plt.show()

      5.3 直方圖

      a3 = plt.hist(x,bins=25)

      5.4 箱線圖

      a4 = plt.boxplot(x);

      練習(xí)corn.csv

      corn是R包agridat中的smith.corn.uniformity玉米數(shù)據(jù), 我們來看一下如何對其可視化?

       row col plot year yield 1  20   1  101   95  30.0 2  19   1  102   95  29.1 3  18   1  103   95  25.7 4  17   1  104   95  26.3 5  16   1  105   95  30.3 6  15   1  106   95  31.1

      首先, 在R中將其保存為corn.csv, 保存到D盤根目錄(方便讀取)

      library(agridat) data(smith.corn.uniformity) dat = smith.corn.uniformity head(dat) write.csv(dat,"d:/corn.csv",row.names = F)

      用python讀取數(shù)據(jù), 使用pandas包

      import pandas as pdcorn = pd.read_csv("d:/corn.csv")

      查看前六行

      corn.head()

      rowcolplotyearyield
      02011019530.0
      11911029529.1
      21811039525.7
      31711049526.3
      41611059530.3

      對產(chǎn)量yield作圖

      import matplotlib.pyplot as pltc1 = plt.plot(corn["yield"],".")c2 = plt.hist(corn["yield"])c3 = plt.boxplot(corn["yield"])

        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多