@@ -851,136 +851,121 @@ def create_scatterplotmatrix(
851
851
):
852
852
"""
853
853
Returns data for a scatterplot matrix;
854
- **deprecated**,
855
- use instead the plotly.graph_objects trace
856
- :class:`plotly.graph_objects.Splom`.
857
-
858
- :param (array) df: array of the data with column headers
859
- :param (str) index: name of the index column in data array
860
- :param (list|tuple) endpts: takes an increasing sequece of numbers
861
- that defines intervals on the real line. They are used to group
862
- the entries in an index of numbers into their corresponding
863
- interval and therefore can be treated as categorical data
864
- :param (str) diag: sets the chart type for the main diagonal plots.
865
- The options are 'scatter', 'histogram' and 'box'.
866
- :param (int|float) height: sets the height of the chart
867
- :param (int|float) width: sets the width of the chart
868
- :param (float) size: sets the marker size (in px)
869
- :param (str) title: the title label of the scatterplot matrix
870
- :param (str|tuple|list|dict) colormap: either a plotly scale name,
871
- an rgb or hex color, a color tuple, a list of colors or a
872
- dictionary. An rgb color is of the form 'rgb(x, y, z)' where
873
- x, y and z belong to the interval [0, 255] and a color tuple is a
874
- tuple of the form (a, b, c) where a, b and c belong to [0, 1].
875
- If colormap is a list, it must contain valid color types as its
876
- members.
877
- If colormap is a dictionary, all the string entries in
878
- the index column must be a key in colormap. In this case, the
879
- colormap_type is forced to 'cat' or categorical
880
- :param (str) colormap_type: determines how colormap is interpreted.
881
- Valid choices are 'seq' (sequential) and 'cat' (categorical). If
882
- 'seq' is selected, only the first two colors in colormap will be
883
- considered (when colormap is a list) and the index values will be
884
- linearly interpolated between those two colors. This option is
885
- forced if all index values are numeric.
886
- If 'cat' is selected, a color from colormap will be assigned to
887
- each category from index, including the intervals if endpts is
888
- being used
889
- :param (dict) **kwargs: a dictionary of scatterplot arguments
890
- The only forbidden parameters are 'size', 'color' and
891
- 'colorscale' in 'marker'
892
-
854
+ **deprecated**. Use [`plotly.graph_objects.Splom`][plotly.graph_objects.Splom] instead.
855
+
856
+ Parameters
857
+ ----------
858
+ df : array-like
859
+ Array of the data with column headers.
860
+ index : str
861
+ Name of the index column in data array.
862
+ endpts : list or tuple
863
+ Takes an increasing sequence of numbers that defines intervals on the real line.
864
+ They are used to group the entries in an index of numbers into their corresponding
865
+ interval and therefore can be treated as categorical data.
866
+ diag : str
867
+ Sets the chart type for the main diagonal plots. The options are 'scatter', 'histogram' and 'box'.
868
+ height : int or float
869
+ Sets the height of the chart.
870
+ width : int or float
871
+ Sets the width of the chart.
872
+ size : float
873
+ Sets the marker size (in px).
874
+ title : str
875
+ The title label of the scatterplot matrix.
876
+ colormap : str, tuple, list, or dict
877
+ Either a plotly scale name, an rgb or hex color, a color tuple, a list of colors or a dictionary.
878
+ An rgb color is of the form 'rgb(x, y, z)' where x, y and z belong to the interval [0, 255] and a color tuple is a
879
+ tuple of the form (a, b, c) where a, b and c belong to [0, 1]. If colormap is a list, it must contain valid color types as its
880
+ members. If colormap is a dictionary, all the string entries in the index column must be a key in colormap. In this case, the
881
+ colormap_type is forced to 'cat' or categorical.
882
+ colormap_type : str
883
+ Determines how colormap is interpreted. Valid choices are 'seq' (sequential) and 'cat' (categorical). If
884
+ 'seq' is selected, only the first two colors in colormap will be considered (when colormap is a list) and the index values will be
885
+ linearly interpolated between those two colors. This option is forced if all index values are numeric.
886
+ If 'cat' is selected, a color from colormap will be assigned to each category from index, including the intervals if endpts is
887
+ being used.
888
+ **kwargs : dict
889
+ A dictionary of scatterplot arguments. The only forbidden parameters are 'size', 'color' and
890
+ 'colorscale' in 'marker'.
891
+
892
+ Returns
893
+ -------
894
+ plotly.graph_objs._figure.Figure
895
+ A Plotly figure object representing the scatterplot matrix.
896
+
897
+ Examples
898
+ --------
893
899
Example 1: Vanilla Scatterplot Matrix
894
900
895
901
>>> from plotly.graph_objs import graph_objs
896
902
>>> from plotly.figure_factory import create_scatterplotmatrix
897
-
898
903
>>> import numpy as np
899
904
>>> import pandas as pd
900
-
901
905
>>> # Create dataframe
902
906
>>> df = pd.DataFrame(np.random.randn(10, 2),
903
907
... columns=['Column 1', 'Column 2'])
904
-
905
908
>>> # Create scatterplot matrix
906
909
>>> fig = create_scatterplotmatrix(df)
907
910
>>> fig.show()
908
911
909
-
910
912
Example 2: Indexing a Column
911
913
912
914
>>> from plotly.graph_objs import graph_objs
913
915
>>> from plotly.figure_factory import create_scatterplotmatrix
914
-
915
916
>>> import numpy as np
916
917
>>> import pandas as pd
917
-
918
918
>>> # Create dataframe with index
919
919
>>> df = pd.DataFrame(np.random.randn(10, 2),
920
920
... columns=['A', 'B'])
921
-
922
921
>>> # Add another column of strings to the dataframe
923
922
>>> df['Fruit'] = pd.Series(['apple', 'apple', 'grape', 'apple', 'apple',
924
923
... 'grape', 'pear', 'pear', 'apple', 'pear'])
925
-
926
924
>>> # Create scatterplot matrix
927
925
>>> fig = create_scatterplotmatrix(df, index='Fruit', size=10)
928
926
>>> fig.show()
929
927
930
-
931
928
Example 3: Styling the Diagonal Subplots
932
929
933
930
>>> from plotly.graph_objs import graph_objs
934
931
>>> from plotly.figure_factory import create_scatterplotmatrix
935
-
936
932
>>> import numpy as np
937
933
>>> import pandas as pd
938
-
939
934
>>> # Create dataframe with index
940
935
>>> df = pd.DataFrame(np.random.randn(10, 4),
941
936
... columns=['A', 'B', 'C', 'D'])
942
-
943
937
>>> # Add another column of strings to the dataframe
944
938
>>> df['Fruit'] = pd.Series(['apple', 'apple', 'grape', 'apple', 'apple',
945
939
... 'grape', 'pear', 'pear', 'apple', 'pear'])
946
-
947
940
>>> # Create scatterplot matrix
948
941
>>> fig = create_scatterplotmatrix(df, diag='box', index='Fruit', height=1000,
949
942
... width=1000)
950
943
>>> fig.show()
951
944
952
-
953
945
Example 4: Use a Theme to Style the Subplots
954
946
955
947
>>> from plotly.graph_objs import graph_objs
956
948
>>> from plotly.figure_factory import create_scatterplotmatrix
957
-
958
949
>>> import numpy as np
959
950
>>> import pandas as pd
960
-
961
951
>>> # Create dataframe with random data
962
952
>>> df = pd.DataFrame(np.random.randn(100, 3),
963
953
... columns=['A', 'B', 'C'])
964
-
965
954
>>> # Create scatterplot matrix using a built-in
966
955
>>> # Plotly palette scale and indexing column 'A'
967
956
>>> fig = create_scatterplotmatrix(df, diag='histogram', index='A',
968
957
... colormap='Blues', height=800, width=800)
969
958
>>> fig.show()
970
959
971
-
972
960
Example 5: Example 4 with Interval Factoring
973
961
974
962
>>> from plotly.graph_objs import graph_objs
975
963
>>> from plotly.figure_factory import create_scatterplotmatrix
976
-
977
964
>>> import numpy as np
978
965
>>> import pandas as pd
979
-
980
966
>>> # Create dataframe with random data
981
967
>>> df = pd.DataFrame(np.random.randn(100, 3),
982
968
... columns=['A', 'B', 'C'])
983
-
984
969
>>> # Create scatterplot matrix using a list of 2 rgb tuples
985
970
>>> # and endpoints at -1, 0 and 1
986
971
>>> fig = create_scatterplotmatrix(df, diag='histogram', index='A',
@@ -990,30 +975,24 @@ def create_scatterplotmatrix(
990
975
... endpts=[-1, 0, 1], height=800, width=800)
991
976
>>> fig.show()
992
977
993
-
994
978
Example 6: Using the colormap as a Dictionary
995
979
996
980
>>> from plotly.graph_objs import graph_objs
997
981
>>> from plotly.figure_factory import create_scatterplotmatrix
998
-
999
982
>>> import numpy as np
1000
983
>>> import pandas as pd
1001
984
>>> import random
1002
-
1003
985
>>> # Create dataframe with random data
1004
986
>>> df = pd.DataFrame(np.random.randn(100, 3),
1005
987
... columns=['Column A',
1006
988
... 'Column B',
1007
989
... 'Column C'])
1008
-
1009
990
>>> # Add new color column to dataframe
1010
991
>>> new_column = []
1011
992
>>> strange_colors = ['turquoise', 'limegreen', 'goldenrod']
1012
-
1013
993
>>> for j in range(100):
1014
994
... new_column.append(random.choice(strange_colors))
1015
995
>>> df['Colors'] = pd.Series(new_column, index=df.index)
1016
-
1017
996
>>> # Create scatterplot matrix using a dictionary of hex color values
1018
997
>>> # which correspond to actual color names in 'Colors' column
1019
998
>>> fig = create_scatterplotmatrix(
0 commit comments