Skip to content

Commit 10a2f40

Browse files
committed
use grid method in more of the examples from js subplots
1 parent 27d80be commit 10a2f40

File tree

5 files changed

+13
-41
lines changed

5 files changed

+13
-41
lines changed

_posts/plotly_js/basic/pie/2015-08-10-pie-chart-subplots.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
sitemap: false
88
arrangement: horizontal
99
markdown_content: |
10-
In order to create pie chart subplots, you need to use the [domain](https://plot.ly/javascript/reference/#pie-domain) attribute. `domain` allows you to place each trace on a `grid` of rows and columns defined in the layout or within a rectangle defined by `X` and `Y` arrays. The example below uses the `grid` method (with a 2 x 2 grid defined in the layout) for the first three traces and the X and Y method for the fourth trace.
10+
In order to create pie chart subplots, you need to use the [domain](https://plot.ly/javascript/reference/#pie-domain) attribute. `domain` allows you to place each trace on a [grid](https://plot.ly/javascript/reference/#layout-grid) of rows and columns defined in the layout or within a rectangle defined by `X` and `Y` arrays. The example below uses the `grid` method (with a 2 x 2 grid defined in the layout) for the first three traces and the X and Y method for the fourth trace.
1111
---
1212

1313
var allLabels = ['1st', '2nd', '3rd', '4th', '5th'];

_posts/plotly_js/subplot/subplots/2015-04-09-multiple-subplots.html

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,7 @@
4040
var data = [trace1, trace2, trace3, trace4];
4141

4242
var layout = {
43-
xaxis: {domain: [0, 0.45]},
44-
yaxis: {domain: [0, 0.45]},
45-
xaxis4: {
46-
domain: [0.55, 1],
47-
anchor: 'y4'
48-
},
49-
xaxis3: {
50-
domain: [0, 0.45],
51-
anchor: 'y3'
52-
},
53-
xaxis2: {domain: [0.55, 1]},
54-
yaxis2: {
55-
domain: [0, 0.45],
56-
anchor: 'x2'
57-
},
58-
yaxis3: {domain: [0.55, 1]},
59-
yaxis4: {
60-
domain: [0.55, 1],
61-
anchor: 'x4'
62-
}
43+
grid: {rows: 2, columns: 2, pattern: 'independent'},
6344
};
6445

6546
Plotly.newPlot('myDiv', data, layout);

_posts/plotly_js/subplot/subplots/2015-04-09-shared-axes-subplots.html

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,11 @@
4141
var data = [trace1, trace2, trace3, trace4];
4242

4343
var layout = {
44-
xaxis: {domain: [0, 0.45]},
45-
yaxis: {domain: [0, 0.45]},
46-
xaxis4: {
47-
domain: [0.55, 1],
48-
anchor: 'y4'
49-
},
50-
xaxis2: {domain: [0.55, 1]},
51-
yaxis3: {domain: [0.55, 1]},
52-
yaxis4: {
53-
domain: [0.55, 1],
54-
anchor: 'x4'
44+
grid: {
45+
rows: 2,
46+
columns: 2,
47+
subplots:[['xy','x2y'], ['xy3','x4y4']],
48+
roworder:'bottom to top'
5549
}
5650
};
5751

_posts/plotly_js/subplot/subplots/2015-04-09-simple-subplot.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
var data = [trace1, trace2];
2626

2727
var layout = {
28-
xaxis: {domain: [0, 0.45]},
29-
yaxis2: {anchor: 'x2'},
30-
xaxis2: {domain: [0.55, 1]}
28+
grid: {rows: 1, columns: 2, pattern: 'independent'},
3129
};
3230

3331
Plotly.newPlot('myDiv', data, layout);

_posts/plotly_js/subplot/subplots/2015-04-09-stacked-subplots.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@
3232
var data = [trace1, trace2, trace3];
3333

3434
var layout = {
35-
yaxis: {domain: [0, 0.266]},
36-
legend: {traceorder: 'reversed'},
37-
xaxis3: {anchor: 'y3'},
38-
xaxis2: {anchor: 'y2'},
39-
yaxis2: {domain: [0.366, 0.633]},
40-
yaxis3: {domain: [0.733, 1]}
35+
grid: {
36+
rows: 3,
37+
columns: 1,
38+
pattern: 'independent',
39+
roworder: 'bottom to top'}
4140
};
4241

4342
Plotly.newPlot('myDiv', data, layout);

0 commit comments

Comments
 (0)