簡體   English   中英

在 matplotlib 中繪制對數正態比例

[英]Plotting Log-normal scale in matplotlib

我有這兩個列表,它們是要繪制的 x,y 點:

microns = [38,  45,  53,  63,  75,  90, 106, 125, 150, 180]
cumulative_dist = [25.037, 32.577, 38.34, 43.427, 51.57,56.99, 62.41,69.537,74.85, 81.927]

問題是我需要按照下圖所示的比例繪制它們( 更多信息在這里),這是一個對數正態圖。

如何使用 matplotlib 獲得此比例?

我想我需要使用matplotlib.scale.FuncScale ,但我不太確定如何到達那里。

在此處輸入圖片說明

David富有洞察力的評論之后,我閱讀了頁面並設法按照我想要的方式繪制了圖形。

在此處輸入圖片說明

from matplotlib.ticker import ScalarFormatter, AutoLocator
from matplotlib import pyplot
import pandas as pd
import probscale
fig, ax = pyplot.subplots(figsize=(9, 6))
microns = [38,  45,  53,  63,  75,  90, 106, 125, 150, 180]
cumulative_dist = [25.037, 32.577, 38.34, 43.427, 51.57,56.99, 62.41,69.537,74.85, 81.927]
probscale.probplot(pd.Series(microns, index=cumulative_dist), ax=ax, plottype='prob', probax='y', datascale='log',
                   problabel='Cumulative Distribution (%)',datalabel='Particle Size (μm)',
                   scatter_kws=dict(marker='.', linestyle='none', markersize=15))
ax.set_xlim(left=28, right=210)
ax.set_ylim(bottom=1, top=99)
ax.set_title('Log Normal Plot')
ax.grid(True, axis='both', which='major')
formatter = ScalarFormatter()
formatter.set_scientific(False)
ax.xaxis.set_major_formatter(formatter)
ax.xaxis.set_minor_formatter(formatter)
ax.xaxis.set_major_locator(AutoLocator())
ax.set_xticks([])  # for major ticks
ax.set_xticks([], minor=True)  # for minor ticks
ax.set_xticks(microns)
fig.show()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM