简体   繁体   English

什么是 Plotly 中的 nbins

[英]What is nbins in Plotly

I couldn't find this in the documents.我在文档中找不到这个。 The plotly Graphing Libraries have the below example but didn't seem to explain its arguments. plotly Graphing Libraries有下面的例子,但似乎没有解释它的论点。

import plotly.express as px
df = px.data.tips()
fig = px.histogram(df, x="total_bill", nbins=20)
fig.show()

produced the plot below:产生了下面的情节: 在此处输入图片说明

From the plot, it doesn't look like the number of bins.从图中看,它看起来不像垃圾箱的数量。 Neither does it reflect the bin value interval nor counts in each bin.它既不反映 bin 值间隔,也不反映每个 bin 中的计数。 What does nbins=20 mean? nbins=20是什么意思?

That is the maximum not the fixed number of bins that you can set.这是您可以设置的最大垃圾箱数量,而不是固定数量。 From elsewhere in the documentation:从文档中的其他地方:

"This value will be used in an algorithm that will decide the optimal bin size such that the histogram best visualizes the distribution of the data" “该值将用于决定最佳箱大小的算法中,以便直方图最好地可视化数据的分布”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM