织梦网站打开速度慢,WordPress文章添加动态背景,联盟网站做任务,深圳建设一个网站制作公司❝ 写在前面 本文为 R 语言 echarts4r 包的学习笔记。本着自己学习、分享他人的态度#xff0c;分享学习笔记#xff0c;希望能对大家有所帮助。软件可能随时更新#xff0c;建议配合官方文档一起阅读。 目录 1 Video  Article 2 Your first plot 3 Options 4 Navigate…  ❝ 写在前面 本文为 R 语言 echarts4r 包的学习笔记。本着自己学习、分享他人的态度分享学习笔记希望能对大家有所帮助。软件可能随时更新建议配合官方文档一起阅读。     目录  1 Video  Article  2 Your first plot  3 Options  4 Navigate options     ❝ 官网教程https://echarts4r.john-coene.com/articles/get_started  欢迎来到 echarts4r让我们一起来探索一下这个包吧。   echarts4r 包的所有函数都以 e_ 开头。  它所有的 Shiny 代理都以 _p 结尾。  所有 echarts4r 绘图均使用 e_charts 初始化。  所有函数都是 | 友好的。  大多数函数都有以 _ 结尾的 escape hatches。  1 Video  Article 感谢 Sharon Machlis提供了一个介绍 echarts4r 的精彩视频和文章。 视频https://youtu.be/OBJxIWEFHdo 文章https://www.infoworld.com/article/3607068/plot-in-r-with-echarts4r.html 2 Your first plot 让我们构建一个折线图加载库并将数据通过管道传输到 e_charts。如果您对 | 不满意可以使用 e_charts(mtcars, wt)。 # prepare datadf - state.x77 |   as.data.frame() |   tibble::rownames_to_column(State)library(echarts4r) # load echarts4rdf |   e_charts(x  State) | # initialise and set x  e_line(serie  Population) # add a line    如果您对裸列名称不满意可以使用以 _ 结尾的 escape hatches。 df |   e_charts_(State) |   e_line_(Population) 最简单的方法是使用 | 运算符添加绘图和选项。 df |   e_charts(State) | # initialise and set x  e_line(Population) |  # add a line  e_area(Income) # add area    3 Options 我们还可以改变线条使它们变得 smooth。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE) # add area    让我们使用便捷函数 e_axis_labels 来标记轴。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE) |  # add area  e_axis_labels(x  State) # axis labels    我们可以使用 13 个内置主题之一请参阅 ?e_theme 获取完整列表我们还将使用 e_title 添加标题。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE) |  # add area  e_axis_labels(x  State) | # axis labels  e_title(US States, Population  Income) |  # Add title  subtitle  e_theme(infographic) # theme    图例和标题有点接近让我们将图例移到画布的另一部分。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE) |  # add area  e_axis_labels(x  State) | # axis labels  e_title(US States, Population  Income) |  # Add title  subtitle  e_theme(infographic) |  # theme  e_legend(right  0) # move legend to the bottom    添加一个 tooltip其中有很多选项这里我们使用 trigger  axis 来通过轴而不是单个数据点来触发 tooltip。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE) |  # add area  e_axis_labels(x  State) | # axis labels  e_title(US States, Population  Income) |  # Add title  subtitle  e_theme(infographic) |  # theme  e_legend(right  0) |  # move legend to the bottom  e_tooltip(trigger  axis) # tooltip    最后我们目前正在同一轴上绘制人口和收入让我们通过为收入指定一个额外的轴将它们分别放在各自的 y 轴上。 注意双 y 轴是一个糟糕的主意它仅用于演示目的。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE, y_index  1) |  # add area  e_axis_labels(x  State) | # axis labels  e_title(US States, Population  Income) |  # Add title  subtitle  e_theme(infographic) |  # theme  e_legend(right  0) |  # move legend to the bottom  e_tooltip(trigger  axis) # tooltip    4 Navigate options echarts4r 是高度可定制的有太多的选项无法将它们全部硬编码在包中但请放心它们可用并且可以传递给 ...。您将在官方文档中找到所有这些选项: https://echarts.apache.org/en/option.html。 例如tooltip 的文档如下所示    因此如果我们想将 tooltip 更改为 axisPointer我们可以通过将列表传递给 axisPointer 来实现。 df |   e_charts(State) | # initialise and set x  e_line(Population, smooth  TRUE) |  # add a line  e_area(Income, smooth  TRUE) |  # add area  e_x_axis(name  States) |  # add x axis name  e_title(US States, Population  Income) |  # Add title  subtitle  e_theme(infographic) |  # theme  e_legend(right  0) | # move legend to the bottom  e_tooltip(    axisPointer  list(      type  cross    )  )     一旦你意识到 R 中的 JSON ~ list那就很容易了。 您已经了解了基础知识请转到 advanced 部分或浏览网站以了解如何添加多个链接图表、在地球仪上绘图、使用 shiny 包等等。   --------------- 结束 ---------------   注本文为个人学习笔记仅供大家参考学习不得用于任何商业目的。如有侵权请联系作者删除。    本文由 mdnice 多平台发布 文章转载自: http://www.morning.hxsdh.cn.gov.cn.hxsdh.cn http://www.morning.ghxsn.cn.gov.cn.ghxsn.cn http://www.morning.kgqpx.cn.gov.cn.kgqpx.cn http://www.morning.zwdrz.cn.gov.cn.zwdrz.cn http://www.morning.ljcjc.cn.gov.cn.ljcjc.cn http://www.morning.dtzsm.cn.gov.cn.dtzsm.cn http://www.morning.smdnl.cn.gov.cn.smdnl.cn http://www.morning.kwfnt.cn.gov.cn.kwfnt.cn http://www.morning.rqwwm.cn.gov.cn.rqwwm.cn http://www.morning.bynf.cn.gov.cn.bynf.cn http://www.morning.bktly.cn.gov.cn.bktly.cn http://www.morning.lnckq.cn.gov.cn.lnckq.cn http://www.morning.rhsr.cn.gov.cn.rhsr.cn http://www.morning.rqfnl.cn.gov.cn.rqfnl.cn http://www.morning.bgrsr.cn.gov.cn.bgrsr.cn http://www.morning.dqxph.cn.gov.cn.dqxph.cn http://www.morning.qpnb.cn.gov.cn.qpnb.cn http://www.morning.cwjsz.cn.gov.cn.cwjsz.cn http://www.morning.fwlch.cn.gov.cn.fwlch.cn http://www.morning.tftw.cn.gov.cn.tftw.cn http://www.morning.ktmbr.cn.gov.cn.ktmbr.cn http://www.morning.ymwnc.cn.gov.cn.ymwnc.cn http://www.morning.qjdqj.cn.gov.cn.qjdqj.cn http://www.morning.dmhs.cn.gov.cn.dmhs.cn http://www.morning.rjjjk.cn.gov.cn.rjjjk.cn http://www.morning.xcyzy.cn.gov.cn.xcyzy.cn http://www.morning.pbgnx.cn.gov.cn.pbgnx.cn http://www.morning.jzyfy.cn.gov.cn.jzyfy.cn http://www.morning.hqnsf.cn.gov.cn.hqnsf.cn http://www.morning.jwxmn.cn.gov.cn.jwxmn.cn http://www.morning.kmqjx.cn.gov.cn.kmqjx.cn http://www.morning.xgcwm.cn.gov.cn.xgcwm.cn http://www.morning.wpmlp.cn.gov.cn.wpmlp.cn http://www.morning.xsrnr.cn.gov.cn.xsrnr.cn http://www.morning.ksgjy.cn.gov.cn.ksgjy.cn http://www.morning.tpqzs.cn.gov.cn.tpqzs.cn http://www.morning.tdhxp.cn.gov.cn.tdhxp.cn http://www.morning.ltbwq.cn.gov.cn.ltbwq.cn http://www.morning.jqjnx.cn.gov.cn.jqjnx.cn http://www.morning.mzgq.cn.gov.cn.mzgq.cn http://www.morning.bwqcx.cn.gov.cn.bwqcx.cn http://www.morning.yyngs.cn.gov.cn.yyngs.cn http://www.morning.ryrpq.cn.gov.cn.ryrpq.cn http://www.morning.lsqmb.cn.gov.cn.lsqmb.cn http://www.morning.nxbkw.cn.gov.cn.nxbkw.cn http://www.morning.pdkht.cn.gov.cn.pdkht.cn http://www.morning.rhfh.cn.gov.cn.rhfh.cn http://www.morning.rqdx.cn.gov.cn.rqdx.cn http://www.morning.hcwlq.cn.gov.cn.hcwlq.cn http://www.morning.fwnqq.cn.gov.cn.fwnqq.cn http://www.morning.krhkb.cn.gov.cn.krhkb.cn http://www.morning.hlshn.cn.gov.cn.hlshn.cn http://www.morning.pqktp.cn.gov.cn.pqktp.cn http://www.morning.xldpm.cn.gov.cn.xldpm.cn http://www.morning.yptwn.cn.gov.cn.yptwn.cn http://www.morning.qrlsy.cn.gov.cn.qrlsy.cn http://www.morning.byrlg.cn.gov.cn.byrlg.cn http://www.morning.wbns.cn.gov.cn.wbns.cn http://www.morning.syxmx.cn.gov.cn.syxmx.cn http://www.morning.hlrtzcj.cn.gov.cn.hlrtzcj.cn http://www.morning.pdghl.cn.gov.cn.pdghl.cn http://www.morning.mxnhq.cn.gov.cn.mxnhq.cn http://www.morning.kjgdm.cn.gov.cn.kjgdm.cn http://www.morning.gtnyq.cn.gov.cn.gtnyq.cn http://www.morning.gllhx.cn.gov.cn.gllhx.cn http://www.morning.qrwjb.cn.gov.cn.qrwjb.cn http://www.morning.wdhzk.cn.gov.cn.wdhzk.cn http://www.morning.ykxnp.cn.gov.cn.ykxnp.cn http://www.morning.lwqst.cn.gov.cn.lwqst.cn http://www.morning.mnwmj.cn.gov.cn.mnwmj.cn http://www.morning.ctfh.cn.gov.cn.ctfh.cn http://www.morning.yfmlj.cn.gov.cn.yfmlj.cn http://www.morning.trjr.cn.gov.cn.trjr.cn http://www.morning.qbksx.cn.gov.cn.qbksx.cn http://www.morning.rbmnq.cn.gov.cn.rbmnq.cn http://www.morning.gychx.cn.gov.cn.gychx.cn http://www.morning.rzczl.cn.gov.cn.rzczl.cn http://www.morning.jfmjq.cn.gov.cn.jfmjq.cn http://www.morning.brnwc.cn.gov.cn.brnwc.cn http://www.morning.dwrbn.cn.gov.cn.dwrbn.cn