Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallexaxis doc #249

Merged
merged 8 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions ema_workbench/analysis/parcoords.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,29 @@ class ParallelAxes:
rot : float, optional
rotation of axis labels

Attributes
----------
limits : DataFrame
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a description of limits

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the description from the parameters part

A DataFrame specifying the limits for each dimension in the
data set. For categorical data, the first cell should contain all
categories.
recoding : dict
non numeric columns are converting to integer variables
flipped_axes : set
set of Axes that are to be shown flipped
axis_labels : list of str
fontsize : int
fig : a matplotlib Figure instance
axes : list of matplotlib Axes instances
ticklabels : list of str
datalabels : list of str
labels associated with lines

Notes
-----
The basic setup of the Parallel Axis plot is a row of mpl Axes instances, with all whitespace
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this line have a header, since from here class methods are discussed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved it into Notes which is the proper place for implementation details

in between removed. The number of Axes is the number of columns - 1.

"""

def __init__(self, limits, formatter=None, fontsize=14, rot=90):
Expand All @@ -155,7 +178,6 @@ def __init__(self, limits, formatter=None, fontsize=14, rot=90):
formatter : dict, optional
specify precision formatters for minima and maxima,
defaults to .2f

fontsize : int, optional
fontsize for defaults text items
rot : float, optional
Expand All @@ -175,8 +197,8 @@ def __init__(self, limits, formatter=None, fontsize=14, rot=90):
self.recoding[column] = CategoricalDtype(categories=cats, ordered=False)
self.limits.loc[:, column] = [0, len(cats) - 1]

self.normalizer = preprocessing.MinMaxScaler()
self.normalizer.fit(self.limits)
self._normalizer = preprocessing.MinMaxScaler()
self._normalizer.fit(self.limits)

fig, axes, ticklabels = setup_parallel_plot(
self.axis_labels,
Expand Down Expand Up @@ -231,7 +253,7 @@ def plot(self, data, color=None, label=None, **kwargs):
recoded[key] = data[key].astype(value).cat.codes

# normalize the data
normalized_data = pd.DataFrame(self.normalizer.transform(recoded), columns=recoded.columns)
normalized_data = pd.DataFrame(self._normalizer.transform(recoded), columns=recoded.columns)

# plot the data
self._plot(normalized_data, color=color, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}