@@ -2562,8 +2562,8 @@ def create_dendrogram(X, orientation="bottom", labels=None,
25622562 'data' : dendrogram .data }
25632563
25642564 @staticmethod
2565- def create_annotated_heatmap (z , x = None , y = None , text = [], fontcolor = [],
2566- showscale = False , ** kwargs ):
2565+ def create_annotated_heatmap (z , x = None , y = None , text = [], hover_text = [],
2566+ fontcolor = [], showscale = False , ** kwargs ):
25672567 """
25682568 BETA function that creates annotated heatmaps
25692569
@@ -2590,6 +2590,14 @@ def create_annotated_heatmap(z, x=None, y=None, text=[], fontcolor=[],
25902590 ```
25912591 import plotly.plotly as py
25922592 from plotly.tools import FigureFactory as FF
2593+
2594+ z = [[0.300000, 0.00000, 0.65, 0.300000],
2595+ [1, 0.100005, 0.45, 0.4300],
2596+ [0.300000, 0.00000, 0.65, 0.300000],
2597+ [1, 0.100005, 0.45, 0.00000]]
2598+
2599+ hm = FF.create_annotated_heatmap(z)
2600+ py.iplot(hm)
25932601 ```
25942602 """
25952603 # TODO: protected until #282
@@ -2603,6 +2611,7 @@ def create_annotated_heatmap(z, x=None, y=None, text=[], fontcolor=[],
26032611 z = z ,
26042612 x = x ,
26052613 y = y ,
2614+ text = hover_text ,
26062615 showscale = showscale ,
26072616 ** kwargs )
26082617 layout = dict (annotations = annotations ,
@@ -2612,6 +2621,8 @@ def create_annotated_heatmap(z, x=None, y=None, text=[], fontcolor=[],
26122621 else :
26132622 trace = dict (type = 'heatmap' ,
26142623 z = z ,
2624+ text = hover_text ,
2625+ hoverinfo = 'text' ,
26152626 showscale = showscale ,
26162627 ** kwargs )
26172628 layout = dict (annotations = annotations ,
@@ -2651,10 +2662,38 @@ def create_table(text, colorscale=[[0, '#66b2ff'], [.5, '#e6e6e6'],
26512662 trace such as the colorscale. For more information on valid kwargs
26522663 call help(plotly.graph_objs.Heatmap)
26532664
2654- Example 1: Simple annotated heatmap with default configuration
2665+ Example 1: Simple Plotly Table
26552666 ```
26562667 import plotly.plotly as py
26572668 from plotly.tools import FigureFactory as FF
2669+
2670+ text = [['Country', 'Year', 'Population'],
2671+ ['US', 2000, 282200000],
2672+ ['Canada', 2000, 27790000],
2673+ ['US', 2010, 309000000],
2674+ ['Canada', 2010, 34000000]]
2675+
2676+ table=FF.create_table(text,
2677+ colorscale=[[0, '#000000'],
2678+ [.5, '#80beff'],
2679+ [1, '#cce5ff']],
2680+ fontcolor=['#ffffff', '#000000',
2681+ '#000000'])
2682+ py.iplot(table)
2683+ ```
2684+
2685+ Example 2: Simple Plotly Table with Pandas
2686+ ```
2687+ import plotly.plotly as py
2688+ from plotly.tools import FigureFactory as FF
2689+
2690+ import pandas as pd
2691+
2692+ df = pd.read_csv('http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt', sep='\t ')
2693+ df_p = df[0:25]
2694+
2695+ table_simple=FF.create_table(df_p)
2696+ py.iplot(table_simple)
26582697 ```
26592698 """
26602699 # TODO: protected until #282
@@ -3831,6 +3870,7 @@ def make_table_annotations(self):
38313870 yref = 'y1' ,
38323871 align = "left" ,
38333872 xanchor = "left" ,
3873+ font = dict (color = all_font_color [n ]),
38343874 showarrow = False ))
38353875 return annotations
38363876
0 commit comments