r - 更改 R 图中数据点的形状
问题描述
我按 PSName 对数据进行了分组,但希望通过更改每个组的形状来直观地区分这些组。我怎样才能做到这一点?这是我的情节代码:
output$p <- renderPlotly({
plot1 <- plot_ly(x = x(), y = y(), name = as.character(input$select), type = 'scatter', mode = 'markers', color = I("#696969"),
transforms = list(
list(
type = 'groupby',
groups = data$PSName,)))
add_lines(y = meaan(), name = paste("Mean =", meaan()[1]), color = I("black")) %>%
add_lines(y = ucl(), name = paste("UCL =", ucl()[1]), color = I("green")) %>%
add_lines(y = lcl(), name = paste("LCL =", lcl()[1]), color = I("green")) %>%
add_lines(y = usl(), name = paste("USL =", usl()[1]), color = I("red")) %>%
add_lines(y = lsl(), name = paste("LSL =", lsl()[1]), color = I("red")) %>%
add_trace(x=rule5x(),y=rule5y(),mode='markers', color = I("blue"), name = paste("Rule 5 Violation =", length(rule5())))%>%
add_trace(x=rule4x(),y=rule4y(),mode='markers', color = I("yellow"), name = paste("Rule 4 Violation =", length(rule4()))) %>%
add_trace(x=rule1x(),y=rule1y(),mode='markers', color = I("red"), name = paste("Rule 1 Violation =", length(rule1()))) %>%
layout(
title = paste("Pov", input$select),
yaxis = list( showline = TRUE,
mirror = "ticks",
linecolor = toRGB("grey"),
linewidth = 1.85
),
xaxis = list( showline = TRUE,
mirror = "ticks",
linecolor = toRGB("grey"),
linewidth = 1.85,
tickangle=70))
})
解决方案
推荐阅读
- python - AttributeError:模块“matplotlib.cbook”在 Networkx 中没有属性“is_numlike”
- twilio - Twilio 函数:如果录制以挂断结束,则忽略录制回调的 TwiML 响应
- python - Python3、FastAPI 和 Firebase:无法从 firebase 成功执行 ref.get()
- flutter - 使用 Flutter 和 Firebase 从 Facebook 登录应用程序中提取数据
- python - 如何在不使用多个进程的情况下将 python 对象保存在 RAM 中?
- postgresql - TypeORM - JSONB 数组 LIKE 值中的对象
- postgresql - PostgreSQL:根据其他列的总和结果创建生成列的最佳方法
- python - AWS Lambda:如何管理大于 250mb 的部署包
- reactjs - 反应被重定向到登录页面时出现 CORS 错误
- asp.net-mvc - 从 for 循环中的 editorfor 获取值