我在网上到处查了一下没有结果。我似乎无法让这些图在最大化盒子时将其高度和宽度最大化到整个窗口大小。这是我使用的要求bs4Dash。我查看了这篇文章,但提供的解决方案似乎对我不起作用。我缺少什么?
library(shiny)
library(bs4Dash)
library(circlepackeR) # devtools::install_github("jeromefroe/circlepackeR")
library(wordcloud2) # devtools::install_github("lchiffon/wordcloud2")
library(plotly)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(id="histbox",
title = "hist box",
plotOutput("plot1",
height = 250),
maximizable = T),
box(id = "circlebox", title="circle box",
circlepackeR::circlepackeROutput("circles"), maximizable = T)
),
fluidRow(
box(id="wordlcoudbox",
title = "wordcloud box",
wordcloud2::wordcloud2Output("cloud"),
maximizable = T),
box(id = "plotlybox",
title = "plotly box",
plotly::plotlyOutput("plotlyplot"),
maximizable = T))
)
) …Run Code Online (Sandbox Code Playgroud) 我正在尝试显示 wordcloud2 wordcloud,但它仅适用于 html-knitted Rmd 文件。这有效:
---
title: "Untitled"
output: html_document
---
```{r wordcloud}
library(wordcloud2)
wordcloud2(demoFreq)
```
Run Code Online (Sandbox Code Playgroud)
但这不会:
---
title: "Untitled"
output: pdf_document
---
```{r wordcloud}
library(wordcloud2)
wordcloud2(demoFreq)
```
Run Code Online (Sandbox Code Playgroud)
它将在 YAML 中与 always_allow_html: yes 一起编织,但 wordcloud 不显示:
---
title: "Untitled"
output: pdf_document
always_allow_html: yes
---
```{r wordcloud}
library(wordcloud2)
wordcloud2(demoFreq)
```
Run Code Online (Sandbox Code Playgroud)
我想也许将图形保存为图像,然后将其加载到 .Rmd 中,但这似乎很笨拙。更好的想法?
你能帮我在我的本地驱动器上将词云保存为图像吗?,我正在寻找一个代码/命令来通过 R 编程自动完成它。我试过saveWidget, plotly,orca但没有成功。
我使用下面的代码来创建词云。
library(wordcloud2)
wordcloud2(demoFreqC, figPath = figPath,color = "orangered",fontFamily = "Miso")
Run Code Online (Sandbox Code Playgroud) 当我尝试运行阿拉伯语大数据时,我的代码出现了一些问题:
from os import path
import codecs
from wordcloud import WordCloud
import arabic_reshaper
from bidi.algorithm import get_display
d = path.dirname(__file__)
f = codecs.open(path.join(d, 'C:/example.txt'), 'r', 'utf-8')
text = arabic_reshaper.reshape(f.read())
text = get_display(text)
wordcloud = WordCloud(font_path='arial',background_color='white', mode='RGB',width=1500,height=800).generate(text)
wordcloud.to_file("arabic_example.png")
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
回溯(最近一次调用最后一次):
文件“”,第 1 行,在 runfile('C:/Users/aam20/Desktop/python/codes/WordClouds/wordcloud_True.py', wdir='C:/Users/aam20/Desktop/python/codes/WordClouds')
文件“C:\Users\aam20\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”,第 705 行,在运行文件 execfile(文件名,命名空间)中
文件“C:\Users\aam20\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py”,第 102 行,在 execfile 中 exec(compile(f.read(), filename, 'exec'),命名空间)
文件“C:/Users/aam20/Desktop/python/codes/WordClouds/wordcloud_True.py”,第 28 行,文本 = get_display(text)
文件“C:\ Users \ aam20 \ Anaconda3 \ lib \ site-packages \ bidi \ algorithm.py”,第648行,在get_display中resolve_implicit_levels(存储,调试)
文件“C:\ Users \ aam20 \ …
wordcloud2 ×4
r ×3
word-cloud ×2
adminlte ×1
bs4dash ×1
python ×1
python-3.x ×1
r-markdown ×1
shiny ×1