Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用TeX表达式标记RCharts nplot中的轴?_R_Tex_Rcharts - Fatal编程技术网

如何使用TeX表达式标记RCharts nplot中的轴?

如何使用TeX表达式标记RCharts nplot中的轴?,r,tex,rcharts,R,Tex,Rcharts,在RCharts nPlot中,可以这样标记轴: p1 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'scatterChart') p1$xAxis(axisLabel = 'Weight') p1 plot(y = mtcars$mpg, x = mtcars$wt, xlab = expression( "Weight "*bgroup("(",frac(lbs,1000),")") )) 但如果我在

在RCharts nPlot中,可以这样标记轴:

p1 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'scatterChart')
p1$xAxis(axisLabel = 'Weight')
p1
plot(y = mtcars$mpg, x = mtcars$wt,  
     xlab = expression( "Weight "*bgroup("(",frac(lbs,1000),")") ))
但如果我在nPlot中使用类似TeX的表达式:

p1 <- nPlot(mpg ~ wt, group = 'cyl', data = mtcars, type = 'scatterChart')
p1$xAxis(axisLabel = expression( 'Weight '*bgroup("(",frac(lbs,1000),")") ))
p1
使用
as.expression()
而不是
expression()
会导致错误:

Error in as.expression("Weight " * bgroup("(", frac(lbs, 1000), ")")) :  could not find function "bgroup"
rCharts的文档仍然非常有限。
有人知道我们是否可以以及如何在rCharts中使用TeX吗?

在rCharts中,axisLabel是一件特别难处理的事情。下面是一个关于更改字体大小goo.gl/h7SclH的示例,因此创建下标可能很困难。问题不在于rCharts本身,而在于它使用的库(在本例中为NVD3),这些库非常有用,但缺乏文档,并且存在一些缺点。可能您需要精通javascript才能实现TeX类型的axis。
Error in as.expression("Weight " * bgroup("(", frac(lbs, 1000), ")")) :  could not find function "bgroup"