标签: ggvis

如何在RMarkdown中嵌入ggvis交互式图表?

我试图从交互性小插图中将RMarkdown编织成html这个情节:

mtcars %>% ggvis(x = ~wt) %>%
    layer_densities(
      adjust = input_slider(.1, 2, value = 1, step = .1, label = "Bandwidth adjustment"),
      kernel = input_select(
        c("Gaussian" = "gaussian",
          "Epanechnikov" = "epanechnikov",
          "Rectangular" = "rectangular",
          "Triangular" = "triangular",
          "Biweight" = "biweight",
          "Cosine" = "cosine",
          "Optcosine" = "optcosine"),
        label = "Kernel")
    )
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误消息:

## Warning: Can't output dynamic/interactive ggvis plots in a knitr document.
## Generating a static (non-dynamic, non-interactive) version of the plot.
Run Code Online (Sandbox Code Playgroud)

r r-markdown ggvis

2
推荐指数
1
解决办法
1327
查看次数

将ggvis整合到闪亮的错误

我正在尝试学习如何用ggvis图替换闪亮的静态图.用下面ui.Rserver.R文件,我可以得到一个完全正常工作闪亮应用程序时,我的情节输出基地-R或ggplot.当我尝试使用ggvis时出现以下错误.

Error in handlers$add(handler, key, tail) : Key / already in use

我已经尝试将我的文件的位置更改为不同的目录,清除我的全局环境等.到目前为止似乎没有任何工作.

我试图重现最小的可重现的例子.以下是在我的机器上重现错误.我正在输入存储在与ui.R和server.R相同的文件夹中的csv文件中的数据.我添加了一些可用于重现csv文件的数据的dput().

这是一个例子:

ui.R

library(shiny)
library(dplyr)
library(ggvis)


# Define UI
shinyUI(pageWithSidebar(


  # Application title
  headerPanel("Cricket"),

  sidebarPanel(

    selectInput("hteam", 
                label = "Home Team",
                choices = c("All Teams", "Australia", "England"), selected = "All teams"),

    br()

  ),


  mainPanel(
    plotOutput("CrickPlot")
  )

))
Run Code Online (Sandbox Code Playgroud)

server.R

library(shiny)
library(dplyr)
library(ggvis)




shinyServer(function(input, output) {


  #### Input raw data
  df <- read.csv("mydf.csv", stringsAsFactors=F, header=T)

  df1 <- reactive({

    hometeam <-  input$hteam

  if(input$hteam != "All Teams"){  df …
Run Code Online (Sandbox Code Playgroud)

r shiny ggvis

1
推荐指数
1
解决办法
1129
查看次数

在 R ggplot 或 ggvis(包括图像)中分解 180 度饼图?

给定一个包含因子列 (X1) 和小计列 (X2) 的数据集

  X1 X2 
1  1  12  
2  2  200 
3  3  23  
4  4  86  
5  5  141  
Run Code Online (Sandbox Code Playgroud)

我想创建一个这样的图形:

像这样

这给出了 x2 占 X2 总数的百分比,除以 X1。

编辑:清晰度和添加数据集的可重复性

plot visualization r ggplot2 ggvis

1
推荐指数
1
解决办法
1166
查看次数

如何在R中制作双累积图

在此输入图像描述

如何在r中制作这种类型的图形?

Product Revenue Quantity    Rev Cum Quat Cum
Product A   50% 40% 50% 40%
Product B   25% 30% 75% 70%
Product C   15% 20% 90% 90%
Product D   10% 10% 100%    100%
Run Code Online (Sandbox Code Playgroud)

r ggplot2 plotly ggvis

-1
推荐指数
1
解决办法
46
查看次数

标签 统计

ggvis ×4

r ×4

ggplot2 ×2

plot ×1

plotly ×1

r-markdown ×1

shiny ×1

visualization ×1