-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
Description
Usecase:
User should be able to draw subplots with ease by using grid option.
User has 4 diff graphs and he wants to put them together, in grid by using following option without getting into much complexity
grid: {
rows: 2,
columns: 2,
pattern: "independent"
}
}
Ease of use:
It will be great to have similat functionality like provided in python plotly where user can define rows, columns, colspan and rowspan in data. Its plain and dead easy.
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(
rows=5, cols=2,
specs=[[{}, {"rowspan": 2}],
[{}, None],
[{"rowspan": 2, "colspan": 2}, None],
[None, None],
[{}, {}]],
print_grid=True)
Reference:
python plotly.subplots has given functionality with much ease of use. see HERE. Same is needed for js Please
Code Pen:
https://codepen.io/mafar/pen/YzZEdLR?editors=0010
JS CODE:
var trace1 = {
type: "bar",
y: [2, 3, 1]
};
var trace2 = {
r: [2, 3, 1],
theta: [0, 45, 90],
type: "barpolar"
};
var trace3 = {
type: "pie",
values: [2, 3, 1]
};
var trace4 = {
mode: "lines",
type: "scatter3d",
x: [2, 3, 1],
y: [0, 0, 0],
z: [0.5, 1, 2]
};
var data = [trace1, trace2, trace3, trace4];
var layout = {
grid: {
rows: 2,
columns: 2,
pattern: "independent"
}
};
Plotly.newPlot("myDiv", data, layout);
LVGMCklimats