Skip to main content

Matlab example


Figlinq is compatible with Plotly's Chart Studio Python API, and you can use Plotly's Python chart_studio package to interact with content on Figlinq. This simple example illustrates how you can use this package to create a simple line chart and save it, together with associated data, to your Figlinq account.

API key and username

To connect to your Figlinq account, you will need to provide your username and API key. You can find both in your account page. There, you can also create a new API key if needed.

Privacy settings

By default, all plots and data grids created with the Python API are currently public. Make sure to override this setting by including the world_readable parameter set to False in the set_config_file function.


  1. Download the plotly bundle here.
  2. Unzip the archived folder and enter it within Matlab
  3. Run getplotlyoffline('') to download the latest version of Plotly.js
  4. Run plotlysetup_online('YOUR_USER_NAME','YOUR_API_KEY') to set your credentials. If you get folder permissions error info in output, follow instructions to change permissions manually
  5. Run saveplotlyconfig('', '') to set the Figlinq domain, streaming server (currently unsupported).
  6. Create your first simple heatmap by running:
load patients
tbl = table(LastName, Age, Gender, SelfAssessedHealthStatus, Smoker, Weight, Location);
h = heatmap(tbl, 'Smoker', 'SelfAssessedHealthStatus');
fig2plotly(gcf, 'offline', false, 'link', true, 'world_readable', false, 'open', true, 'filename', 'matlab-heatmap', 'fileopt', 'overwrite');

Note that all plots will be created in your home directory, but after creating you can move or rename them, and of course modify the resulting plots!


  • After running the script, your default browser will open the newly-created plot in view mode.
  • If you receive a 404 error after the browser opens, you are likely not logged in. Please make sure that you are logged in to your Figlinq account in your default browser before running the script.
  • The newly-created plot and data grid will be available in your home directory - from there you can move them to other folders and edit, restyle, add to a figure or share.
  • If you run the script multiple times without changing the filename, the plot and grid will be overwritten.

fig2plotly Function

The fig2plotly function in the Plotly's MATLAB library is used to convert MATLAB figures into interactive Plotly.js graphs. This function facilitates the process of creating and sharing high-quality, interactive visualizations directly from MATLAB in Figlinq.


response = fig2plotly(fig, Name, Value)

Input Arguments

fig: The MATLAB figure handle that you want to convert into a Plotly graph. Name-Value pairs: Specify optional parameters using one or more name-value pair arguments in any order. Available options are:

  • filename: [string]untitled - Filename as appears on Plotly.
  • fileopt: [string]new - One of the following options: 'new', 'overwrite', 'extend', 'append'.
  • world_readable: [boolean] - public(true) / private(false).
  • link: [boolean] - show hyperlink (true) / no hyperlink (false).
  • open: [boolean] - open plot in browser (true).


response: A structure array containing information about the created Plotly graph, such as the graph URL.