I am using plotly javascript to draw some plots. But what I actually need is the url and I don’t really need the ploly to draw it on the web.
Here is an example, https://codepen.io/slfan2013/pen/xpWMyW. What I really need is the url
and I don’t want the plot show on the website. How to do that? Thanks!
I don’t understand your question.
By URL, you mean something like https://plot.ly/~etpinard/7599/ ?
Thanks for your reply.
I mean when I export the graph, I need the code like
Plotly.newPlot('myDiv', data, layout).then(
function(gd)
{
Plotly.toImage(gd,{height:600,width:800})
.then(
function(url)
{
console.log(url)// this is what i really need!! I dont want it to be ploted~!
}
)
})
The key is to get the url
. However, when getting the url
, the code needs to generate the plot first with Plotly.newPlot()
. I wonder if it is possible not to generate the plot but get the url
?
Sorry for the confusion.
Plotly.toImage(
{data: data, layout: layout},
{height: 600, width: 800}
).then(url => {
console.log(url)
})
should work.
1 Like