Reuse Plot data in different facets

I have this data the plots x, y, z data. I would like to use facets to show the data from different angles, like it’s a 3d model with top (current view), front and side.

1 Like

I did it but rebuilding the data to give me different view angles.
The positioning a bit messed but that should be easy to fix.

otm = {
  let da = [] d => {
    da.push( {x: d.x, y:d.y,z:d.z,desc:d.desc, view:'top'})
    da.push( {x: d.y, y:d.z,z:d.x,desc:d.desc, view:'front'})
    da.push( {x: d.x, y:d.z,z:d.y,desc:d.desc, view:'left'})
  return da

I’ve seen you using that map / push pattern several times now. You may want to take a look at Array.flatMap() instead:

otm = tm.flatMap(({x, y, z, desc}) => [
  {x: x, y: y, z: z, desc, view: 'top'},
  {x: y, y: z, z: x, desc, view: 'front'},
  {x: x, y: z, z: y, desc, view: 'left'},
1 Like

Thanks, will look at learning that.