Неправильный цвет для 0 в градиенте, используя ggplot2 в R

Добавьте app:elevation="0dp" в AppBarLayout, и тень будет скрыта.

0
задан LauraS 16 January 2019 в 04:06
поделиться

1 ответ

Восьмой ряд Oxy в основном перекрывает первый ряд. Я визуализировал это, изменив Time на фактор, а также добавив size в качестве эстетики, чтобы мы могли легко увидеть, что делает ggplot().

library(ggplot2)
Oxy <- data.frame(Time = c(0, 0.5, 1, 1.5, 2, 4, 8, 12),
                  DrugConc = c(0, 8, 12, 13, 10, 7.5, 5, 2.5),
                  Pupil = c(0, -0.04, -0.1, -0.25, -0.23, -0.2, -0.15, -0.08))

for(j in 1:(nrow(Oxy)-1)){
  Oxy$Xstart[j] <- Oxy$Pupil[j]
  Oxy$Xend[j] <- Oxy$Pupil[j+1]
  Oxy$Ystart[j] <- Oxy$DrugConc[j]
  Oxy$Yend[j] <- Oxy$DrugConc[j+1]
}
#Plot just the first four row segments
ggplot(Oxy[1:4,], aes(x = Pupil, y = DrugConc, colour = factor(Time), size = factor(Time))) +
  geom_point() +
  geom_segment(aes(x = Xstart, xend = Xend, y = Ystart, yend = Yend),
               arrow = arrow(length = unit(8, "points"), type = "open")) +
  scale_colour_brewer(type = "div")
#> Warning: Using size for a discrete variable is not advised.

#plot rows 5 - 8
ggplot(Oxy[5:8,], aes(x = Pupil, y = DrugConc, colour = factor(Time), size = factor(Time))) +
  geom_point() +
  geom_segment(aes(x = Xstart, xend = Xend, y = Ystart, yend = Yend),
               arrow = arrow(length = unit(8, "points"), type = "open")) +
  scale_colour_brewer(type = "div")
#> Warning: Using size for a discrete variable is not advised.

Создано в 2019-01-15 пользователем [117 ] Представьте пакет (v0.2.1)

Короче говоря - есть вероятность ошибки в ваших входных данных, ggplot() делает то, что должен делать.

0
ответ дан Chase 16 January 2019 в 04:06
поделиться
Другие вопросы по тегам:

Похожие вопросы: