简体   繁体   English

Rmetricsgraphics-多线图没有动画并且没有图例

[英]R metricsgraphics - multiline plots not animated and no legend

I am trying to plot a multiline graph. 我正在尝试绘制多线图。 Facing two issues: 1. No Animation 2. Legend not coming up 面临两个问题:1.没有动画2.无法显示图例

Below is my code: 下面是我的代码:

plotForecast <- data.frame(hourIndex=1:24,testHourP=1:24,d1P=25:48,enerDataP=49:72)

plotForecast %>%
mjs_plot(x=hourIndex, y=testHourP) %>%
mjs_line() %>%
mjs_add_line(d1P) %>%
mjs_add_line(enerDataP) %>%

mjs_add_legend(legend=c("X", "Y", "Z"))

The legend is ok, it is appearing under the graph. 图例可以,显示在图形下方。

However the animation seem to be working only when the x axis is in "date" mode. 但是,动画仅在x轴处于“日期”模式时才起作用。

plotForecast %>%
  mjs_plot(x=hourIndex, y=testHourP) %>%
  mjs_line() %>%
  mjs_add_line(d1P) %>%
  mjs_add_line(enerDataP) %>%
  mjs_axis_x(xax_format="date") %>%
  mjs_add_legend(legend=c("X", "Y", "Z")

I know it is strange but it works. 我知道这很奇怪,但是可以。 You could file a ticket to the developers of the package. 您可以向软件包的开发者提交票证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM