Quick P2CPs#
- hiveplotlib.p2cp_n_axes(data: DataFrame, indices: List[int] | List[List[int]] | List[ndarray] | str = 'all', split_on: Hashable | List[Hashable] | None = None, axes: List[Hashable] | None = None, vmins: List[float | None] | None = None, vmaxes: List[float | None] | None = None, orient_angle: float = 0, all_edge_kwargs: Dict | None = None, indices_list_kwargs: List[Dict | None] | None = None) P2CP#
Generate a
P2CPinstance with an arbitrary number of axes for an arbitrary dataframe.Can specify a desired subset of column names, each of which will become an axis in the resulting P2CP. Default grabs all columns in the dataframe, unless
split_onis a column name, in which case that specified column will be excluded from the list of axes in the finalP2CPinstance. Note, repeat axes (e.g. repeated column names) are allowed here.Axes will be added in counterclockwise order. Axes will all be the same length and position from the origin.
In deciding what edges of
dataget drawn (and how they get drawn), the user has several options. The default behavior plots all data points indatawith the same keyword arguments. If one instead wanted to plot a subset of data points, one can provide alistof a subset of indices from the dataframe to theindicesparameter.If one wants to plot multiple sets of edges in different styles, there are two means of doing this. The more automated means is to split on the unique values of a column in the provided
data. By specifying a column name to thesplit_onparameter, data will be added in chunks according to the unique values of the specified column. If one instead includes a list of values corresponding to the records indata, data will be added according to the unique values of this provided list. Each subset ofdatacorresponding to a unique column value will be given a separate tag, with the tag being the unique column value. Note, however, this only works whenindices="all". If one prefers to split indices manually, one can instead provide a list of lists to theindicesparameter, allowing for arbitrary splitting of the data. Regardless of how one chooses to split the data, one can then assign different keyword arguments to each subset of data.Changes to all the edge kwargs can be affected with the
all_edge_kwargsparameter. If providing multiple sets of edges though in one of the ways discussed above, one can also provide unique kwargs for each set of edges by specifying a correspondinglistof dictionaries of kwargs with theindices_list_kwargsparameter.Specific edge kwargs can also be changed later by running the
add_edge_kwargs()method on the returnedP2CPinstance. If one only added a single set of indices (e.g.indices="all"orindiceswas provided as a flat list of index values), then this method can simply be called with kwargs. However, if multiple subsets of edges were specified, then one will need to be precise about whichtagof edge kwargs to change. If multiple sets were provided via theindicesparameter, then the resultingtagfor each subset will correspond to the index value in the list of lists inindices. If insteadsplit_on_columnwas specified as notNone, then tags will be the unique values in the specified column / list of values. Regardless of splitting methodology, existing tags can be found under the returnedP2CP.tags.There is a hierarchy to these kwarg arguments. That is, if redundant / overlapping kwargs are provided for different kwarg parameters, a warning will be raised and priority will be given according to the below hierarchy:
indices_list_kwargs>all_edge_kwargs.- Parameters:
data – dataframe to add.
indices –
listof index values from the index of the added dataframedata. Default “all” creates edges for every row indata, but alistinput creates edges for only the specified subset. Alternatively, one can provide a list of lists of indices, which will allow for plotting different sets of edges with different kwargs. These subsets will be added to the resultingP2CPinstance with tags corresponding to the index value inindices.split_on – column name from
dataor list of values corresponding to the records ofdata. If specified as notNone, the resultingP2CPinstance will split data according to unique values with respect to the column ofdata/ the list of provided values, with each subset of data given a tag of the unique value corresponding to each subset. When specifying a column indata, this column will be excluded from consideration ifaxesisNone. Note: this subsetting can only be run whenindices="all". DefaultNoneplots all the records indatawith the same line kwargs.axes – list of
Hashablecolumn names indata. Each column name will be assigned to a separate axis in the resultingP2CPinstance, built out in counterclockwise order. DefaultNonegrabs all columns in the dataframe, unlesssplit_onis a column name, in which case that specified column will be excluded from the list of axes in the finalP2CPinstance. Note, repeat axes (e.g. repeated column names) are allowed here.vmins – list of
floatvalues (orNonevalues) specifying the vmin for each axis, where the ith index value corresponds to the ith index axis inaxes(e.g. the ith axis of the resultingP2CPinstance). ANonevalue infers the global min for that axis. DefaultNoneuses the global min for all the axes.vmaxes – list of
floatvalues (orNonevalues) specifying the vmax for each axis, where the ith index value corresponds to the ith index axis inaxes(e.g. the ith axis of the resultingP2CPinstance). ANonevalue infers the global max for that axis. DefaultNoneuses the global max for all the axes.orient_angle – rotates all axes counterclockwise from their initial angles (default 0 degrees).
all_edge_kwargs – kwargs for all edges. Default
Nonespecifies no additional kwargs.indices_list_kwargs – list of dictionaries of kwargs for each element of
indiceswhenindicesis a list of lists orsplit_onis notNone. The ith set of kwargs inindices_list_kwargswill only be applied to index values corresponding to the ith list inindicesor to index values which have the ith unique value in a sorted list of unique values insplit_on. DefaultNoneprovides no additional kwargs. Note, this list must be same length asindicesor the same number of values as the number of unique values insplit_on.
- Returns:
P2CPinstance.