data <-
data.frame
(
Languages =
c
(
'Python'
,
'R'
,
'C++'
,
'Java'
,
'Ruby'
),
Batch_2020 =
c
(199, 398, 319, 910, 735),
Batch_2021 =
c
(952, 942, 933, 851, 771),
Batch_2022 =
c
(1022, 982, 983, 811, 721)
)
fig <- plotly::
plot_ly
(data, y = ~Languages, x = ~Batch_2020,
type =
'bar'
, name =
'2020'
, orientation =
'h'
) %>%
add_trace
(y = ~Languages, x = ~Batch_2021, name =
'2021'
, orientation =
'h'
) %>%
add_trace
(y = ~Languages, x = ~Batch_2022, name =
'2022'
, orientation =
'h'
) %>%
layout
(
xaxis =
list
(title =
'Students Count'
),
barmode =
'stack'
,
title =
"Student Statistics"
,
yaxis =
list
(title =
'Languages'
),
legend =
list
(title =
'Batches'
, orientation =
'v'
,
xanchor =
'center'
, x = 0.5, y = -0.2)
)
fig