@@ -2562,8 +2562,8 @@ def create_dendrogram(X, orientation="bottom", labels=None,
2562
2562
'data' : dendrogram .data }
2563
2563
2564
2564
@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 ):
2567
2567
"""
2568
2568
BETA function that creates annotated heatmaps
2569
2569
@@ -2590,6 +2590,14 @@ def create_annotated_heatmap(z, x=None, y=None, text=[], fontcolor=[],
2590
2590
```
2591
2591
import plotly.plotly as py
2592
2592
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)
2593
2601
```
2594
2602
"""
2595
2603
# TODO: protected until #282
@@ -2603,6 +2611,7 @@ def create_annotated_heatmap(z, x=None, y=None, text=[], fontcolor=[],
2603
2611
z = z ,
2604
2612
x = x ,
2605
2613
y = y ,
2614
+ text = hover_text ,
2606
2615
showscale = showscale ,
2607
2616
** kwargs )
2608
2617
layout = dict (annotations = annotations ,
@@ -2612,6 +2621,8 @@ def create_annotated_heatmap(z, x=None, y=None, text=[], fontcolor=[],
2612
2621
else :
2613
2622
trace = dict (type = 'heatmap' ,
2614
2623
z = z ,
2624
+ text = hover_text ,
2625
+ hoverinfo = 'text' ,
2615
2626
showscale = showscale ,
2616
2627
** kwargs )
2617
2628
layout = dict (annotations = annotations ,
@@ -2651,10 +2662,38 @@ def create_table(text, colorscale=[[0, '#66b2ff'], [.5, '#e6e6e6'],
2651
2662
trace such as the colorscale. For more information on valid kwargs
2652
2663
call help(plotly.graph_objs.Heatmap)
2653
2664
2654
- Example 1: Simple annotated heatmap with default configuration
2665
+ Example 1: Simple Plotly Table
2655
2666
```
2656
2667
import plotly.plotly as py
2657
2668
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)
2658
2697
```
2659
2698
"""
2660
2699
# TODO: protected until #282
@@ -3831,6 +3870,7 @@ def make_table_annotations(self):
3831
3870
yref = 'y1' ,
3832
3871
align = "left" ,
3833
3872
xanchor = "left" ,
3873
+ font = dict (color = all_font_color [n ]),
3834
3874
showarrow = False ))
3835
3875
return annotations
3836
3876
0 commit comments