Skip to content

Commit 2719d7c

Browse files
authored
Merge pull request #419 from plotly/add-new-docs
Docs for 3.4
2 parents 8f3e872 + f80d5f5 commit 2719d7c

9 files changed

Lines changed: 225 additions & 4 deletions
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: Legend Title Click Behavior
3+
language: plotly_js
4+
suite: legends
5+
order: 12
6+
sitemap: false
7+
arrangement: horizontal
8+
---
9+
10+
var trace1 = {
11+
x: [1, 2, 3],
12+
y: [2, 1, 3],
13+
name: 'Trace 1',
14+
type: 'scatter'
15+
};
16+
17+
var trace2 = {
18+
x: [1, 2, 3],
19+
y: [1, 3, 2],
20+
name: 'Trace 2',
21+
type: 'scatter'
22+
};
23+
24+
var trace3 = {
25+
x: [1, 2, 3],
26+
y: [3, 2, 1],
27+
name: 'Trace 3',
28+
legend: 'legend2',
29+
type: 'scatter'
30+
};
31+
32+
var trace4 = {
33+
x: [1, 2, 3],
34+
y: [2, 3, 1],
35+
name: 'Trace 4',
36+
legend: 'legend2',
37+
type: 'scatter'
38+
};
39+
40+
var data = [trace1, trace2, trace3, trace4];
41+
42+
var layout = {
43+
legend: {
44+
title: {text: 'First Legend'},
45+
titleclick: 'toggleothers',
46+
titledoubleclick: 'toggle'
47+
},
48+
legend2: {
49+
title: {text: 'Second Legend'},
50+
titleclick: 'toggleothers',
51+
titledoubleclick: 'toggle',
52+
y: 0.5
53+
}
54+
};
55+
56+
Plotly.newPlot('myDiv', data, layout);

_posts/plotly_js/fundamentals/marker-style/2018-03-15-color-opacity.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Color Opacity
33
language: plotly_js
44
suite: marker-style
5-
order: 5
5+
order: 7
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |

_posts/plotly_js/fundamentals/marker-style/2018-03-15-marker-opacity.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Marker Opacity
33
language: plotly_js
44
suite: marker-style
5-
order: 4
5+
order: 6
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |

_posts/plotly_js/fundamentals/marker-style/2018-03-15-marker-opaque.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Fully Opaque
33
language: plotly_js
44
suite: marker-style
5-
order: 2
5+
order: 4
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |

_posts/plotly_js/fundamentals/marker-style/2018-03-15-trace-opacity.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Trace Opacity
33
language: plotly_js
44
suite: marker-style
5-
order: 3
5+
order: 5
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Dashed Marker Borders - Array
3+
language: plotly_js
4+
suite: marker-style
5+
order: 3
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
You can also pass an array of dash styles to set different styles per marker.
10+
---
11+
12+
var styles = ['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot'];
13+
14+
var data = [{
15+
x: [0, 1, 2, 3, 4, 5],
16+
y: [0, 0, 0, 0, 0, 0],
17+
type: 'scatter',
18+
mode: 'markers+text',
19+
text: styles,
20+
textposition: 'bottom center',
21+
marker: {
22+
size: 30,
23+
color: 'white',
24+
line: {
25+
color: 'blue',
26+
width: 2,
27+
dash: styles
28+
}
29+
}
30+
}];
31+
32+
Plotly.newPlot('myDiv', data);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Dashed Marker Borders
3+
language: plotly_js
4+
suite: marker-style
5+
order: 2
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
*New in 3.4*
10+
11+
Set `dash` on `marker.line` to control the dash pattern of marker borders. Supported values are: `'solid'` (default), `'dot'`, `'dash'`, `'longdash'`, `'dashdot'`, `'longdashdot'`, or a custom dash length list in px (for example, `'12px,6px'`).
12+
13+
The `marker.line.dash` attribute is available on `scatter`, `scatterpolar`, `scattergeo`, `scatterternary`, `scattercarpet`, and `scattersmith` traces.
14+
---
15+
16+
var data = [{
17+
x: [1, 2, 3, 4, 5],
18+
y: [2, 4, 3, 5, 4],
19+
type: 'scatter',
20+
mode: 'markers',
21+
marker: {
22+
size: 25,
23+
color: 'white',
24+
line: {
25+
color: 'blue',
26+
width: 2,
27+
dash: 'dot'
28+
}
29+
}
30+
}];
31+
32+
Plotly.newPlot('myDiv', data)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Path Shapes Spanning Subplots
3+
language: plotly_js
4+
suite: shape
5+
order: 13
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
For `path` shapes, the array must have one entry for each coordinate in the path string. Each coordinate in the path maps to the corresponding element in the `xref`/`yref` array, in order.
10+
---
11+
12+
var trace1 = {
13+
x: [1, 2, 3],
14+
y: [1, 2, 3],
15+
mode: 'markers',
16+
xaxis: 'x',
17+
yaxis: 'y'
18+
};
19+
20+
var trace2 = {
21+
x: [1, 2, 3],
22+
y: [3, 2, 1],
23+
mode: 'markers',
24+
xaxis: 'x2',
25+
yaxis: 'y2'
26+
};
27+
28+
var layout = {
29+
grid: {rows: 1, columns: 2, pattern: 'independent'},
30+
shapes: [
31+
{
32+
type: 'path',
33+
// Chevron shape spanning both subplots
34+
// Path coordinates map to axis refs in order:
35+
// M 2.5 1.5 -> xref[0]=x, yref[0]=y (start in subplot 1)
36+
// L 1.5 2 -> xref[1]=x2, yref[1]=y2 (tip in subplot 2)
37+
// L 2.5 2.5 -> xref[2]=x, yref[2]=y (end in subplot 1)
38+
path: 'M 2.5 1.5 L 1.5 2 L 2.5 2.5',
39+
xref: ['x', 'x2', 'x'],
40+
yref: ['y', 'y2', 'y'],
41+
line: {color: 'purple', width: 3}
42+
}
43+
],
44+
showlegend: false
45+
};
46+
47+
Plotly.newPlot('myDiv', [trace1, trace2], layout);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Shapes Spanning Subplots
3+
language: plotly_js
4+
suite: shape
5+
order: 12
6+
sitemap: false
7+
arrangement: horizontal
8+
markdown_content: |
9+
*New in 3.4*
10+
11+
You can create shapes that span multiple subplots by passing an array of axis references to `xref` and `yref`. Each element in the array specifies which axis the corresponding coordinate refers to. For example, with `xref: ['x', 'x2']`, `x0` refers to the `x` axis and `x1` refers to the `x2` axis.
12+
13+
**Note:** When using arrays with `xref` and `yref`, `xsizemode: 'pixel'` and `ysizemode: 'pixel'` are not supported.
14+
---
15+
16+
var trace1 = {
17+
x: [1, 2, 3],
18+
y: [4, 5, 6],
19+
mode: 'markers',
20+
marker: {size: 10},
21+
xaxis: 'x',
22+
yaxis: 'y'
23+
};
24+
25+
var trace2 = {
26+
x: [1, 2, 3],
27+
y: [6, 5, 4],
28+
mode: 'markers',
29+
marker: {size: 10},
30+
xaxis: 'x2',
31+
yaxis: 'y2'
32+
};
33+
34+
var layout = {
35+
grid: {rows: 1, columns: 2, pattern: 'independent'},
36+
shapes: [
37+
{
38+
type: 'rect',
39+
// x0 uses x-axis (subplot 1), x1 uses x2-axis (subplot 2)
40+
xref: ['x', 'x2'],
41+
// y0 uses y-axis (subplot 1), y1 uses y2-axis (subplot 2)
42+
yref: ['y', 'y2'],
43+
x0: 2,
44+
y0: 4.5,
45+
x1: 3,
46+
y1: 5.5,
47+
fillcolor: 'rgba(255, 0, 0, 0.2)',
48+
line: {color: 'red', width: 2}
49+
}
50+
],
51+
showlegend: false
52+
};
53+
54+
Plotly.newPlot('myDiv', [trace1, trace2], layout);

0 commit comments

Comments
 (0)