Dane

load("E:/3rok/metodyinwentaryzacji/zajecia9/d1.RData")

data_long= gather(d1, Pierwsza, Druga, S1:S8, factor_key = T)
data_long
## # A tibble: 4,320 × 7
##    data                    typ_sond  temp polozenie   pol Pierwsza Druga
##    <chr>                   <chr>    <dbl> <chr>     <dbl> <fct>    <dbl>
##  1 2020-12-06 18:58:31.03' t1          25 0 cm          0 S1       0.013
##  2 2020-12-06 18:58:32.03' t1          25 0 cm          0 S1       0.013
##  3 2020-12-06 18:58:33.03' t1          25 0 cm          0 S1       0.013
##  4 2020-12-06 18:58:34.03' t1          25 0 cm          0 S1       0.013
##  5 2020-12-06 18:58:35.03' t1          25 0 cm          0 S1       0.013
##  6 2020-12-06 18:58:36.03' t1          25 0 cm          0 S1       0.013
##  7 2020-12-06 18:58:37.03' t1          25 0 cm          0 S1       0.013
##  8 2020-12-06 18:58:38.03' t1          25 0 cm          0 S1       0.013
##  9 2020-12-06 18:58:39.03' t1          25 0 cm          0 S1       0.013
## 10 2020-12-06 18:58:40.03' t1          25 0 cm          0 S1       0.013
## # ℹ 4,310 more rows
d<-c(rep(1,540),rep(2,540),rep(3,540),rep(4,540),rep(5,540),rep(6,540),rep(7,540),rep(8,540))
data_long$Y<-d

Wynik plotly

dd<-ggplot(data_long, aes(as.factor(pol), Y)) +
   geom_raster(aes(fill = Druga))+
  labs(title = "Wykres Rastrowy w ggplotly",
       x = "Oś pol",
       y = "Oś S")+
  scale_y_continuous(breaks = seq(1, 8, 1))+
   scale_fill_gradient(low = "grey", high = "orange")
plotly::ggplotly(dd)
## Warning in matrix(g$fill_plotlyDomain, nrow = length(y), ncol = length(x), :
## data length differs from size of matrix: [4320 != 8 x 27]
## Warning in matrix(g$hovertext, nrow = length(y), ncol = length(x), byrow =
## TRUE): data length differs from size of matrix: [4320 != 8 x 27]