使用以下R代码,我在R Studio中创建了一个图。如您所见,仅显示了由x轴引起的部分文本。我怎样才能展示整个学期? 此外,当我绘制数据时,数据是按照字母或数字顺序绘制的,而不是相对于我在数组中定义数据的顺序。因此,如您所见,我将0到9之间的数字添加到x轴文本名称的开头。
library(plotly)
p<- plot_ly(
x= c("0CI-37. Craft labor turnover", "1CI-35. Craft labor quality
issues", "2CI-2. Impact of required approvals",
"3CI-26. Impact of project location", "4CI-4. no. of joint-
venture entities",
"5CI-32. Timinig of change orders", "6CI-31. Magnitude of change
orders",
"7CI-36. Frequency of workarounds", "8CI-5. no. of executive
oversight above PMT","9CI-14. Peak no.of FTE design"),
y= c(0.58, 5.81, 8.13, 9.88, 9.88, 8.13, 7.55, 5.81, 5.81, 0.58),
type="bar",
color= I("lightblue"),
name="Contractor"
)
p
p2<- add_trace(p,
x= c("0CI-37. Craft labor turnover", "1CI-35. Craft labor quality
issues", "2CI-2. Impact of required approvals",
"3CI-26. Impact of project location", "4CI-4. no. of joint-
venture entities",
"5CI-32. Timinig of change orders", "6CI-31. Magnitude of change
orders",
"7CI-36. Frequency of workarounds", "8CI-5. no. of executive
oversight above PMT","9CI-14. Peak no.of FTE design"),
y= c(13.01, 8.28, 10.65, 10.65, 5.91, 4.14, 7.1, 6.5, 5.32, 1.77),
color= I("lightgreen"),
name="Owner"
)
p2
p3<- add_trace(p2,
x= c("0CI-37. Craft labor turnover", "1CI-35. Craft labor quality
issues", "2CI-2. Impact of required approvals",
"3CI-26. Impact of project location", "4CI-4. no. of joint-
venture entities",
"5CI-32. Timinig of change orders", "6CI-31. Magnitude of
change orders",
"7CI-36. Frequency of workarounds", "8CI-5. no. of executive
oversight above PMT","9CI-14. Peak no.of FTE design"),
y= c(4.73, 11.83, 5.91, 4.73, 2.95, 4.14, 3.55, 1.77, 4.73, 2.36),
color= I("orange"),
name="Consultant"
)
p3
答案 0 :(得分:3)
设置轴标签字体大小可以通过以下方式完成:
p3 <- add_trace(blah) %>% layout(
xaxis = list(tickfont = list(size = 'specify size here')),
yaxis = list(tickfont = list(size = 'specify size here'))
)
新版本的情节需要在图表外添加布局(),使用%&gt;%,而不是作为绘图函数的参数。