编织中的笔画不起作用 [英] dygraph in knitr not working

查看:91
本文介绍了编织中的笔画不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用Knitr在R中编织我的字形时:

When trying to Knit my dygraph in R using Knitr:

library(dygraphs)
dygraph(nhtemp, main = "New Haven Temperatures") %>% 
dyRangeSelector(dateWindow = c("1920-01-01", "1960-01-01"))

我收到以下错误:

## Error in validateCssUnit(sizeInfo$width): "\maxwidth" is not a
valid CSS unit (e.g., "100%", "400px", "auto")

任何人都可以帮助我解决这个问题或意味着什么吗?

Could anyone assist with how I can possibly fix this or what it means?

示例代码.

\documentclass{article} 
\begin{document} 

<<include=FALSE>>= 
library(knitr) 
options(width=55, formatR.arrow=TRUE, highlight=TRUE, scipen=1, digits=3, tidy=TRUE, comment='##') opts_chunk$set(fig.width=4, fig.height=4, fig.align='center', tidy=TRUE, highlight=TRUE, cache=TRUE, dev='tikz', fig.path='figure/', cache.path='cache/')
@ 

<<include=FALSE>>= 
  library(tikzDevice) 
@ 

<<>>= 
library(dygraphs) 
dygraph(nhtemp, main = "New Haven Temperatures") 
@ 

\end{document} 

推荐答案

更新:从

Update: Starting from knitr 1.13 (not released yet), HTML widgets will be automatically converted to screenshots using the webshot package when the output format is not HTML.

图表是基于 htmlwidgets ( http://htmlwidgets .org ),这意味着它仅适用于HTML输出(例如,来自R Markdown文档或Shiny应用程序).您不能在LaTeX文档中使用任何基于 htmlwidgets 的程序包.

dygraphs is an R package based on htmlwidgets (http://htmlwidgets.org), which means it only works for HTML output (e.g. from R Markdown documents or Shiny apps). You cannot use any htmlwidgets-based packages in LaTeX documents.

这篇关于编织中的笔画不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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