简体   繁体   English

使用绘图R?添加垂直线并在图形的y轴标签中突出显示一个值。

[英]Adding a vertical line and highlighting a value in y axis label in graph using plotly R?

This is my code: 这是我的代码:

Name<-c('Launch', 'Login', 'Default_Salary_Page', 'DownloadSlip', 'Advance_SalaryPage', 'Raise', 'Certificates')
Avg<-c(2.35,8.91,5.06,1.2,4.22,7.42,1.00)
Percentile_90<-c(3.35,9.91,6.06,2.54,6.45,8.12,2.05)
input<-data.frame(Name,Avg,Percentile_90
plot_ly(input,x=~Name,y=~Avg,name='Avg', type='scatter')%>%add_trace(y=~Percentile_90,name='Percentile_90', type='scatter')

I got a nice plot but I want to add some extra features in the plot. 我有一个不错的情节,但我想在情节中添加一些额外的功能。 I want to add a red vertical line in y axis at value 5 and name that line as SLA. 我想在y轴的值5处添加一条红色垂直线,并将该线命名为SLA。

Can somebody suggest any solution. 有人可以提出任何解决方案吗?

Maybe: 也许:

p <- plot_ly(input, x=~Name, y=~Avg, name='Avg', mode='markers', type='scatter')
p <- add_trace(p, y=~Percentile_90, name='Percentile_90', mode='markers', type='scatter')
p <- add_lines(p, y = 5,name='SLA', mode='lines', line=list(color='red'))
p

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM