You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<summary>How are Plotly attributes organized?</summary>
511
+
<div class="row">
512
+
<p>
513
+
<code>fig2plotly</code> converts MATLAB figures to online Plotly graphs. MATLAB describes figures differently than Plotly. Plotly's MATLAB library crawls the MATLAB figure objects and translates the MATLAB attributes into the structure that Plotly uses to describe and draw data visualizations.<br><br>
514
+
515
+
You may wish to customize the figure <i>after</i> you have translated it but <i>before</i> you have sent it to Plotly. You can customize every attribute of a plotly graph: the hover text, the colorscales, the gridlines, the histogram binning, etc.<br><br>
516
+
517
+
<code>plotly</code> charts are described declaratively with <code>struct</code> and <code>cell array</code> objects. This page contains an extensive list of the keys used to describe plotly graphs inside these <code>struct</code> objects.
518
+
519
+
Here is a simple example of how to translate a MATLAB figure, modify some attributes, and then send it to Plotly.
520
+
521
+
<pre>>> x = linspace(-2*pi, 2*pi);
522
+
>> y1 = sin(x);
523
+
>> y2 = cos(x);
524
+
>> plot(x, y1, x, y2);
525
+
526
+
%% Translate the figure from MATLAB to Plotly
527
+
>> fig = plotlyfig(gcf);
528
+
529
+
>> fig.PlotOptions.Strip = 0; % If 0, don't strip MATLAB's styling in translation. If 1, strip MATLAB's styling.
530
+
531
+
>> fig.data
532
+
ans =
533
+
534
+
[1x1 struct] [1x1 struct]
535
+
536
+
>> fig.data{1} % The 'type' of this trace is 'scatter'. scatter's reference: <a href="#scatter">#scatter</a>
537
+
ans =
538
+
539
+
xaxis: 'x1' % more about scatter's 'xaxis': <a href="#scatter-xaxis">#scatter-xaxis</a>
>> % using offline? Then set fig.PlotOptions.Offline = true;
577
+
578
+
%% Send to plotly
579
+
>> fig.plotly
580
+
581
+
</pre>
582
+
</p>
583
+
<hr>
584
+
</div>
585
+
</details>
509
586
510
-
<div class="row">
511
-
<p>
512
-
<code>fig2plotly</code> converts MATLAB figures to online Plotly graphs. MATLAB describes figures differently than Plotly. Plotly's MATLAB library crawls the MATLAB figure objects and translates the MATLAB attributes into the structure that Plotly uses to describe and draw data visualizations.<br><br>
513
-
514
-
You may wish to customize the figure <i>after</i> you have translated it but <i>before</i> you have sent it to Plotly. You can customize every attribute of a plotly graph: the hover text, the colorscales, the gridlines, the histogram binning, etc.<br><br>
515
-
516
-
<code>plotly</code> charts are described declaratively with <code>struct</code> and <code>cell array</code> objects. This page contains an extensive list of the keys used to describe plotly graphs inside these <code>struct</code> objects.
517
-
518
-
Here is a simple example of how to translate a MATLAB figure, modify some attributes, and then send it to Plotly.
519
-
520
-
<pre>>> x = linspace(-2*pi, 2*pi);
521
-
>> y1 = sin(x);
522
-
>> y2 = cos(x);
523
-
>> plot(x, y1, x, y2);
524
-
525
-
%% Translate the figure from MATLAB to Plotly
526
-
>> fig = plotlyfig(gcf);
527
-
528
-
>> fig.PlotOptions.Strip = 0; % If 0, don't strip MATLAB's styling in translation. If 1, strip MATLAB's styling.
529
-
530
-
>> fig.data
531
-
ans =
532
-
533
-
[1x1 struct] [1x1 struct]
534
-
535
-
>> fig.data{1} % The 'type' of this trace is 'scatter'. scatter's reference: <a href="#scatter">#scatter</a>
536
-
ans =
537
-
538
-
xaxis: 'x1' % more about scatter's 'xaxis': <a href="#scatter-xaxis">#scatter-xaxis</a>
0 commit comments