@@ -2830,12 +2830,29 @@ def scatter(
28302830 v_category : str ,
28312831 v_count : str , # vertical axis params
28322832 fig_type : str = None ,
2833- ) -> Optional [list ]:
2834- """Used to create a scatter plot based on selected inputs. The fig_type parameter
2835- is used when the user wants to actually create the visualization; this uses plotly
2836- so any image extension that is supported by plotly is usable here. Currently supports
2837- html, png, jpeg, webp, svg, pdf, and eps. Note that some filetypes may need plotly-orca
2838- installed as well."""
2833+ ) -> Optional [dict ]:
2834+ """
2835+ Required inputs:
2836+ jurisdiction: str,
2837+ for horizontal axis of scatter plot:
2838+ h_election: str, election parameter
2839+ h_category: str, category parameter (e.g., Population by Race or Candidate total)
2840+ h_count: str, count label parameter (e.g., "Black" or "Joseph R. Biden", depending on category)
2841+ for vertical axis of scatter plot (same definitions as for horizontal):
2842+ v_election: str,
2843+ v_category: str,
2844+ v_count: str,
2845+ Optional input:
2846+ fig_type: str = None, an image format string from plotly - as of 8/2021, includes
2847+ html, png, jpeg, webp, svg, pdf, and eps. Note that some filetypes may need
2848+ plotly-orca installed as well.
2849+
2850+ If <fig_type> is given and points for scatter are found, creates a scatter plot
2851+ in the self.reports_and_plots_dir directory with file extension and format determined by fig_type.
2852+
2853+ Returns:
2854+ dict, dictionary of data for creating the scatter plot (including title, axis titles, etc.)
2855+ """
28392856 jurisdiction_id = db .name_to_id (self .session , "ReportingUnit" , jurisdiction )
28402857 subdivision_type = self .major_subdivision_type [jurisdiction ]
28412858 h_election_id = db .name_to_id (self .session , "Election" , h_election )
@@ -2874,7 +2891,7 @@ def bar(
28742891 contest_type : str = None ,
28752892 contest : str = None ,
28762893 fig_type : str = None ,
2877- ) -> list :
2894+ ) -> List [ dict ] :
28782895 """contest_type is an election district type, e.g.,
28792896 state, congressional, state-senate, state-house, territory, etc.
28802897 Complete list is given by the keys of <db.contest_type_mapping>"""
@@ -2917,7 +2934,7 @@ def export_outlier_data(
29172934 election : str ,
29182935 jurisdiction : str ,
29192936 contest : str = None ,
2920- ) -> list :
2937+ ) -> List [ dict ] :
29212938 """contest_type is one of state, congressional, state-senate, state-house"""
29222939 election_id = db .name_to_id (self .session , "Election" , election )
29232940 jurisdiction_id = db .name_to_id (self .session , "ReportingUnit" , jurisdiction )
0 commit comments