diff --git a/_posts/plotly_js/layout/axes/2016-03-05-axes-reversed-with-min-max.html b/_posts/plotly_js/layout/axes/2016-03-05-axes-reversed-with-min-max.html index 5ca688ca26be..7050c142fa12 100644 --- a/_posts/plotly_js/layout/axes/2016-03-05-axes-reversed-with-min-max.html +++ b/_posts/plotly_js/layout/axes/2016-03-05-axes-reversed-with-min-max.html @@ -10,7 +10,7 @@ var data = [ { - x: [0.0, 0.10101010101, 0.20202020202, 0.30303030303, 0.40404040404, 0.505050505051, 0.606060606061, 0.707070707071, 0.808080808081, 0.909090909091, 1.0101010101, 1.11111111111, 1.21212121212, 1.31313131313, 1.41414141414, 1.51515151515, 1.61616161616, 1.71717171717, 1.81818181818, 1.91919191919, 2.0202020202, 2.12121212121, 2.22222222222, 2.32323232323, 2.42424242424, 2.52525252525, 2.62626262626, 2.72727272727, 2.82828282828, 2.92929292929, 3.0303030303, 3.13131313131, 3.23232323232, 3.33333333333, 3.43434343434, 3.53535353535, 3.63636363636, 3.73737373737, 3.83838383838, 3.93939393939, 4.0404040404, 4.14141414141, 4.24242424242, 4.34343434343, 4.44444444444, 4.54545454545, 4.64646464646, 4.74747474747, 4.84848484848, 4.94949494949, 5.05050505051, 5.15151515152, 5.25252525253, 5.35353535354, 5.45454545455, 5.55555555556, 5.65656565657, 5.75757575758, 5.85858585859, 5.9595959596, 6.06060606061, 6.16161616162, 6.26262626263, 6.36363636364, 6.46464646465, 6.56565656566, 6.66666666667, 6.76767676768, 6.86868686869, 6.9696969697, 7.07070707071, 7.17171717172, 7.27272727273, 7.37373737374, 7.47474747475, 7.57575757576, 7.67676767677, 7.77777777778, 7.87878787879, 7.9797979798, 8.08080808081, 8.18181818182, 8.28282828283, 8.38383838384, 8.48484848485, 8.58585858586, 8.68686868687, 8.78787878788, 8.88888888889, 8.9898989899, 9.09090909091, 9.19191919192, 9.29292929293, 9.39393939394, 9.49494949495, 9.59595959596, 9.69696969697, 9.79797979798, 9.89898989899, 10.0], + x: [0.0, 0.1, 0.2, 0.3, 0.4, 0.51, 0.61, 0.71, 0.81, 0.91, 1.01, 1.11, 1.21, 1.31, 1.41, 1.52, 1.62, 1.72, 1.82, 1.92, 2.02, 2.12, 2.22, 2.32, 2.42, 2.53, 2.63, 2.73, 2.83, 2.93, 3.03, 3.13, 3.23, 3.33, 3.43, 3.54, 3.64, 3.74, 3.84, 3.94, 4.04, 4.14, 4.24, 4.34, 4.44, 4.55, 4.65, 4.75, 4.85, 4.95, 5.05, 5.15, 5.25, 5.35, 5.45, 5.56, 5.66, 5.76, 5.86, 5.96, 6.06, 6.16, 6.26, 6.36, 6.46, 6.57, 6.67, 6.77, 6.87, 6.97, 7.07, 7.17, 7.27, 7.37, 7.47, 7.58, 7.68, 7.78, 7.88, 7.98, 8.08, 8.18, 8.28, 8.38, 8.48, 8.59, 8.69, 8.79, 8.89, 8.99, 9.09, 9.19, 9.29, 9.39, 9.49, 9.6, 9.7, 9.8, 9.9, 10.0], y: [63, 65, 78, 92, 12, 50, 17, 31, 1, 25, 76, 66, 83, 38, 95, 23, 20, 88, 31, 26, 39, 74, 11, 84, 7, 13, 30, 85, 80, 47, 12, 89, 12, 35, 99, 78, 77, 56, 26, 13, 96, 55, 19, 88, 31, 1, 42, 39, 99, 62, 68, 61, 45, 44, 10, 25, 89, 82, 28, 2, 24, 1, 32, 16, 29, 40, 55, 75, 20, 41, 67, 33, 92, 14, 16, 22, 86, 55, 37, 42, 42, 85, 60, 11, 54, 3, 34, 29, 59, 28, 25, 67, 90, 10, 29, 16, 51, 17, 2, 34], mode: "markers" } @@ -18,8 +18,7 @@ var layout = { title: "Reversed Axis with Min/Max", xaxis: { - autorange: "reversed", - range: [0, 10] + range: [10, 0] } }; Plotly.plot('myDiv', data, layout); \ No newline at end of file diff --git a/_posts/python/layout/axes/2015-06-30-axes.html b/_posts/python/layout/axes/2015-06-30-axes.html index 8c9d1eb37b02..791cca5426ef 100644 --- a/_posts/python/layout/axes/2015-06-30-axes.html +++ b/_posts/python/layout/axes/2015-06-30-axes.html @@ -49,8 +49,8 @@

Toggling Axes Lines,
In [1]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace1 = go.Scatter(
     x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
@@ -63,20 +63,20 @@ 

Toggling Axes Lines, data = [trace1, trace2] layout = go.Layout( xaxis=dict( - autorange=True, - showgrid=False, - zeroline=False, - showline=False, + autorange=True, + showgrid=False, + zeroline=False, + showline=False, ticks='', - showticklabels=False + showticklabels=False ), yaxis=dict( - autorange=True, - showgrid=False, - zeroline=False, - showline=False, + autorange=True, + showgrid=False, + zeroline=False, + showline=False, ticks='', - showticklabels=False + showticklabels=False ) ) fig = go.Figure(data=data, layout=layout) @@ -117,11 +117,11 @@

Tick Placement, Color, and Style
-
In [3]:
+
In [2]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
 
-
In [4]:
+
In [3]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace1 = go.Scatter(
     x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
@@ -213,7 +213,7 @@ 

Set and Style Axes Title Labe size=18, color='lightgrey' ), - showticklabels=True, + showticklabels=True, tickangle=45, tickfont=dict( family='Old Standard TT, serif', @@ -230,7 +230,7 @@

Set and Style Axes Title Labe size=18, color='lightgrey' ), - showticklabels=True, + showticklabels=True, tickangle=45, tickfont=dict( family='Old Standard TT, serif', @@ -255,7 +255,7 @@

Set and Style Axes Title Labe
-
Out[4]:
+
Out[3]:
@@ -279,11 +279,11 @@

Styling and Coloring Axes a

-
In [5]:
+
In [4]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace1 = go.Scatter(
     x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
@@ -296,9 +296,9 @@ 

Styling and Coloring Axes a data = [trace1, trace2] layout = go.Layout( xaxis=dict( - showgrid=True, - zeroline=True, - showline=True, + showgrid=True, + zeroline=True, + showline=True, mirror='ticks', gridcolor='#bdbdbd', gridwidth=2, @@ -308,9 +308,9 @@

Styling and Coloring Axes a linewidth=6 ), yaxis=dict( - showgrid=True, - zeroline=True, - showline=True, + showgrid=True, + zeroline=True, + showline=True, mirror='ticks', gridcolor='#bdbdbd', gridwidth=2, @@ -334,7 +334,7 @@

Styling and Coloring Axes a
-
Out[5]:
+
Out[4]:
@@ -358,11 +358,11 @@

Setting the Range of Axes Manually
-
In [6]:
+
In [5]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace1 = go.Scatter(
     x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
@@ -395,7 +395,7 @@ 

Setting the Range of Axes Manually -
Out[6]:
+
Out[5]:
@@ -419,11 +419,11 @@

Subcategory Axes
-
In [7]:
+
In [6]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace1 = go.Box(
   x = [2, 3, 1, 5],
@@ -464,7 +464,7 @@ 

Subcategory Axesdict( x = -0.0951769406393, y = 1.06972670892, - showarrow = False, + showarrow = False, text = "Subgroup", xref = "paper", yref = "paper" @@ -472,7 +472,7 @@

Subcategory Axesdict( x = -0.235516552511, y = 1.07060587474, - showarrow = False, + showarrow = False, text = "Group", xref = "paper", yref = "paper" @@ -480,7 +480,7 @@

Subcategory Axesdict( x = -0.235516552511, y = 0.922906017856, - showarrow = False, + showarrow = False, text = "One", xref = "paper", yref = "paper" @@ -488,7 +488,7 @@

Subcategory Axesdict( x = -0.235516552511, y = 0.375, - showarrow = False, + showarrow = False, text = "Two", xref = "paper", yref = "paper" @@ -534,18 +534,18 @@

Subcategory Axesyref = "paper" ) ], - showlegend = True, + showlegend = True, title = "", width = 600, xaxis = dict( domain = [0, 1] ), yaxis = dict( - autorange = True, + autorange = True, categoryorder = "category descending", domain = [0, 1], range = [-0.5, 3.5], - showline = True, + showline = True, title = "", type = "category" ) @@ -565,7 +565,7 @@

Subcategory Axes -
Out[7]:
+
Out[6]:
@@ -589,11 +589,11 @@

Logarithmic Axes
-
In [8]:
+
In [7]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace1 = go.Scatter(
     x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
@@ -607,11 +607,11 @@ 

Logarithmic Axeslayout = go.Layout( xaxis=dict( type='log', - autorange=True + autorange=True ), yaxis=dict( type='log', - autorange=True + autorange=True ) ) fig = go.Figure(data=data, layout=layout) @@ -628,7 +628,7 @@

Logarithmic Axes -
Out[8]:
+
Out[7]:
@@ -652,11 +652,11 @@

Fixed Ratio Axes
-
In [9]:
+
In [8]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 trace0 = go.Scatter(
   x = [0,1,1,0,0,1,1,2,2,3,3,2,2,3],
@@ -722,7 +722,7 @@ 

Fixed Ratio Axesanchor = "x2", title = "Scale matches <-" ), - showlegend= False + showlegend= False ) fig = go.Figure(data=data, layout=layout) @@ -739,7 +739,7 @@

Fixed Ratio Axes -
Out[9]:
+
Out[8]:
@@ -763,11 +763,11 @@

Reversed Axes
-
In [10]:
+
In [9]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
 
-
In [11]:
+
In [10]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
-import numpy as np
+import numpy as np
 
 x = np.linspace(0, 10, 100)
 y = np.random.randint(1, 100, 100)
 
 trace = go.Scatter(x=x, y=y, mode='markers')
 data = [trace]
-layout = go.Layout(title='Reversed Axis with Min/Max', xaxis=dict(autorange='reversed', range=[0, 10]))
+layout = go.Layout(title='Reversed Axis with Min/Max', xaxis=dict(range=[10, 0]))
 
 fig = go.Figure(data=data, layout=layout)
 py.iplot(fig, filename='example-reversed-axis-with-min-max')
@@ -847,7 +847,7 @@ 

Reversed Axes with Range
-
Out[11]:
+
Out[10]:
@@ -871,11 +871,11 @@

nonnegative,
-
In [13]:
+
In [11]:
-
import plotly.plotly as py
-import plotly.graph_objs as go
+
import plotly.plotly as py
+import plotly.graph_objs as go
 
 data = [
     go.Scatter(
@@ -884,14 +884,14 @@ 

nonnegative, ) ] layout = go.Layout( - showlegend=False, + showlegend=False, xaxis=dict( rangemode='tozero', - autorange=True + autorange=True ), yaxis=dict( rangemode='nonnegative', - autorange=True + autorange=True ) ) fig = go.Figure(data=data, layout=layout) @@ -908,7 +908,7 @@

nonnegative, -
Out[13]:
+
Out[11]:
@@ -932,13 +932,13 @@

Enumerated Ticks with Tickv

-
In [15]:
+
In [12]:
-
import plotly.plotly as py
-import plotly.graph_objs as go 
+
import plotly.plotly as py
+import plotly.graph_objs as go 
 
-import pandas as pd
+import pandas as pd
 
 # get and filter apple data
 apple_df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
@@ -978,12 +978,12 @@ 

Enumerated Ticks with Tickv yaxis2= dict( overlaying='y', side='right', - showgrid=False, + showgrid=False, ) ) fig = go.Figure(data, layout) -py.iplot(fig) +py.iplot(fig, filename='tickvals-and-ticktext')

@@ -996,12 +996,12 @@

Enumerated Ticks with Tickv
-
Out[15]:
+
Out[12]:
- +
diff --git a/_posts/python/layout/axes/axes.ipynb b/_posts/python/layout/axes/axes.ipynb index 4913ca36519a..f43871a57bc9 100644 --- a/_posts/python/layout/axes/axes.ipynb +++ b/_posts/python/layout/axes/axes.ipynb @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -100,7 +100,7 @@ "" ] }, - "execution_count": 3, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -151,7 +151,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -163,7 +163,7 @@ "" ] }, - "execution_count": 4, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -230,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -242,7 +242,7 @@ "" ] }, - "execution_count": 5, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -299,7 +299,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -311,7 +311,7 @@ "" ] }, - "execution_count": 6, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -350,7 +350,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -362,7 +362,7 @@ "" ] }, - "execution_count": 7, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -510,7 +510,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -522,7 +522,7 @@ "" ] }, - "execution_count": 8, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -563,7 +563,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -575,7 +575,7 @@ "" ] }, - "execution_count": 9, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -664,7 +664,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -676,7 +676,7 @@ "" ] }, - "execution_count": 10, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -709,7 +709,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -721,7 +721,7 @@ "" ] }, - "execution_count": 11, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -737,7 +737,7 @@ "\n", "trace = go.Scatter(x=x, y=y, mode='markers')\n", "data = [trace]\n", - "layout = go.Layout(title='Reversed Axis with Min/Max', xaxis=dict(autorange='reversed', range=[0, 10]))\n", + "layout = go.Layout(title='Reversed Axis with Min/Max', xaxis=dict(range=[10, 0]))\n", "\n", "fig = go.Figure(data=data, layout=layout)\n", "py.iplot(fig, filename='example-reversed-axis-with-min-max')" @@ -752,7 +752,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -764,7 +764,7 @@ "" ] }, - "execution_count": 13, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -803,7 +803,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -815,7 +815,7 @@ "" ] }, - "execution_count": 16, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -882,7 +882,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 1, "metadata": { "scrolled": false }, @@ -916,10 +916,10 @@ "output_type": "stream", "text": [ "Collecting git+https://github.com/plotly/publisher.git\n", - " Cloning https://github.com/plotly/publisher.git to /tmp/pip-req-build-WjAJLz\n", + " Cloning https://github.com/plotly/publisher.git to /tmp/pip-req-build-Cf980b\n", "Building wheels for collected packages: publisher\n", " Running setup.py bdist_wheel for publisher ... \u001b[?25ldone\n", - "\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-zV6Bvh/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", + "\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-8d7ROj/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", "Successfully built publisher\n", "Installing collected packages: publisher\n", " Found existing installation: publisher 0.11\n", diff --git a/_posts/r/layout/2015-07-30-axes.Rmd b/_posts/r/layout/2015-07-30-axes.Rmd index 3c81e92eae9b..b98864dfa7c7 100644 --- a/_posts/r/layout/2015-07-30-axes.Rmd +++ b/_posts/r/layout/2015-07-30-axes.Rmd @@ -169,6 +169,25 @@ chart_link chart_link ``` +### Reversed Axes with Range ( Min/Max ) Specified +```{r, results = "hide"} +library(plotly) +x <- seq(0, 10, length=50) +y <- runif(n = 50, min = 0, max = 10) + +p <- plot_ly(x = x, y = y) %>% + layout(xaxis = list(range = c(10, 0))) + +# Create a shareable link to your chart +# Set up API credentials: https://plot.ly/r/getting-started +chart_link = api_create(p, filename="axes-5") +chart_link +``` + +```{r, echo=FALSE} +chart_link +``` + ### Logarithmic Axes ```{r, results = "hide"} @@ -450,7 +469,6 @@ chart_link ### Modifying Axes for 3D Plots ```{r, results = "hide"} -library(plotly) set.seed(123) # Create Random Data @@ -480,7 +498,7 @@ scene = list( camera = list(eye = list(x = -1.25, y = 1.25, z = 1.25))) -p <- plot_ly(ds, x = ~carat, y = ~cut, z = ~price, size = I(3)) %>% +p <- plot_ly(ds, x = ~carat, y = ~cut, z = ~price, type = 'scatter3d', mode = 'markers', marker = list(size = 3)) %>% layout(title = "3D Scatter plot", scene = scene) # Create a shareable link to your chart diff --git a/_posts/r/layout/2015-07-30-axes.md b/_posts/r/layout/2015-07-30-axes.md index f0d6dbc17405..385892052e38 100644 --- a/_posts/r/layout/2015-07-30-axes.md +++ b/_posts/r/layout/2015-07-30-axes.md @@ -56,7 +56,7 @@ chart_link = api_create(p, filename="axes-1") chart_link ``` - + ### Style Axes Titles and Ticks Labels @@ -94,7 +94,7 @@ chart_link = api_create(p, filename="axes-2") chart_link ``` - + ### Style Axes and Zero-Lines @@ -121,7 +121,7 @@ chart_link = api_create(p, filename="axes-3") chart_link ``` - + ### Hide Axes Title, Lines, Ticks, and Labels @@ -144,7 +144,7 @@ chart_link = api_create(p, filename="axes-4") chart_link ``` - + ### Reversed Axes @@ -159,7 +159,25 @@ chart_link = api_create(p, filename="axes-5") chart_link ``` - + + +### Reversed Axes with Range ( Min/Max ) Specified + +```r +library(plotly) +x <- seq(0, 10, length=50) +y <- runif(n = 50, min = 0, max = 10) + +p <- plot_ly(x = x, y = y) %>% + layout(xaxis = list(range = c(10, 0))) + +# Create a shareable link to your chart +# Set up API credentials: https://plot.ly/r/getting-started +chart_link = api_create(p, filename="axes-5") +chart_link +``` + + ### Logarithmic Axes @@ -178,7 +196,7 @@ chart_link = api_create(p, filename="axes-6") chart_link ``` - + ### Categorical Axes @@ -211,7 +229,7 @@ chart_link = api_create(p, filename="axes-category") chart_link ``` - + ### Subcategory Axes @@ -315,7 +333,7 @@ chart_link = api_create(p, filename="axes-subcategory") chart_link ``` - + ### Fixed-Ratio Axes @@ -396,7 +414,7 @@ chart_link = api_create(p, filename="axes-aspectratio", sharing = 'public') chart_link ``` - + ### Rangemode @@ -413,7 +431,7 @@ chart_link = api_create(p, filename="axes-7") chart_link ``` - + ### Manual Ranges @@ -432,12 +450,11 @@ chart_link = api_create(p, filename="axes-8") chart_link ``` - + ### Modifying Axes for 3D Plots ```r -library(plotly) set.seed(123) # Create Random Data @@ -467,7 +484,7 @@ scene = list( camera = list(eye = list(x = -1.25, y = 1.25, z = 1.25))) -p <- plot_ly(ds, x = ~carat, y = ~cut, z = ~price, size = I(3)) %>% +p <- plot_ly(ds, x = ~carat, y = ~cut, z = ~price, type = 'scatter3d', mode = 'markers', marker = list(size = 3)) %>% layout(title = "3D Scatter plot", scene = scene) # Create a shareable link to your chart @@ -476,4 +493,4 @@ chart_link = api_create(p, filename="axes-9") chart_link ``` - +