getImage does not work with subplots (node.js)

Hello,

I’ve been using plot.ly (for node.js) for a few days. In realising how much data I was going to have to display, I decided that I should instead use subplots.

I also need to export the image directly to a static file (as I am sending it to a Discord server).

I followed the guide here: https://plot.ly/nodejs/subplots/ however I replaced the Plotly.plot with Plotly.getImage (which works when not trying to use subplots).

This is my example code (I’ve probably missed a bracket in the copy-paste, but it executes fine). Sorry for the poor formatting as well - I cannot access pastebin at school (odd thing to block, I know).

var trace1 = {
x: [1, 2, 3],
y: [4, 5, 6],
type: “scatter”
};
var trace2 = {
x: [20, 30, 40],
y: [50, 60, 70],
xaxis: “x2”,
yaxis: “y2”,
type: “scatter”
};
var trace3 = {
x: [300, 400, 500],
y: [600, 700, 800],
xaxis: “x3”,
yaxis: “y3”,
type: “scatter”
};
var trace4 = {
x: [4000, 5000, 6000],
y: [7000, 8000, 9000],
xaxis: “x4”,
yaxis: “y4”,
type: “scatter”
};
var data = {data: [trace1, trace2, trace3, trace4]};
var layout = {
xaxis: {domain: [0, 0.45]},
yaxis: {domain: [0, 0.45]},
xaxis4: {
domain: [0.55, 1],
anchor: “y4”
},
xaxis3: {
domain: [0, 0.45],
anchor: “y3”
},
xaxis2: {domain: [0.55, 1]},
yaxis2: {
domain: [0, 0.45],
anchor: “x2”
},
yaxis3: {domain: [0.55, 1]},
yaxis4: {
domain: [0.55, 1],
anchor: “x4”
}
};

var graphOptions = {
layout: layout,
format: “png”
}

Plotly.getImage(data, graphOptions, function (err, imageStream){
if (err) return console.log(err)

// save the file, the load the file?
var fileStream = fs.createWriteStream(path.join(__dirname, 'graph.png'))
imageStream.pipe(fileStream)

}

I’ve attached the output - which is clearly not what I want.

Any suggestions as to what I might be doing wrong? No matter what I’ve tried, its never exported correctly (its always as if the graphs are overlayed).

Thanks in advance!