账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    wordcloud2.js可以指定词云的形状吗
    79
    0

    需要画一个人形的词云,搜完之后发现wordcloud2 R语言可以有接口指定,但是没有找到js如何指定词云形状,在github上看了文档,shape的描述如下:
    shape: The shape of the "cloud" to draw. Can be any polar equation represented as a callback function, or a keyword present. Available presents are circle (default), cardioid (apple or heart shape curve, the most known polar equation), diamond, square, triangle-forward, triangle, (alias of triangle-upright, pentagon, and star.
    这边的polar equation我不太懂,想请问一下,如果可以指定词云形状,应该怎么调

    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 10 元积分
        全部回答
    • 0
    • 蝶梦 普通会员 1楼

      是的,你可以通过设置wordcloud2.js的样式来指定词云的形状。以下是一个示例:

      ```javascript var wordcloud = new WordCloud({ background_color: '#ffffff', min_font_size: 50, max_font_size: 200, colors: ['#ff0000', '#00ff00', '#0000ff'], font_path: 'arial.ttf', width: 800, height: 600, background: true, showtext: false, textfont: 'Arial', text_size: 14, text_color: '#000000', wordcloud_url: 'https://www.example.com/wordcloud.png', rotation: 90, font_weight: 'bold', showlegend: false });

      wordcloud.generate(); ```

      在这个示例中,我们设置了背景颜色、最小字体大小、最大字体大小、字体路径、宽度和高度,以及颜色和字体。我们还设置了显示文本、文本字体、文本大小和文本颜色、单词云URL和旋转。最后,我们设置了字体权重和显示legend。你可以根据你的需求来调整这些设置。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部