diff --git a/_posts/plotly_js/layout/3d-axes/2015-08-12-3d_axes_fixed_ratio_axes.html b/_posts/plotly_js/layout/3d-axes/2015-08-12-3d_axes_fixed_ratio_axes.html new file mode 100644 index 000000000000..3a74940b2720 --- /dev/null +++ b/_posts/plotly_js/layout/3d-axes/2015-08-12-3d_axes_fixed_ratio_axes.html @@ -0,0 +1,66 @@ +--- +name: Fixed Ratio Axes +plot_url: https://codepen.io/plotly/embed/YRKyeq/?height=500&theme-id=15263&default-tab=result +language: plotly_js +suite: 3d-axes +order: 1.1 +sitemap: false +arrangement: horizontal +--- + +function getrandom(num , mul) + { + var value = [ ] + var i; + for(i=0;i<=num;i++) + { + rand = Math.random() * mul; + value.push(rand); + } + return value; + } + +var i; +traces = []; +names = ['cube', 'data', 'auto', 'manual']; +for (i=1; i<5; i++){ + traces.push({ + x: getrandom(20, 4), + y: getrandom(20, 3), + z: getrandom(20, 5), + opacity:0.5, + mode: "markers", + type: "mesh3d", + scene: "scene" + i, + name: names[i-1] + } + ) +} + +var layout = { + scene:{ + aspectmode:'cube', + domain:{row:0, column:0} + }, + scene2:{ + aspectmode:'data', + domain:{row:1, column:0} + }, + scene3:{ + aspectmode:'auto', + domain:{row:0, column:1} + }, + scene4:{ + aspectmode:'manual', + aspectratio: {x:1, y:1, z:2}, + domain: {row:1, column:1} + }, + grid:{ + pattern: 'independent', + rows:2, + columns:2 + }, + +}; + +Plotly.plot('myDiv', traces, layout); diff --git a/_posts/python/layout/3d-axes/2015-06-30-3d-axes.html b/_posts/python/layout/3d-axes/2015-06-30-3d-axes.html index 02bc3f71922b..589b1ce61e0a 100644 --- a/_posts/python/layout/3d-axes/2015-06-30-3d-axes.html +++ b/_posts/python/layout/3d-axes/2015-06-30-3d-axes.html @@ -15,8 +15,7 @@ ipynb: ~notebook_demo/96 --- {% raw %} -
import plotly.plotly as py
@@ -67,7 +65,97 @@ Range of axesb=10, t=10)
)
fig = go.Figure(data=[trace1], layout=layout)
-py.iplot(fig)
+py.iplot(fig, filename='3d-axis-range')
+
import plotly.plotly as py
+import plotly.graph_objs as go
+import plotly.tools as tls
+import numpy as np
+
+N = 50
+
+fig = tls.make_subplots(
+ rows=2, cols=2,
+ specs=[
+ [{'is_3d': True}, {'is_3d': True}],
+ [{'is_3d': True}, {'is_3d': True}]
+ ],
+ print_grid=False
+)
+for i in [1,2]:
+ for j in [1,2]:
+ fig.append_trace(
+ go.Mesh3d(
+ x=(60*np.random.randn(N)),
+ y=(25*np.random.randn(N)),
+ z=(40*np.random.randn(N)),
+ opacity=0.5,
+ ),
+ row=i, col=j)
+
+fig['layout'].update(go.Layout(
+ width=700,
+ margin=dict(
+ r=10, l=10,
+ b=10, t=10)
+ ))
+
+# fix the ratio in the top left subplot to be a cube
+fig['layout']['scene'].update(go.layout.Scene(aspectmode='cube'))
+
+# manually force the z-axis to appear twice as big as the other two
+fig['layout']['scene2'].update(go.layout.Scene(
+ aspectmode='manual',
+ aspectratio=go.layout.scene.Aspectratio(
+ x=1, y=1, z=2
+ )
+))
+
+# draw axes in proportion to the proportion of their ranges
+fig['layout']['scene3'].update(go.layout.Scene(aspectmode='data'))
+
+# automatically produce something that is well proportioned using 'data' as the default
+fig['layout']['scene4'].update(go.layout.Scene(aspectmode='auto'))
+
+py.iplot(fig, filename='3d-axis-fixed-ratio-axes')
import plotly.plotly as py
@@ -135,7 +226,7 @@ Set Axes Titlel=10, t=10)
)
fig = go.Figure(data=[trace1,trace2], layout=layout)
-py.iplot(fig)
+py.iplot(fig, filename='3d-axis-titles')
import plotly.plotly as py
@@ -204,7 +298,7 @@ Ticks Formattingb=10, t=10)
)
fig = go.Figure(data=[trace1], layout=layout)
-py.iplot(fig)
+py.iplot(fig, filename='3d-axis-tick-formatting')
import plotly.plotly as py
@@ -275,7 +372,7 @@ Background and Grid Colorb=10, t=10)
)
fig = go.Figure(data=[trace1], layout=layout)
-py.iplot(fig)
+py.iplot(fig, filename='3d-axis-background-and-grid-color')