Backgrounds in MATLAB®

How to customize backgrounds in matlab. Examples of different background options available in matplotlib and plotly


% Learn about API authentication here: https://plotly.com/matlab/getting-started
% Find your api_key here: https://plotly.com/settings/api


x = 0:pi/20:2*pi;
y = sin(x);
trace = struct('x', x, 'y', y);
data = {trace};

layout = struct('plot_bgcolor','rgb(207, 226, 243)', ...
                'title','Plot with Custom Background Color');
                
response = plotly(data, struct('layout',layout));
plotly_url = response.url
% Learn about API authentication here: https://plotly.com/matlab/getting-started
% Find your api_key here: https://plotly.com/settings/api

x = 0:pi/20:2*pi;
y = cos(x);
trace = struct('x', x, 'y', y);
data = {trace};
layout = struct('plot_bgcolor','rgb(255, 255, 255)', ...
                'fig_bgcolor','rgb(255, 255, 255)', ...
                'title','Plot with Transparent Background');

response = plotly(data, struct('layout',layout));
plotly_url = response.url
% Learn about API authentication here: https://plotly.com/matlab/getting-started
% Find your api_key here: https://plotly.com/settings/api


plot(1:10,rand(1,10))
response = fig2plotly;

% Update the layout
response.layout.plot_bgcolor = 'rgb(0,0,0)';
response.layout.title = 'Plot with Black Background color';
response2 = plotly(response.data, struct('layout',response.layout));

plotly_url = response2.url;