Filenames, Folders, and Updating Plotly Graphs in Julia in Julia
How to update Plotly graphs in Julia with the fileopt and filename parameter.
Specifying filenames, overwriting files, and updating graphs at their unique URLs
By default, Plotly will create a new file when you callPlotly.plot
.
To overwrite a graph, include ["filename" => "basic-line", "fileopt" => "overwrite"]
as the last argument:
using Plotly trace1 = [ "x" => [1, 2, 3, 4], "y" => [10, 15, 13, 17], "type" => "scatter" ] trace2 = [ "x" => [1, 2, 3, 4], "y" => [16, 5, 11, 9], "type" => "scatter" ] data = [trace1, trace2] response = Plotly.plot(data, ["filename" => "basic-line", "fileopt" => "overwrite"]) plot_url = response["url"]
If a graph named "basic-line" already exists in your account, then it will be overwritten with this new version and the URL of the graph will persist.
Saving to a folder
Filenames that contain"/"
be treated as a Plotly directory and will be saved to
your Plotly account in a folder tree.
For example, to save your graphs to the folder my-graphs
:
Plotly.plot(data, ["filename" => "my-graphs/basic-line", "fileopt" => "overwrite"])
If the folder doesn't exist, it will be created.
Creating new files
using Plotly trace1 = [ "x" => [1, 2, 3, 4], "y" => [10, 15, 13, 17], "type" => "scatter" ] trace2 = [ "x" => [1, 2, 3, 4], "y" => [16, 5, 11, 9], "type" => "scatter" ] data = [trace1, trace2] response = Plotly.plot(data, ["filename" => "basic-line", "fileopt" => "new"]) plot_url = response["url"]
With
fileopt='new'
, Plotly will always create a new file. If a
file with the same name already exists, then Plotly will append a '(1)' to the end
of the filename, e.g. basic-line (1)
and create a unique URL.