本文介绍了Plotly for R:当数据集包含大于 1000 的数字时,删除 y 轴上的 k的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个关于 plotly 的简单"问题,当数据集包含大于 10000 的数字时,我想删除似乎自动出现在 y 轴上的 k.我尝试将数据上传到 plotly 在线,它把 'k'也在.

Hi a 'simple' question with plotly, I want to remove the k that seems to automatically appears on the y axis when the dataset contains numbers larger than 10000. I have tried uploading the data to plotly online and it puts the 'k' in as well.

例如使用数据的子集.

date <- c(1/07/1987,2/07/1987,3/07/1987,4/07/1987,
5/07/1987,6/07/1987,7/07/1987,8/07/1987,9/07/1987,
10/07/1987,11/07/1987,
12/07/1987,13/07/1987,14/07/1987,15/07/1987,
16/07/1987,17/07/1987,18/07/1987,19/07/1987,
20/07/1987,21/07/1987,22/07/1987,23/07/1987,
24/07/1987,25/07/1987,26/07/1987,27/07/1987,
28/07/1987,29/07/1987,30/07/1987,31/07/1987,
1/08/1987,2/08/1987,3/08/1987)


inflow <- c(6763.37,
6117.23,5487.1,4964.52,
4514.75,4074.88,3708.87,
3433.5,3199.78,3039.32,3063.06,
2938.13,2701.71,2577.23,3333.21,
5549.01,9194.34,10773.31,12919.33,
19590.91,17501.189,15660.45,14296.71,
12260.04,10202.66,8973.64,7865.35,
7044.35,13550.44,9923.3,11974.07,
11349.38,10869.92,10350.58)
inflow_guaged <- cbind(date, inflow)

inflow_guaged$Data <- "2016"

colnames(inflow_guaged) <- c("date","inflow","Data")


m <- list(
  l = 150,
  r = 40,
  b = 150,
  t = 50,
  pad = 0
)

f <- list(
  family = "Courier New, monospace",
  size = 18,
  color = "#7f7f7f"
)

x <- list(
  title = "Date",
  titlefont = f 
)

y <- list(
  title = "Inflow (ML/d)",
  titlefont = f
  )


p <- plot_ly(data = inflows_type, x = date, y = inflow, color = Data, colors = "Set1") %>%
  layout(xaxis = x, yaxis = y, margin = m ) 

推荐答案

bei轴布局就做tickformat = "digit" 或 tickformat = "000"

bei axis layout just dotickformat = "digit" or tickformat = "000"

这篇关于Plotly for R:当数据集包含大于 1000 的数字时,删除 y 轴上的 k的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 06:19