d3.scale.quantize()和d3.scale.quantile()之间有什么区别? [英] What is the difference between d3.scale.quantize() and d3.scale.quantile()?

查看:2067
本文介绍了d3.scale.quantize()和d3.scale.quantile()之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在文件中,定义如下:


。具有离散而不是连续范围的线性尺度变体。输入域仍然是连续的,并根据输出范围(的基数)中的值的数量划分为统一的段。

..a variant of linear scales with a discrete rather than continuous range. The input domain is still continuous, and divided into uniform segments based on the number of values in (the cardinality of) the output range.



quantile



quantile


...将输入域映射到离散范围。虽然输入域是连续的,并且比例将接受任何合理的输入值,但输入域被指定为一组离散值。输出范围(的基数)中的值的数量确定将从输入域计算的分位数的数量

...map an input domain to a discrete range. Although the input domain is continuous and the scale will accept any reasonable input value, the input domain is specified as a discrete set of values. The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the input domain

这些两者似乎将连续输入域映射到一组离散值。

These both seem to map continuous input domains to a set of discrete values. Can anybody illuminate the difference?

推荐答案

一般来说,差异类似于平均值和中位数之间的差异

只有当输入域中的值数量大于输出域中的值数量时,才会出现差异。最好由示例说明。

The difference is only really apparent when the number of values in the input domain is larger than the number of values in the output domain. Best illustrated by an example.

对于 quantize 缩放,输入范围根据输出范围划分为统一的段。也就是说,域中的值的数量并不重要。因此,它返回1为0.2,因为0.2接近于1比100.

For the quantize scale, the input range is divided into uniform segments depending on the output range. That is, the number of values in the domain doesn't really matter. Hence it returns 1 for 0.2, as 0.2 is closer to 1 than 100.

quantile 输入域的分位数,并且因此受到其中的值的数量的影响。输出域中的值的数量仅确定计算多少分位数。根据它们的本质,分位数反映实际的值列表,而不仅仅是范围。因此,0.2的输入返回100,因为相应的分位数更接近100。

The quantile scale is based on the quantiles of the input domain and as such affected by the number of values in there. The number of values in the output domain only determines how many quantiles are computed. By their very nature, the quantiles reflect the actual list of values rather than just the range. Thus, an input of 0.2 returns 100 as the corresponding quantile is closer to 100.

这篇关于d3.scale.quantize()和d3.scale.quantile()之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆