← Winnitude! Search  ·  Reader Mode (1773 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 74 LINKS

GitHub - plotly/plotly_matlab: Plotly Graphing Library for MATLAB®

Repository navigation

plotly_matlab
Public

About

Plotly Graphing Library for MATLAB®

plot.ly/matlab/

Topics

d3 d3js data-science data-visualization matlab plotly technical-computing webgl

Resources

Readme MIT license

Code of conduct

Code of conduct

Contributing

Contributing Activity Custom properties

Stars

414 stars

Watchers

63 watching

Forks

166 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


1,760 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.github/ workflows .github/ workflows    
plotly plotly    
.gitignore .gitignore    
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md    
CONTRIBUTING.md CONTRIBUTING.md    
LICENSE LICENSE    
README.md README.md    
buildfile.m buildfile.m    
plotlysetup_offline.m plotlysetup_offline.m    
plotlysetup_online.m plotlysetup_online.m    
sample_plot.png sample_plot.png    

Repository files navigation

Plotly Graphing Library for MATLAB® and GNU Octave

Create interactive, web-based charts in your browser from MATLAB® and GNU Octave.

MATLAB is a registered trademark of The MathWorks, Inc.

Features

  • Convert native MATLAB and GNU Octave figures to interactive Plotly charts with a single line of code
  • Fully offline: charts render locally in your browser -- plotly.js is downloaded once after installing and cached on your machine
  • Publication-quality static export (PNG, JPEG, PDF, SVG) via the Kaleido runtime (downloaded once during setup)
  • Comparison gallery generator (makegallery) showing native and converted figures side by side

Install

MATLAB (R2021a or later)

  1. Download plotly_matlab-<version>.mltbx from the latest release .

  2. In MATLAB's file browser, double-click the file and follow the installer, or run:

    matlab.addons.install('plotly_matlab-<version>.mltbx')

    The toolbox installs into your Add-Ons folder, and MATLAB adds it to the path.

  3. Download plotly.js (needs an internet connection the first time):

    getplotlyoffline()

GNU Octave, or MATLAB from source

Download the source (or clone the repository), then run from the extracted folder:

plotlysetup_offline()   % adds plotly to the path and downloads plotly.js (requires internet once)

This adds plotly to the path for the current session and prints the addpath line to add to your ~/.octaverc (Octave) or startup.m (MATLAB) to keep it there.

Uninstall

  • Toolbox: matlab.addons.uninstall('Plotly Graphing Library for MATLAB')
  • Source: delete the folder and the addpath line from your ~/.octaverc or startup.m

The plotly.js bundle and any saved Plotly credentials are kept in a .plotly folder in your home folder (%APPDATA%\.plotly on Windows); delete it to remove them too.

Usage

Convert your MATLAB® or Octave figure into an interactive Plotly chart with a single line of code:

% Create some data for the two curves to be plotted
x  = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);

% Create a plot with 2 y axes using the plotyy function
figure;
[ax, h1, h2] = plotyy(x, y1, x, y2, 'plot');

% Add title and x axis label
xlabel('Time (s)');
title('Frequency Response');

% Use the axis handles to set the labels of the y axes
ylabel(ax(1), 'Low Frequency');
ylabel(ax(2), 'High Frequency');

%--PLOTLY--%
p = fig2plotly; % <-- converts the current figure to an interactive Plotly chart

The resulting figure is an interactive web chart: pan, zoom, hover, and download from the plotly.js toolbar.

Static export

Export figures to publication-quality static images:

p = fig2plotly;
saveplotlyfig(p, 'testimage.svg')  % PNG, JPEG, PDF, and SVG supported

Online mode

Offline usage is the default and requires nothing. For online features -- storing charts on the Plotly cloud, retrieving figures with getplotlyfig, and streaming -- configure your Plotly credentials:

saveplotlycredentials('your_username', 'your_api_key')

Retrieving figures

Fetch figures stored on the Plotly cloud:

p = getplotlyfig('chris', 1638)  % downloads the graph data

Gallery

Generate a side-by-side comparison of native and converted figures for over 80 plot types:

makegallery('OutputFolder', 'gallery')

Documentation

Questions & troubleshooting

Ask on the Plotly Community Forum .

Contribute

Please do! This is an open source project. Check out the issues or open a PR!

We want to encourage a warm, welcoming, and safe environment for contributing to this project. See the code of conduct for more information.

The test suite (plotly/testing/runplotlytests.m) runs in both MATLAB and GNU Octave and is executed on every push via GitHub Actions.

License

MIT © Plotly, Inc.

About

Plotly Graphing Library for MATLAB®

plot.ly/matlab/

Topics

d3 d3js data-science data-visualization matlab plotly technical-computing webgl

Resources

Readme MIT license

Code of conduct

Code of conduct

Contributing

Contributing Activity Custom properties

Stars

414 stars

Watchers

63 watching

Forks

166 forks Report repository

Releases

Packages

Used by

Contributors

Languages