当前位置: 首页 > news >正文

扬州网站建设兼职wordpress 分页按钮

扬州网站建设兼职,wordpress 分页按钮,深圳家具设计公司排名,建设网站的工具❝ 写在前面 本文为 R 语言 echarts4r 包的学习笔记。本着自己学习、分享他人的态度,分享学习笔记,希望能对大家有所帮助。软件可能随时更新,建议配合官方文档一起阅读。 目录 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,让我们一起来探索一下这个包吧。

  1. echarts4r 包的所有函数都以 e_ 开头。
  2. 它所有的 Shiny 代理都以 _p 结尾。
  3. 所有 echarts4r 绘图均使用 e_charts 初始化。
  4. 所有函数都是 |> 友好的。
  5. 大多数函数都有以 _ 结尾的 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 data
df <- state.x77 |> 
  as.data.frame() |> 
  tibble::rownames_to_column("State")

library(echarts4r) # load echarts4r

df |> 
  e_charts(x = State) |> # initialise and set x
  e_line(serie = Population) # add a line
alt

如果您对裸列名称不满意,可以使用以 _ 结尾的 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
alt

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
alt

让我们使用便捷函数 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
alt

我们可以使用 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
alt

图例和标题有点接近,让我们将图例移到画布的另一部分。

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
alt

添加一个 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
alt

最后,我们目前正在同一轴上绘制人口和收入,让我们通过为收入指定一个额外的轴,将它们分别放在各自的 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
alt

4 Navigate options

echarts4r 是高度可定制的,有太多的选项,无法将它们全部硬编码在包中,但请放心;它们可用,并且可以传递给 ...。您将在官方文档中找到所有这些选项: https://echarts.apache.org/en/option.html

例如,tooltip 的文档如下所示:

alt

因此,如果我们想将 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"
    )
  ) 
alt

一旦你意识到 R 中的 JSON ~= list,那就很容易了。

您已经了解了基础知识,请转到 advanced 部分或浏览网站以了解如何添加多个链接图表、在地球仪上绘图、使用 shiny 包等等。


--------------- 结束 ---------------

注:本文为个人学习笔记,仅供大家参考学习,不得用于任何商业目的。如有侵权,请联系作者删除。

alt

本文由 mdnice 多平台发布

http://www.yayakq.cn/news/225801/

相关文章:

  • 象山县住房和城乡建设局网站中文wordpress企业
  • 淘宝网站SEO怎么做阜阳公司做网站
  • 网络营销网站的建设与策划宜宾网站制作
  • 网站建设费用属于什么科目深圳外贸网站建设服务商
  • 中国建设信用卡网站gta5 网站正在建设中
  • 网站后台登录代码阳江网签
  • 丽江网站开发做网站怎样产生效益
  • 网站备案多个域名甘肃省第九建设集团网站
  • 做一个网站要多久做非经营网站需要营业执照
  • 招聘网站套餐费用怎么做分录外贸seo推广方法
  • 网站建设的实验原理和方法会员卡管理系统免费版
  • 企业设计网站建设嘉兴百度快照优化排名
  • 设计网站免费素材商城网站要多少钱
  • 阿里云企业网站备案青岛做网站需要多少钱
  • 设计公司企业官网苏州seo关键字优化
  • 做电商什么素材网站好做电台用啥什么网站
  • 怎么搜 织梦的网站网页设计制作个人网站
  • 微山县建设.局网站crm管理系统使用
  • 群晖wordpress升级5.0福州网站的优化
  • 电子商务企业网站seo三要素
  • wap网站什么意思手机怎么同步连接wordpress
  • 个人网站 怎么设计网站设计收费标准
  • 公司做网站一般多少钱韩国做hh网站
  • 深圳建设集团有限公司地址做seo网站优化哪家强
  • 廊坊企业建站高端定制网站速度
  • 住房城乡建设部网站诚信酒店 wordpress
  • 南京市建设局网站栖霞一个网站的建设方案
  • 上海建设工程交易中心网站做网站银川
  • 做封面的网站社交网站解决方案
  • 网站轮播图怎么做东莞微网站建设服务