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

scatter_and_color_according_to_y problems #1

Open
thorwhalen opened this issue Jan 9, 2021 · 0 comments
Open

scatter_and_color_according_to_y problems #1

thorwhalen opened this issue Jan 9, 2021 · 0 comments
Assignees

Comments

@thorwhalen
Copy link
Member

Problem 1: Warning

from oplot import scatter_and_color_according_to_y
from sklearn.datasets import make_blobs
X, y = make_blobs(n_samples=100, n_features=2, centers=[[0, 0], [100, 100]], cluster_std=[1, 30])
scatter_and_color_according_to_y(X, y)

Leads to warning

.../oplot/oplot/plot_data_set.py:84: UserWarning: LDA cannot be used to produce 2 dimensions if y has less than 3 classes, will use PCA instead
  warnings.warn('LDA cannot be used to produce {} dimensions if y has less than {} classes,'

But plot still renders.

Problem 2: Error

from pyod.utils.data import generate_data
X, y = generate_data(n_train=100, n_features=2, contamination=0.1, train_only=True)
scatter_and_color_according_to_y(X, y)

Leads to error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-80-f8ec2b2f88d6> in <module>
----> 1 scatter_and_color_according_to_y(X, y)

... in scatter_and_color_according_to_y(X, y, col, projection, dim_reduct, save, legend, saving_loc, saving_name, plot_tag_name, super_alpha, cmap_col, *args, **kwargs)
    148         else:
    149             ax.scatter(X[:, 0], X[:, second_index], c=y, alpha=alpha, *args, **kwargs)
--> 150             ax.colorbar()
    151 
    152     if projection == '3d':

AttributeError: 'AxesSubplot' object has no attribute 'colorbar'

But plot still renders (just without colorbar).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants