Gauge graph using plotly

Hello

I am trying to replicate a gauge graph in R using plotly. When I run the code the graph does not appear, I do not know what seems to be the problem. Please help

library(plotly)

fig1 <- plot_ly(
  domain = list(x = c(0, 0.45), y = c(0, 1)),
  value = 270,
  title = list(text = "Speed"),
  type = "indicator",
  mode = "gauge+number") 
fig1 <- fig1 %>% layout(margin = list(l=20,r=30))

I get this message when I run the code

package �plotly� was built under R version 3.5.3 Loading required package: ggplot2
package �ggplot2� was built under R version 3.5.3
Attaching package: �plotly�

The following object is masked from �package:ggplot2�:

    last_plot

The following object is masked from �package:stats�:

    filter

The following object is masked from �package:graphics�:

    layout

after you have run your code to create a plot into fig1 variable, you will need to run the variable name in the console to get the default plot behaviour to work.

fig1

I do that but then the graph does not appear

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.