Plotly for R:当数据集包含大于1000的数字时,删除y轴上的k

时间:2016-09-27 22:28:36

标签: r plotly

你是一个简单的'简单'问题,我想删除当数据集包含大于10000的数字时似乎自动出现在y轴上的k。我已经尝试将数据上传到图表在线并且它将' k'也是。

例如使用数据的子集。

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 ) 

2 个答案:

答案 0 :(得分:1)

添加此内容:

%>% layout(xaxis = list(tickformat = "digits"))

到您的plot_ly对象。

因此您的情况应该是这样的:

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

答案 1 :(得分:0)

北轴布局就可以了 tickformat =“数字”或tickformat =“ 000”