'How to get subplot to show two ploty plots?

I am trying to generate two simple plots of the same block side by side using subplot but only one of the plots is shown.

size = 50000
width = 4
x1 = 0
x2 = width
y1 = 0
y2 = size

p1 <- plot_ly(type='area',mode='none',x = c(x1,x2,x2,x1,x1),width = 500, height = 725,
          y = c(y1,y1,y2,y2,y1),
          fill = 'toself',
          fillcolor = 'rgb(233,87,62)')

x1 = 0
x2 = width
y1 = 0
y2 = size

p2 <- plot_ly(type='area',mode='none',x = c(x1,x2,x2,x1,x1),width = 500, height = 725,
         y = c(y1,y1,y2,y2,y1),
         fill = 'toself',
         fillcolor = 'rgb(233,87,62)')

subplot(p1,p2,nrows=1)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source