R에서 만든 플롯을 matplotlib를 사용하여 파이썬에서 만든 플롯과 일치 시키려고합니다.
내가 사용하는 현재 코드가 올바르게 사용하려는 사용자 정의 색상과 일치하지 않습니다. 제대로 작동하려면 무엇을 변경할 수 있습니까?
내 주요 관심사는 선의 색상을 일치시키는 것입니다.
스케일 채우기 매뉴얼을 사용하려고합니다. 이것은 색상을 변경하지만 원하는 방식은 아닙니다.
ggplot(data = reactor.summarised.ci, aes(x=standard_time, y=value, group =
group, colour=group)) +
geom_line(size = 0.25)+
geom_ribbon(aes(x = standard_time, ymin = lower.ci.od, ymax = upper.ci.od),
show.legend =FALSE, alpha =0.2, colour = NA)+
ylab("O.D.")+
xlab("Time (min)")+
xlim(0, 350)+
ggtitle('OD Over Time in in Bioreactor 1.02 before adjustment')+
theme(plot.title = element_text(hjust = 0.5))+
scale_fill_manual(values=c("#1f77b4", "#ff7f0e", "#2ca02c", '#d62728'))+
newtheme
newtheme는 다음과 같이 정의됩니다.
newtheme <- theme_classic()+
theme(plot.title = element_text(hjust = 0.5))
그림 범례, 리본 및 선에 다음 색상을 지정하고 싶습니다.
(ReactorA = "#1f77b4",
ReactorB = "#ff7f0e",
ReactorC = "#2ca02c",
Reactor '#d62728')
생성 된 현재 플롯
채우지 않도록 매핑 group
하고 color
있습니다. 따라서 scale_color_manual
선의 색상을 조정하려면 을 사용해야 합니다. 이 시도:
ggplot(data = reactor.summarised.ci, aes(x=standard_time, y=value, group =
group, colour=group)) +
geom_line(size = 0.25)+
geom_ribbon(aes(x = standard_time, ymin = lower.ci.od, ymax = upper.ci.od),
show.legend =FALSE, alpha =0.2, colour = NA)+
ylab("O.D.")+
xlab("Time (min)")+
xlim(0, 350)+
ggtitle('OD Over Time in in Bioreactor 1.02 before adjustment')+
theme(plot.title = element_text(hjust = 0.5)) +
scale_color_manual(values=c("reactorA" = "#1f77b4", "reactorB" = "#ff7f0e", "reactorC" = "#2ca02c", "reactorD" = '#d62728'))+
newtheme
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다