Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Plotly indicator plot for specific values

Code bellow gives me plot for value 20 from 30.

How can I change max of this plot (in my example 30)?

library(plotly)

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

fig

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can set the range of the gauge like so:

library(plotly)

fig <- plot_ly(
  domain = list(x = c(0, 1), y = c(0, 1)),
  value = 20,
  title = list(text = "Speed"),
  type = "indicator",
  mode = "gauge+number",
  gauge = list(
    axis = list(
      range = c(0, 40)
    )
  )
)

fig <- fig %>%
  layout(margin = list(l = 50, r = 50))

fig

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading