Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e7d60b

Browse files

File tree

2,457 files changed

+1046392
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,457 files changed

+1046392
-0
lines changed

0206/03/21/matlab-quadratic-fit.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
% Learn about API authentication here: https://plot.ly/matlab/getting-started
2+
% Find your api_key here: https://plot.ly/settings/api
3+
4+
x = linspace(0,4*pi,10);
5+
A = 2, B = 3, C = 1;
6+
7+
y = A * x.^2 + B * x + C
8+
9+
p = polyfit(x,y,2);
10+
11+
k = polyval(p,x)
12+
13+
fig = figure;
14+
hold on
15+
plot(x,y,'ro')
16+
plot(x,k,'b-')
17+
hold off
18+
19+
resp = fig2plotly(fig, 'strip',false)
20+
plotly_url = resp.url;

2015/04/09/2d-histogram-options.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var x = [];
2+
var y = [];
3+
for (var i = 0; i < 500; i ++) {
4+
x[i] = Math.random();
5+
y[i] = Math.random() + 1;
6+
}
7+
8+
var data = [
9+
{
10+
x: x,
11+
y: y,
12+
histnorm: 'probability',
13+
autobinx: false,
14+
xbins: {
15+
start: -3,
16+
end: 3,
17+
size: 0.1
18+
},
19+
autobiny: false,
20+
ybins: {
21+
start: -2.5,
22+
end: 4,
23+
size: 0.1
24+
},
25+
colorscale: [['0', 'rgb(12,51,131)'], ['0.25', 'rgb(10,136,186)'], ['0.5', 'rgb(242,211,56)'], ['0.75', 'rgb(242,143,56)'], ['1', 'rgb(217,30,30)']],
26+
type: 'histogram2d'
27+
}
28+
];
29+
Plotly.newPlot('myDiv', data);

2015/04/09/2d-histogram-scatter.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var x0 = [];
2+
var y0 = [];
3+
var x1 = [];
4+
var y1 = [];
5+
var x2 = [];
6+
var y2 = [];
7+
8+
for (var i = 0; i < 500; i ++)
9+
{
10+
x0[i] = Math.random() + 1;
11+
y0[i] = Math.random() + 1.5;
12+
}
13+
14+
for (var i = 0; i < 100; i ++)
15+
{
16+
x1[i] = Math.random();
17+
y1[i] = Math.random() + 1;
18+
}
19+
20+
for (var i = 0; i < 500; i ++)
21+
{
22+
x2[i] = Math.random()*2;
23+
y2[i] = Math.random()*3;
24+
}
25+
26+
var trace1 = {
27+
x: x0,
28+
y: y0,
29+
mode: 'markers',
30+
marker: {
31+
symbol: 'circle',
32+
opacity: 0.7,
33+
color:'rgb(200,111,200)',
34+
},
35+
type: 'scatter',
36+
};
37+
var trace2 = {
38+
x: x1,
39+
y: y1,
40+
mode: 'markers',
41+
marker: {
42+
symbol: 'square',
43+
opacity: 0.7,
44+
color:'cyan',
45+
},
46+
type: 'scatter'
47+
};
48+
var trace3 = {
49+
x: x2,
50+
y: y2,
51+
type: 'histogram2d',
52+
colorscale : [['0' , 'rgb(0,225,100)'],['1', 'rgb(100,0,200)']],
53+
54+
};
55+
56+
var data = [trace1, trace2, trace3];
57+
Plotly.newPlot('myDiv', data);

2015/04/09/2d-histogram.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var x = [];
2+
var y = [];
3+
for (var i = 0; i < 500; i ++) {
4+
x[i] = Math.random();
5+
y[i] = Math.random() + 1;
6+
}
7+
8+
var data = [
9+
{
10+
x: x,
11+
y: y,
12+
type: 'histogram2d'
13+
}
14+
];
15+
Plotly.newPlot('myDiv', data);
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// from http://bl.ocks.org/mbostock/4349187
2+
// Sample from a normal distribution with mean 0, stddev 1.
3+
4+
function normal() {
5+
var x = 0,
6+
y = 0,
7+
rds, c;
8+
do {
9+
x = Math.random() * 2 - 1;
10+
y = Math.random() * 2 - 1;
11+
rds = x * x + y * y;
12+
} while (rds == 0 || rds > 1);
13+
c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform
14+
return x * c; // throw away extra sample y * c
15+
}
16+
17+
var N = 2000,
18+
a = -1,
19+
b = 1.2;
20+
21+
var step = (b - a) / (N - 1);
22+
var t = new Array(N), x = new Array(N), y = new Array(N);
23+
24+
for(var i = 0; i < N; i++){
25+
t[i] = a + step * i;
26+
x[i] = (Math.pow(t[i], 3)) + (0.3 * normal() );
27+
y[i] = (Math.pow(t[i], 6)) + (0.3 * normal() );
28+
}
29+
30+
var trace1 = {
31+
x: x,
32+
y: y,
33+
mode: 'markers',
34+
name: 'points',
35+
marker: {
36+
color: 'rgb(102,0,0)',
37+
size: 2,
38+
opacity: 0.4
39+
},
40+
type: 'scatter'
41+
};
42+
var trace2 = {
43+
x: x,
44+
y: y,
45+
name: 'density',
46+
ncontours: 20,
47+
colorscale: 'Hot',
48+
reversescale: true,
49+
showscale: false,
50+
type: 'histogram2dcontour'
51+
};
52+
var trace3 = {
53+
x: x,
54+
name: 'x density',
55+
marker: {color: 'rgb(102,0,0)'},
56+
yaxis: 'y2',
57+
type: 'histogram'
58+
};
59+
var trace4 = {
60+
y: y,
61+
name: 'y density',
62+
marker: {color: 'rgb(102,0,0)'},
63+
xaxis: 'x2',
64+
type: 'histogram'
65+
};
66+
var data = [trace1, trace2, trace3, trace4];
67+
var layout = {
68+
showlegend: false,
69+
autosize: false,
70+
width: 600,
71+
height: 550,
72+
margin: {t: 50},
73+
hovermode: 'closest',
74+
bargap: 0,
75+
xaxis: {
76+
domain: [0, 0.85],
77+
showgrid: false,
78+
zeroline: false
79+
},
80+
yaxis: {
81+
domain: [0, 0.85],
82+
showgrid: false,
83+
zeroline: false
84+
},
85+
xaxis2: {
86+
domain: [0.85, 1],
87+
showgrid: false,
88+
zeroline: false
89+
},
90+
yaxis2: {
91+
domain: [0.85, 1],
92+
showgrid: false,
93+
zeroline: false
94+
}
95+
};
96+
Plotly.newPlot('myDiv', data, layout);

2015/04/09/3d-line-spiral.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var pointCount = 3142;
2+
var i, r;
3+
4+
var x = [];
5+
var y = [];
6+
var z = [];
7+
var c = [];
8+
9+
for(i = 0; i < pointCount; i++)
10+
{
11+
r = i * (pointCount - i);
12+
x.push(r * Math.cos(i / 30));
13+
y.push(r * Math.sin(i / 30));
14+
z.push(i);
15+
c.push(i)
16+
}
17+
18+
Plotly.newPlot('myDiv', [{
19+
type: 'scatter3d',
20+
mode: 'lines',
21+
x: x,
22+
y: y,
23+
z: z,
24+
opacity: 0.7,
25+
line: {
26+
width: 10,
27+
color: c,
28+
colorscale: 'Viridis'}
29+
}]);

2015/04/09/Blackbody-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Blackbody',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'Blackbody'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/Bluered-heatmap.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Bluered',
5+
type: 'heatmap'
6+
}];
7+
Plotly.newPlot('myDiv', data);
8+
});

2015/04/09/Earth-heatmap.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Earth',
5+
type: 'heatmap'
6+
}];
7+
Plotly.newPlot('myDiv', data);
8+
});

2015/04/09/Electric-heatmap.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Electric',
5+
type: 'heatmap'
6+
}];
7+
Plotly.newPlot('myDiv', data);
8+
});

2015/04/09/Greens-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Greens',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'Greens'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/Greys-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Greys',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'Greys'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/Hot-heatmap.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Hot',
5+
type: 'heatmap'
6+
}];
7+
Plotly.newPlot('myDiv', data);
8+
});

2015/04/09/Jet-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Jet',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'Jet'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/Picnic-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Picnic',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'Picnic'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/Portland-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'Portland',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'Portland'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/RdBu-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'RdBu',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'RdBu'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

2015/04/09/YIGnBu-heatmap.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
2+
var data = [{
3+
z: figure.z,
4+
colorscale: 'YIGnBu',
5+
type: 'heatmap'
6+
}
7+
];
8+
var layout = {title: 'YIGnBu'};
9+
Plotly.newPlot('myDiv', data, layout);
10+
});

0 commit comments

Comments
 (0)