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

Fixing Plotting Bug #655

Merged
merged 5 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 14 additions & 4 deletions verticapy/core/vdataframe/_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ def bar(
"""
columns = format_type(columns, dtype=list)
columns, of = self.format_colnames(columns, of, expected_nb_of_cols=[1, 2])
if not (isinstance(max_cardinality, Iterable)):
max_cardinality = (max_cardinality, max_cardinality)
if not (isinstance(h, Iterable)):
h = (h, h)

if len(columns) == 1:
return self[columns[0]].bar(
method=method,
Expand Down Expand Up @@ -282,6 +287,11 @@ def barh(
"""
columns = format_type(columns, dtype=list)
columns, of = self.format_colnames(columns, of, expected_nb_of_cols=[1, 2])
if not (isinstance(max_cardinality, Iterable)):
max_cardinality = (max_cardinality, max_cardinality)
if not (isinstance(h, Iterable)):
h = (h, h)

if len(columns) == 1:
return self[columns[0]].barh(
method=method,
Expand Down Expand Up @@ -413,10 +423,6 @@ def hist(
AVG(column1) + 5
of: str, optional
The vDataColumn used to compute the aggregation.
max_cardinality: tuple, optional
Maximum number of distinct elements for vDataColumns
to be used as categorical. For these elements, no
h is picked or computed.
h: tuple, optional
Interval width of the input vDataColumns. Optimized
h will be computed if the parameter is empty or
Expand Down Expand Up @@ -1793,6 +1799,10 @@ def hist(
to be used as categorical.
The less frequent elements are gathered together
to create a new category : 'Others'.
This parameter is used to discretize the vDataColumn
'by' when the main input nvDataColumn is nnumerical.
Otherwise, it is used to discretize all the
vDataColumn inputs.
cat_priority: PythonScalar / ArrayLike, optional
ArrayLike list of the different categories to consider
when drawing the box plot. The other categories are
Expand Down
7 changes: 5 additions & 2 deletions verticapy/plotting/_highcharts/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def _init_style(self) -> None:
y_label = ""
if isinstance(self.layout["y_labels"], list):
y_labels = copy.deepcopy(self.layout["y_labels"])
y_labels.reverse()
else:
y_labels = self.layout["y_labels"]
self.init_style = {
Expand Down Expand Up @@ -165,7 +164,11 @@ def draw(self, chart: Optional[HChart] = None, **style_kwargs) -> HChart:
data = []
for i in range(len(self.layout["x_labels"])):
for j in range(len(self.layout["y_labels"])):
data += [[i, j, round(X[i, j], self.layout["mround"])]]
if "mround" in self.layout:
Xij = round(X[i, j], self.layout["mround"])
else:
Xij = X[i, j]
data += [[i, j, Xij]]
chart.add_data_set(data, **self.init_style_matrix)
chart.set_dict_options(
{"colorAxis": self._get_cmap_style(style_kwargs=style_kwargs)}
Expand Down