@@ -672,68 +672,66 @@ def create_facet_grid(
672
672
):
673
673
"""
674
674
Returns figure for facet grid; **this function is deprecated**, since
675
- plotly.express functions should be used instead, for example
676
-
677
- >>> import plotly.express as px
678
- >>> tips = px.data.tips()
679
- >>> fig = px.scatter(tips,
680
- ... x='total_bill',
681
- ... y='tip',
682
- ... facet_row='sex',
683
- ... facet_col='smoker',
684
- ... color='size')
685
-
686
-
687
- :param (pd.DataFrame) df: the dataframe of columns for the facet grid.
688
- :param (str) x: the name of the dataframe column for the x axis data.
689
- :param (str) y: the name of the dataframe column for the y axis data.
690
- :param (str) facet_row: the name of the dataframe column that is used to
691
- facet the grid into row panels.
692
- :param (str) facet_col: the name of the dataframe column that is used to
693
- facet the grid into column panels.
694
- :param (str) color_name: the name of your dataframe column that will
695
- function as the colormap variable.
696
- :param (str|list|dict) colormap: the param that determines how the
697
- color_name column colors the data. If the dataframe contains numeric
698
- data, then a dictionary of colors will group the data categorically
699
- while a Plotly Colorscale name or a custom colorscale will treat it
700
- numerically. To learn more about colors and types of colormap, run
701
- `help(plotly.colors)`.
702
- :param (bool) color_is_cat: determines whether a numerical column for the
703
- colormap will be treated as categorical (True) or sequential (False).
704
- Default = False.
705
- :param (str|dict) facet_row_labels: set to either 'name' or a dictionary
706
- of all the unique values in the faceting row mapped to some text to
707
- show up in the label annotations. If None, labeling works like usual.
708
- :param (str|dict) facet_col_labels: set to either 'name' or a dictionary
709
- of all the values in the faceting row mapped to some text to show up
675
+ plotly.express functions should be used instead.
676
+
677
+ Parameters
678
+ ----------
679
+ df : pd.DataFrame
680
+ The dataframe of columns for the facet grid.
681
+ x : str
682
+ The name of the dataframe column for the x axis data.
683
+ y : str
684
+ The name of the dataframe column for the y axis data.
685
+ facet_row : str
686
+ The name of the dataframe column that is used to facet the grid into row panels.
687
+ facet_col : str
688
+ The name of the dataframe column that is used to facet the grid into column panels.
689
+ color_name : str
690
+ The name of your dataframe column that will function as the colormap variable.
691
+ colormap : str, list, or dict
692
+ The parameter that determines how the color_name column colors the data. If the dataframe contains numeric
693
+ data, then a dictionary of colors will group the data categorically while a Plotly Colorscale name or a custom
694
+ colorscale will treat it numerically. To learn more about colors and types of colormap, run `help(plotly.colors)`.
695
+ color_is_cat : bool
696
+ Determines whether a numerical column for the colormap will be treated as categorical (True) or sequential (False).
697
+ Default is False.
698
+ facet_row_labels : str or dict
699
+ Set to either 'name' or a dictionary of all the unique values in the faceting row mapped to some text to show up
710
700
in the label annotations. If None, labeling works like usual.
711
- :param (int) height: the height of the facet grid figure.
712
- :param (int) width: the width of the facet grid figure.
713
- :param (str) trace_type: decides the type of plot to appear in the
714
- facet grid. The options are 'scatter', 'scattergl', 'histogram',
715
- 'bar', and 'box'.
716
- Default = 'scatter'.
717
- :param (str) scales: determines if axes have fixed ranges or not. Valid
718
- settings are 'fixed' (all axes fixed), 'free_x' (x axis free only),
701
+ facet_col_labels : str or dict
702
+ Set to either 'name' or a dictionary of all the values in the faceting row mapped to some text to show up
703
+ in the label annotations. If None, labeling works like usual.
704
+ height : int
705
+ The height of the facet grid figure.
706
+ width : int
707
+ The width of the facet grid figure.
708
+ trace_type : str
709
+ Decides the type of plot to appear in the facet grid. The options are 'scatter', 'scattergl', 'histogram',
710
+ 'bar', and 'box'. Default is 'scatter'.
711
+ scales : str
712
+ Determines if axes have fixed ranges or not. Valid settings are 'fixed' (all axes fixed), 'free_x' (x axis free only),
719
713
'free_y' (y axis free only) or 'free' (both axes free).
720
- :param (float) dtick_x: determines the distance between each tick on the
721
- x-axis. Default is None which means dtick_x is set automatically.
722
- :param (float) dtick_y: determines the distance between each tick on the
723
- y-axis. Default is None which means dtick_y is set automatically.
724
- :param (bool) show_boxes: draws grey boxes behind the facet titles.
725
- :param (bool) ggplot2: draws the facet grid in the style of `ggplot2`. See
726
- http://ggplot2.tidyverse.org/reference/facet_grid.html for reference.
727
- Default = False
728
- :param (int) binsize: groups all data into bins of a given length.
729
- :param (dict) kwargs: a dictionary of scatterplot arguments.
730
-
731
- Examples 1: One Way Faceting
714
+ dtick_x : float
715
+ Determines the distance between each tick on the x-axis. Default is None which means dtick_x is set automatically.
716
+ dtick_y : float
717
+ Determines the distance between each tick on the y-axis. Default is None which means dtick_y is set automatically.
718
+ show_boxes : bool
719
+ Draws grey boxes behind the facet titles.
720
+ ggplot2 : bool
721
+ Draws the facet grid in the style of `ggplot2`. See http://ggplot2.tidyverse.org/reference/facet_grid.html for reference.
722
+ Default is False.
723
+ binsize : int
724
+ Groups all data into bins of a given length.
725
+ **kwargs : dict
726
+ A dictionary of scatterplot arguments.
727
+
728
+ Examples
729
+ --------
730
+ Example 1: One Way Faceting
732
731
733
732
>>> import plotly.figure_factory as ff
734
733
>>> import pandas as pd
735
734
>>> mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
736
-
737
735
>>> fig = ff.create_facet_grid(
738
736
... mpg,
739
737
... x='displ',
@@ -745,11 +743,8 @@ def create_facet_grid(
745
743
Example 2: Two Way Faceting
746
744
747
745
>>> import plotly.figure_factory as ff
748
-
749
746
>>> import pandas as pd
750
-
751
747
>>> mpg = pd.read_table('https://raw.githubusercontent.com/plotly/datasets/master/mpg_2017.txt')
752
-
753
748
>>> fig = ff.create_facet_grid(
754
749
... mpg,
755
750
... x='displ',
@@ -775,7 +770,10 @@ def create_facet_grid(
775
770
... )
776
771
>>> fig.show()
777
772
778
-
773
+ Returns
774
+ -------
775
+ plotly.graph_objs._figure.Figure
776
+ A Plotly figure object representing the facet grid.
779
777
"""
780
778
if not pd :
781
779
raise ImportError ("'pandas' must be installed for this figure_factory." )
0 commit comments