I am creating a bar chart with an annotation positioned on paper at 0,-025
The code
annotations : [{text : 'Data and Visualization by Colorado State Demography Office. Print Date: ' + fmt_date(new Date) ,
font: {
size: 6,
color: 'black'
},
xref : 'paper',
x : 0,
yref : 'paper',
y : -0.20,
align : 'left',
showarrow : false}]
};
Here is the chart on my webpage:
This code puts the source citation right under the y-axis, where I want it. However, when I save the file as a png, the annotation is lower on the plot. For example:
Here is the code I used to save the Plotly Image:
Plotly.toImage(graphDiv, { format: 'png', width: 1000, height: 500 }).then(function (dataURL) {
var a = document.createElement('a');
a.href = dataURL;
a.download = fn;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
});
where “graphDiv” is the web page div that contains the plot.
Is there a way to make sure the annotations are output in the same position in the saved image as in the online image?