Specifying filenames, overwriting files, and updating graphs at their unique URLsBy default, Plotly will create a new file when you call
fig2plotly. To overwrite a graph, include
'filename', 'my-graph'as the last arguments:
x = linspace(-2*pi,2*pi); y1 = sin(x); y2 = cos(x); fig = figure; plot(x,y1,x,y2); response = fig2plotly(fig, 'filename', 'matlab-basic-line'); plotly_url = response.url;
If a graph named "matlab-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 folderFilenames 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
fig2plotly(fig, 'filename', 'my-graphs/matlab-basic-line');
If the folder doesn't exist, it will be created.
Updating graphs in real-timePlotly graphs can also be updated in real-time with MATLAB. For more, see our Streaming API for MATLAB.
Creating new files
x = linspace(-2*pi,2*pi); y1 = sin(x); y2 = cos(x); fig = figure; plot(x,y1,x,y2); response = fig2plotly(fig); plotly_url = response.url;
Without specifying a filename, 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.