1

我正在使用。我制作的每个图表都将 x 轴隐藏了一半。即使我使用 x 轴的变量作为 y 轴也会发生这种情况。例如,考虑以下数据集:

structure(list(City = c("MUMBAI", "DELHI", "KOLKATTA", "HYDERABAD", 
"PUNE", "BANGALORE", "AHMEDABAD", "LUCKNOW", "AGRA", "BHUBANESHWAR", 
"GUWAHATI", "NAGPUR", "DELHIN.C.R", "MANGALORE", "INDORE"), OppLoss = c(48, 
44, 41, 38, 56, 43, 44, 43, 42, 32, 31, 43, 47, 25, 41)), .Names = c("City", 
"OppLoss"), row.names = c(32L, 13L, 26L, 17L, 35L, 5L, 2L, 27L, 
1L, 8L, 16L, 33L, 14L, 30L, 18L), class = "data.frame")

我使用了以下代码:

 plot_ly(n, x = OppLoss, y = City, name = OppLoss, mode = "markers", marker = list("pink"))

条形图、折线图等也是如此。我尝试使用以下代码更改设置:

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

plot_ly(n, x = OppLoss, y = City, name = OppLoss, mode = "markers", marker = list("pink")) %>% layout(xaxis = f, yaxis = f)

没有什么能真正改变 x 轴或 y 轴。不知道我做错了什么。

4

1 回答 1

6

只是玩边缘。考虑一下:

m = list(
  l = 200,
  r = 40,
  b = 100,
  t = 50,
  pad = 0
) 

plot_ly(n, x = OppLoss, y = City, name = OppLoss, mode = "markers", marker = list("pink")) %>% 
layout(autosize = F, margin = m)
于 2016-04-05T17:02:20.243 回答