아래의 R 및 ggplot2 스크립트를 실행하면 다음 스냅 샷이 생성됩니다. 임의의 상자에서 마우스를 가져 가면 그림과 같이 다음 툴팁이 표시됩니다. 내 간단한 요구 사항은 세 번째와 유사한 네 번째 툴팁 속성을 제거하는 것입니다. ghplot 명령의 aes()에서해야 할 일이있을 것 같습니다. 줄거리 나 글꼴의 크기를 늘리지 않고 텍스트를 더 명확하게 만들 수 있다면 도움과 감사를 부탁드립니다.R 및 ggplot2 차트의 힙에서 불필요한 레이블 제거
library(bupaR)
library(ggplot2)
library(scales)
library(plotly)
library(splitstackshape)
tr <- data.frame(traces(patients, output_traces = T, output_cases = F))
tr$Actuals = percent(tr$absolute_frequency/sum(te$absolute_frequency))
tr.df <- cSplit(tr, "trace", ",")
pos <- c(1,4:ncol(tr.df))
tr.df <- tr.df[,..pos]
tr.df <- melt(tr.df, id.vars = "trace_id")
mp1 = ggplot(data = tr.df, aes(x = variable,y = trace_id, fill = value,
label = value)) + geom_tile(colour = "white") +
geom_text(colour = "white", size = 1.9) +
scale_fill_discrete(na.value="transparent") +
theme(legend.position="none") + labs(x = "Traces", y = "Activities")
ggplotly(mp1, height = 500, width = 645)
ggplotly'사용하려고 (MP1, 높이 = 500, 폭 = 645, 툴팁 = C ("변수", "trace_id는", "값"))'. 이 스레드의 답변입니다 : https://stackoverflow.com/questions/38733403/edit-labels-in-tooltip-for-plotly-maps-using-ggplot2-in-r – brettljausn
@brettljausn, 안녕, 네 도움이 필요해. 이 게시물에 데이터를 표시하기위한 약간의 조정이 필요합니다. 도움을 받으십시오. https://stackoverflow.com/questions/47951307/selection-of-activity-trace-in-a-chart-and-display-in-a-data-table -in-r-shiny –