Skip to content

Commit 37c9566

Browse files
committed
Fix FF docs.
1 parent dfeb959 commit 37c9566

13 files changed

+136
-150
lines changed

plotly/figure_factory/_2d_density.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def create_2d_density(x, y, colorscale='Earth', ncontours=20,
4545
Example 1: Simple 2D Density Plot
4646
```
4747
import plotly.plotly as py
48-
from plotly.tools import FigureFactory as FF
48+
from plotly.figure_factory create_2d_density
4949
5050
import numpy as np
5151
@@ -55,7 +55,7 @@ def create_2d_density(x, y, colorscale='Earth', ncontours=20,
5555
y = (t**6)+(0.3*np.random.randn(2000))
5656
5757
# Create a figure
58-
fig = FF.create_2D_density(x, y)
58+
fig = create_2D_density(x, y)
5959
6060
# Plot the data
6161
py.iplot(fig, filename='simple-2d-density')
@@ -64,7 +64,7 @@ def create_2d_density(x, y, colorscale='Earth', ncontours=20,
6464
Example 2: Using Parameters
6565
```
6666
import plotly.plotly as py
67-
from plotly.tools import FigureFactory as FF
67+
from plotly.figure_factory create_2d_density
6868
6969
import numpy as np
7070
@@ -78,7 +78,7 @@ def create_2d_density(x, y, colorscale='Earth', ncontours=20,
7878
(1, 1, 0.2), (0.98,0.98,0.98)]
7979
8080
# Create a figure
81-
fig = FF.create_2D_density(
81+
fig = create_2D_density(
8282
x, y, colorscale=colorscale,
8383
hist_color='rgb(255, 237, 222)', point_size=3)
8484

plotly/figure_factory/_annotated_heatmap.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ def create_annotated_heatmap(z, x=None, y=None, annotation_text=None,
7272
Example 1: Simple annotated heatmap with default configuration
7373
```
7474
import plotly.plotly as py
75-
from plotly.tools import FigureFactory as FF
75+
from plotly.figure_factory create_annotated_heatmap
7676
7777
z = [[0.300000, 0.00000, 0.65, 0.300000],
7878
[1, 0.100005, 0.45, 0.4300],
7979
[0.300000, 0.00000, 0.65, 0.300000],
8080
[1, 0.100005, 0.45, 0.00000]]
8181
82-
figure = FF.create_annotated_heatmap(z)
82+
figure = create_annotated_heatmap(z)
8383
py.iplot(figure)
8484
```
8585
"""

plotly/figure_factory/_candlestick.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,19 @@ def create_candlestick(open, high, low, close, dates=None, direction='both',
117117
Example 1: Simple candlestick chart from a Pandas DataFrame
118118
```
119119
import plotly.plotly as py
120-
from plotly.tools import FigureFactory as FF
120+
from plotly.figure_factory import create_candlestick
121121
from datetime import datetime
122122
123123
import pandas.io.data as web
124124
125125
df = web.DataReader("aapl", 'yahoo', datetime(2007, 10, 1), datetime(2009, 4, 1))
126-
fig = FF.create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index)
126+
fig = create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index)
127127
py.plot(fig, filename='finance/aapl-candlestick', validate=False)
128128
```
129129
130130
Example 2: Add text and annotations to the candlestick chart
131131
```
132-
fig = FF.create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index)
132+
fig = create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index)
133133
# Update the fig - all options here: https://plot.ly/python/reference/#Layout
134134
fig['layout'].update({
135135
'title': 'The Great Recession',
@@ -151,7 +151,7 @@ def create_candlestick(open, high, low, close, dates=None, direction='both',
151151
Example 3: Customize the candlestick colors
152152
```
153153
import plotly.plotly as py
154-
from plotly.tools import FigureFactory as FF
154+
from plotly.figure_factory import create_candlestick
155155
from plotly.graph_objs import Line, Marker
156156
from datetime import datetime
157157
@@ -160,13 +160,13 @@ def create_candlestick(open, high, low, close, dates=None, direction='both',
160160
df = web.DataReader("aapl", 'yahoo', datetime(2008, 1, 1), datetime(2009, 4, 1))
161161
162162
# Make increasing candlesticks and customize their color and name
163-
fig_increasing = FF.create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index,
163+
fig_increasing = create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index,
164164
direction='increasing', name='AAPL',
165165
marker=Marker(color='rgb(150, 200, 250)'),
166166
line=Line(color='rgb(150, 200, 250)'))
167167
168168
# Make decreasing candlesticks and customize their color and name
169-
fig_decreasing = FF.create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index,
169+
fig_decreasing = create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index,
170170
direction='decreasing',
171171
marker=Marker(color='rgb(128, 128, 128)'),
172172
line=Line(color='rgb(128, 128, 128)'))
@@ -183,7 +183,7 @@ def create_candlestick(open, high, low, close, dates=None, direction='both',
183183
Example 4: Candlestick chart with datetime objects
184184
```
185185
import plotly.plotly as py
186-
from plotly.tools import FigureFactory as FF
186+
from plotly.figure_factory import create_candlestick
187187
188188
from datetime import datetime
189189
@@ -199,7 +199,7 @@ def create_candlestick(open, high, low, close, dates=None, direction='both',
199199
datetime(year=2014, month=2, day=10)]
200200
201201
# Create ohlc
202-
fig = FF.create_candlestick(open_data, high_data,
202+
fig = create_candlestick(open_data, high_data,
203203
low_data, close_data, dates=dates)
204204
205205
py.iplot(fig, filename='finance/simple-candlestick', validate=False)

plotly/figure_factory/_dendrogram.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ def create_dendrogram(X, orientation="bottom", labels=None,
4141
Example 1: Simple bottom oriented dendrogram
4242
```
4343
import plotly.plotly as py
44-
from plotly.tools import FigureFactory as FF
44+
from plotly.figure_factory import create_dendrogram
4545
4646
import numpy as np
4747
4848
X = np.random.rand(10,10)
49-
dendro = FF.create_dendrogram(X)
49+
dendro = create_dendrogram(X)
5050
plot_url = py.plot(dendro, filename='simple-dendrogram')
5151
5252
```
5353
5454
Example 2: Dendrogram to put on the left of the heatmap
5555
```
5656
import plotly.plotly as py
57-
from plotly.tools import FigureFactory as FF
57+
from plotly.figure_factory import create_dendrogram
5858
5959
import numpy as np
6060
6161
X = np.random.rand(5,5)
6262
names = ['Jack', 'Oxana', 'John', 'Chelsea', 'Mark']
63-
dendro = FF.create_dendrogram(X, orientation='right', labels=names)
63+
dendro = create_dendrogram(X, orientation='right', labels=names)
6464
dendro['layout'].update({'width':700, 'height':500})
6565
6666
py.iplot(dendro, filename='vertical-dendrogram')
@@ -69,14 +69,14 @@ def create_dendrogram(X, orientation="bottom", labels=None,
6969
Example 3: Dendrogram with Pandas
7070
```
7171
import plotly.plotly as py
72-
from plotly.tools import FigureFactory as FF
72+
from plotly.figure_factory import create_dendrogram
7373
7474
import numpy as np
7575
import pandas as pd
7676
7777
Index= ['A','B','C','D','E','F','G','H','I','J']
7878
df = pd.DataFrame(abs(np.random.randn(10, 10)), index=Index)
79-
fig = FF.create_dendrogram(df, labels=Index)
79+
fig = create_dendrogram(df, labels=Index)
8080
url = py.plot(fig, filename='pandas-dendrogram')
8181
```
8282
"""

plotly/figure_factory/_distplot.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
8080
Example 1: Simple distplot of 1 data set
8181
```
8282
import plotly.plotly as py
83-
from plotly.tools import FigureFactory as FF
83+
from plotly.figure_factory import create_distplot
8484
8585
hist_data = [[1.1, 1.1, 2.5, 3.0, 3.5,
8686
3.5, 4.1, 4.4, 4.5, 4.5,
@@ -89,15 +89,15 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
8989
9090
group_labels = ['distplot example']
9191
92-
fig = FF.create_distplot(hist_data, group_labels)
92+
fig = create_distplot(hist_data, group_labels)
9393
9494
url = py.plot(fig, filename='Simple distplot', validate=False)
9595
```
9696
9797
Example 2: Two data sets and added rug text
9898
```
9999
import plotly.plotly as py
100-
from plotly.tools import FigureFactory as FF
100+
from plotly.figure_factory import create_distplot
101101
102102
# Add histogram data
103103
hist1_x = [0.8, 1.2, 0.2, 0.6, 1.6,
@@ -125,7 +125,7 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
125125
rug_text_all = [rug_text_1, rug_text_2]
126126
127127
# Create distplot
128-
fig = FF.create_distplot(
128+
fig = create_distplot(
129129
hist_data, group_labels, rug_text=rug_text_all, bin_size=.2)
130130
131131
# Add title
@@ -138,7 +138,7 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
138138
Example 3: Plot with normal curve and hide rug plot
139139
```
140140
import plotly.plotly as py
141-
from plotly.tools import FigureFactory as FF
141+
from plotly.figure_factory import create_distplot
142142
import numpy as np
143143
144144
x1 = np.random.randn(190)
@@ -149,7 +149,7 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
149149
hist_data = [x1, x2, x3, x4]
150150
group_labels = ['2012', '2013', '2014', '2015']
151151
152-
fig = FF.create_distplot(
152+
fig = create_distplot(
153153
hist_data, group_labels, curve_type='normal',
154154
show_rug=False, bin_size=.4)
155155
@@ -158,15 +158,15 @@ def create_distplot(hist_data, group_labels, bin_size=1., curve_type='kde',
158158
Example 4: Distplot with Pandas
159159
```
160160
import plotly.plotly as py
161-
from plotly.tools import FigureFactory as FF
161+
from plotly.figure_factory import create_distplot
162162
import numpy as np
163163
import pandas as pd
164164
165165
df = pd.DataFrame({'2012': np.random.randn(200),
166166
'2013': np.random.randn(200)+1})
167-
py.iplot(FF.create_distplot([df[c] for c in df.columns], df.columns),
168-
filename='examples/distplot with pandas',
169-
validate=False)
167+
py.iplot(create_distplot([df[c] for c in df.columns], df.columns),
168+
filename='examples/distplot with pandas',
169+
validate=False)
170170
```
171171
"""
172172
validate_distplot(hist_data, curve_type)

plotly/figure_factory/_gantt.py

+17-21
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,15 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
621621
Example 1: Simple Gantt Chart
622622
```
623623
import plotly.plotly as py
624-
from plotly.tools import FigureFactory as FF
624+
from plotly.figure_factory import create_gantt
625625
626626
# Make data for chart
627627
df = [dict(Task="Job A", Start='2009-01-01', Finish='2009-02-30'),
628628
dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15'),
629629
dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30')]
630630
631631
# Create a figure
632-
fig = FF.create_gantt(df)
632+
fig = create_gantt(df)
633633
634634
# Plot the data
635635
py.iplot(fig, filename='Simple Gantt Chart', world_readable=True)
@@ -638,7 +638,7 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
638638
Example 2: Index by Column with Numerical Entries
639639
```
640640
import plotly.plotly as py
641-
from plotly.tools import FigureFactory as FF
641+
from plotly.figure_factory import create_gantt
642642
643643
# Make data for chart
644644
df = [dict(Task="Job A", Start='2009-01-01',
@@ -649,9 +649,9 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
649649
Finish='2009-05-30', Complete=95)]
650650
651651
# Create a figure with Plotly colorscale
652-
fig = FF.create_gantt(df, colors='Blues', index_col='Complete',
653-
show_colorbar=True, bar_width=0.5,
654-
showgrid_x=True, showgrid_y=True)
652+
fig = create_gantt(df, colors='Blues', index_col='Complete',
653+
show_colorbar=True, bar_width=0.5,
654+
showgrid_x=True, showgrid_y=True)
655655
656656
# Plot the data
657657
py.iplot(fig, filename='Numerical Entries', world_readable=True)
@@ -660,7 +660,7 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
660660
Example 3: Index by Column with String Entries
661661
```
662662
import plotly.plotly as py
663-
from plotly.tools import FigureFactory as FF
663+
from plotly.figure_factory import create_gantt
664664
665665
# Make data for chart
666666
df = [dict(Task="Job A", Start='2009-01-01',
@@ -671,12 +671,9 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
671671
Finish='2009-05-30', Resource='Banana')]
672672
673673
# Create a figure with Plotly colorscale
674-
fig = FF.create_gantt(df, colors=['rgb(200, 50, 25)',
675-
(1, 0, 1),
676-
'#6c4774'],
677-
index_col='Resource',
678-
reverse_colors=True,
679-
show_colorbar=True)
674+
fig = create_gantt(df, colors=['rgb(200, 50, 25)', (1, 0, 1), '#6c4774'],
675+
index_col='Resource', reverse_colors=True,
676+
show_colorbar=True)
680677
681678
# Plot the data
682679
py.iplot(fig, filename='String Entries', world_readable=True)
@@ -685,7 +682,7 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
685682
Example 4: Use a dictionary for colors
686683
```
687684
import plotly.plotly as py
688-
from plotly.tools import FigureFactory as FF
685+
from plotly.figure_factory import create_gantt
689686
690687
# Make data for chart
691688
df = [dict(Task="Job A", Start='2009-01-01',
@@ -701,9 +698,8 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
701698
'Banana': (1, 1, 0.2)}
702699
703700
# Create a figure with Plotly colorscale
704-
fig = FF.create_gantt(df, colors=colors,
705-
index_col='Resource',
706-
show_colorbar=True)
701+
fig = create_gantt(df, colors=colors, index_col='Resource',
702+
show_colorbar=True)
707703
708704
# Plot the data
709705
py.iplot(fig, filename='dictioanry colors', world_readable=True)
@@ -712,7 +708,7 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
712708
Example 5: Use a pandas dataframe
713709
```
714710
import plotly.plotly as py
715-
from plotly.tools import FigureFactory as FF
711+
from plotly.figure_factory import create_gantt
716712
717713
import pandas as pd
718714
@@ -723,9 +719,9 @@ def create_gantt(df, colors=None, index_col=None, show_colorbar=False,
723719
columns=['Task', 'Start', 'Finish', 'Complete'])
724720
725721
# Create a figure with Plotly colorscale
726-
fig = FF.create_gantt(df, colors='Blues', index_col='Complete',
727-
show_colorbar=True, bar_width=0.5,
728-
showgrid_x=True, showgrid_y=True)
722+
fig = create_gantt(df, colors='Blues', index_col='Complete',
723+
show_colorbar=True, bar_width=0.5,
724+
showgrid_x=True, showgrid_y=True)
729725
730726
# Plot the data
731727
py.iplot(fig, filename='data with dataframe', world_readable=True)

0 commit comments

Comments
 (0)