关于标签云中标签的缩放

发布于 2024-08-02 18:35:49 字数 845 浏览 4 评论 0原文

我正在移动设备上实现标签云。数据模型等细节在这里并不是特别重要。我的问题是关于标签的缩放:

将标签频率映射到字体大小的“最佳”表达式是什么?

我已经查看了这篇文章讨论线性和对数缩放和这个答案来自 Adrian Kuhn 的多项式方法灵感草图。然而,我似乎记得互联网上某个地方的一篇文章,对这个问题进行了更多的探索。

我还发现了一些“最佳实践”在博客上,尽管我不确定最佳实践的规定。这些对频率缩放没有评论。

对于标签缩放,我有哪些替代方法?哪种是首选/标准方法?我还在考虑最小字体大小、最大标签数量、颜色等。

编辑:根据 这个问题,我对带有字体大小变化的“标准”标签云感兴趣。

I am implementing a tag cloud on a mobile device. The details of data-model etc, are not particularly important here. My question is about the scaling of tags:

What is the 'best' expression to map tag frequency to font size?

I have looked at this post discussing linear and logarithmic scaling and this answer from Adrian Kuhn sketch of a polynomial approach for inspiration. However, I seem to remember a post some place on the interwebs with a lot more exploration on this issue.

I have also found some "best practices" on a blog, though am unsure of the providence of the best practices. These make no comment on frequency scaling.

What alternatives do I have for tag scaling, and which is the preferred/standard method? I am also considering minimum fontsizes, maximum number of tags, colors, etc.

Edit: As per the discussion in this question, I am interested in the "standard" tagcloud, with font size variations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

懷念過去 2024-08-09 18:35:49

去年我参与了一个小型标签云项目,其中我使用了类似的东西

β = (int) (((maxθ – minθ) x ω) + minθ + 0.5)

where ω is a weighting previously calculated according to some metric (in your case font frequency), minθ and maxθ are lower and upper bounds, and β is the final value. This can be applied to any visual characteristic (font size, colour, weight if supported, etc.).

我发现线性和对数缩放往往依赖于数据集分布。在具有突出异常值的数据集中,我发现 tanh 对于“平滑”结果值很有用。

I worked on a small tag cloud project last year, in which I used something along the lines of

β = (int) (((maxθ – minθ) x ω) + minθ + 0.5)

where ω is a weighting previously calculated according to some metric (in your case font frequency), minθ and maxθ are lower and upper bounds, and β is the final value. This can be applied to any visual characteristic (font size, colour, weight if supported, etc.).

I found that linear and logarithmic scaling tended to dependant on data set distribution. In data sets with prominent outliers I found tanh was useful for 'smoothing' the resulting values.

献世佛 2024-08-09 18:35:49

此 pdf 中有一个精彩的讨论,其中讨论了要显示的标签的缩放、聚类和截断。

There is an excellent discussion in this pdf, which discusses scaling, clustering, and truncating on the tags to display.

何止钟意 2024-08-09 18:35:49

我发现效果很好的解决方案如下

font_size = (max_font_size - min_font_size) * (Math.sin(1.5*(X)) + minsize

其中 X 是您希望映射到字体大小的标准化值

X = (this_value-min_value)/(max_value-min_value)

这会增加范围内较低 3 个四分位数的大小差异,以便最大限度地减少高异常值的影响

A solution I found works nicely is as follows

font_size = (max_font_size - min_font_size) * (Math.sin(1.5*(X)) + minsize

where X is the normalized value you wish to map onto font size

X = (this_value-min_value)/(max_value-min_value)

this increases size differential for the lower 3 quartiles of the range, such as to minimize the effect of high outliers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文