@@ -1170,9 +1170,7 @@ def fig_forest_plot(
11701170 traces = []
11711171
11721172 # Add the point estimates as scatter plot points
1173- traces .append (
1174- go .Scatter (x = df [labels [1 ]], y = df [labels [0 ]], mode = "markers" , name = "Odds Ratio" , marker = marker )
1175- )
1173+ traces .append (go .Scatter (x = df [labels [1 ]], y = df [labels [0 ]], mode = "markers" , name = "Odds Ratio" , marker = marker ))
11761174
11771175 # Add the confidence intervals as lines
11781176 for index , row in df .iterrows ():
@@ -1189,15 +1187,17 @@ def fig_forest_plot(
11891187 if noeffect_line is not None :
11901188 if isinstance (noeffect_line , dict ) is False :
11911189 noeffect_line = {"color" : "red" , "width" : 2 }
1192- add_shape = [{
1193- # Line of no effect
1194- "type" : "line" ,
1195- "x0" : 1 ,
1196- "y0" : - 0.5 ,
1197- "x1" : 1 ,
1198- "y1" : len (df [labels [0 ]]) - 0.5 ,
1199- "line" : noeffect_line ,
1200- }]
1190+ add_shape = [
1191+ {
1192+ # Line of no effect
1193+ "type" : "line" ,
1194+ "x0" : 1 ,
1195+ "y0" : - 0.5 ,
1196+ "x1" : 1 ,
1197+ "y1" : len (df [labels [0 ]]) - 0.5 ,
1198+ "line" : noeffect_line ,
1199+ }
1200+ ]
12011201 else :
12021202 add_shape = None
12031203
@@ -1665,24 +1665,25 @@ def fig_bar_line_chart(
16651665
16661666
16671667def fig_heatmaps (
1668- data ,
1669- title = "" ,
1670- subplot_titles = None ,
1671- ylabel = "" ,
1672- xlabel = "" ,
1673- colorbar_label = "" ,
1674- index_column = "index" ,
1675- zmin = None ,
1676- zmax = None ,
1677- include_annotations = False ,
1678- base_color_map = None ,
1679- height = 750 ,
1680- suffix = "" ,
1681- filepath = "" ,
1682- save_inputs = False ,
1683- graph_id = None ,
1684- graph_label = "" ,
1685- graph_about = "" ):
1668+ data ,
1669+ title = "" ,
1670+ subplot_titles = None ,
1671+ ylabel = "" ,
1672+ xlabel = "" ,
1673+ colorbar_label = "" ,
1674+ index_column = "index" ,
1675+ zmin = None ,
1676+ zmax = None ,
1677+ include_annotations = False ,
1678+ base_color_map = None ,
1679+ height = 750 ,
1680+ suffix = "" ,
1681+ filepath = "" ,
1682+ save_inputs = False ,
1683+ graph_id = None ,
1684+ graph_label = "" ,
1685+ graph_about = "" ,
1686+ ):
16861687 # ----
16871688 # Every figure must start with this
16881689 if save_inputs :
@@ -1699,20 +1700,17 @@ def fig_heatmaps(
16991700
17001701 # Create subplots for the heatmaps
17011702 fig = make_subplots (
1702- rows = len (data ), cols = 1 ,
1703+ rows = len (data ),
1704+ cols = 1 ,
17031705 subplot_titles = subplot_titles ,
17041706 vertical_spacing = 0.1 ,
17051707 y_title = ylabel ,
17061708 )
17071709
17081710 if zmin is None :
1709- zmin = min (
1710- data [ii ].drop (columns = index_column ).min ().min ()
1711- for ii in range (len (data )))
1711+ zmin = min (data [ii ].drop (columns = index_column ).min ().min () for ii in range (len (data )))
17121712 if zmax is None :
1713- zmax = max (
1714- data [ii ].drop (columns = index_column ).max ().max ()
1715- for ii in range (len (data )))
1713+ zmax = max (data [ii ].drop (columns = index_column ).max ().max () for ii in range (len (data )))
17161714 if base_color_map is None :
17171715 base_color_map = "viridis"
17181716
@@ -1735,9 +1733,10 @@ def fig_heatmaps(
17351733 zmax = zmax ,
17361734 colorscale = base_color_map ,
17371735 colorbar = ({"title" : colorbar_label } if ii == 0 else None ),
1738- showscale = (True if ii == 0 else False )
1736+ showscale = (True if ii == 0 else False ),
17391737 ),
1740- row = (ii + 1 ), col = 1
1738+ row = (ii + 1 ),
1739+ col = 1 ,
17411740 )
17421741
17431742 # Update layout
@@ -1765,15 +1764,7 @@ def fig_heatmaps(
17651764 return fig , graph_id , graph_label , graph_about
17661765
17671766
1768- def fig_sankey (
1769- data ,
1770- height = 500 ,
1771- suffix = "" ,
1772- filepath = "" ,
1773- save_inputs = False ,
1774- graph_id = "sankey" ,
1775- graph_label = "" ,
1776- graph_about = "" ):
1767+ def fig_sankey (data , height = 500 , suffix = "" , filepath = "" , save_inputs = False , graph_id = "sankey" , graph_label = "" , graph_about = "" ):
17771768 # ----
17781769 # Every figure must start with this
17791770 if save_inputs :
@@ -1789,24 +1780,21 @@ def fig_sankey(
17891780 link = data [1 ].copy ()
17901781 annotations = data [2 ].copy ()
17911782
1792- node_metadata = {
1793- "hovertemplate" : "%{customdata}" ,
1794- "pad" : 15 ,
1795- "thickness" : 20 ,
1796- "line" : {"color" : "black" , "width" : 1.2 }
1797- }
1783+ node_metadata = {"hovertemplate" : "%{customdata}" , "pad" : 15 , "thickness" : 20 , "line" : {"color" : "black" , "width" : 1.2 }}
17981784 link_metadata = {
17991785 "hovertemplate" : "%{source.customdata} to %{target.customdata}" ,
18001786 "line" : {"color" : "rgba(0,0,0,0.3)" , "width" : 0.3 },
18011787 }
18021788
18031789 fig = go .Figure (
1804- data = [go .Sankey (
1805- arrangement = "snap" ,
1806- valueformat = ".0f" ,
1807- node = {** node .to_dict (orient = "list" ), ** node_metadata },
1808- link = {** link .to_dict (orient = "list" ), ** link_metadata },
1809- )],
1790+ data = [
1791+ go .Sankey (
1792+ arrangement = "snap" ,
1793+ valueformat = ".0f" ,
1794+ node = {** node .to_dict (orient = "list" ), ** node_metadata },
1795+ link = {** link .to_dict (orient = "list" ), ** link_metadata },
1796+ )
1797+ ],
18101798 layout = go .Layout (
18111799 annotations = annotations .to_dict (orient = "records" ),
18121800 height = height ,
0 commit comments