I am trying a 3D Scatter plot with plotly js. is there any way I can add a color scale to the widget as in the below screenshot

When I tried to create I am only able to render 3D chart with some colors. I am not able to achieve a color scale and the legend as in attached screenshot
https://codepen.io/rudi8292/pen/RRxBrQ
        <head>
<!-- Plotly.js -->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
        </head>
        <body>
        <!-- Plotly chart will be drawn inside this DIV -->
        <div id="myDiv" style="width:100%;height:100%"></div>
      <button type="button" class="button" id="this_button">Click here for update</button>
        <script>
        /* JAVASCRIPT CODE GOES HERE */
        </script>
        </body>
var trace1 = {
  x : [3],
  y: [4],
  z : [6],
  mode: 'markers',
  marker: {
    size: 12,
    line: {
      color: 'rgba(217, 217, 217, 0.14)',
      width: 0.5
    },
    opacity: 0.8
  },
  type: 'scatter3d'
};
var trace5 = {
  x : [2],
  y: [5],
  z : [6],
  mode: 'markers',
  marker: {
    size: 11,
    line: {
      color: 'rgba(217, 217, 217, 0.14)',
      width: 0.5
    },
    opacity: 0.8
  },
  type: 'scatter3d'
};
var trace4 = {
  x : [1],
  y: [3],
  z : [4],
  mode: 'markers',
  marker: {
    size: 8,
    line: {
      color: 'rgba(217, 217, 217, 0.14)',
      width: 0.5
    },
     mode : 'markers',
    opacity: 0.8
  },
  type: 'scatter3d'
};
var trace2 = {
  x : [2],
  y: [2],
  z : [2],
  mode: 'markers',
  marker: {
    size: 15,
    line: {
      color: 'rgba(217, 217, 217, 0.14)',
      width: 0.5
    },
    opacity: 0.8
  },
  type: 'scatter3d'
};
var trace3 = {
  x : [1],
  y: [1],
  z : [1],
  mode: 'markers',
  marker: {
    size: 12,
    line: {
      color: 'rgba(217, 217, 217, 0.14)',
      width: 0.5
    },
    opacity: 0.8
  },
  type: 'scatter3d'
};
var data = [trace1, trace2,trace3,trace4,trace5];
var layout = {
    margin: {
    l: 0,
    r: 0,
    b: 0,
    t: 0
  },
  xaxis : {
    title : "This",
  },
  yaxis : {
    title : "That"
  },
  zaxis : {
    title : "where"
  }};     
Plotly.newPlot('myDiv', data, layout);
$("#this_button").click(function(){
  console.log("clicked");
  var update = {
          x : [[1,2,3,4,5]],
          y : [[1,2,3,4,5]],
          z : [[1,2,3,4,5]],
          size :[[12,13,14,15,16]],
          'marker.color' : [["#001","#005","#0f0","#f00","#00f"]],
           text : "size"
      }
      
       Plotly.restyle('myDiv', update,[0,1,2,3,4]);
});