Skip to content

scatter_and_color_according_to_y problems #1

Description

@thorwhalen

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions