Skip to content

Fix warnings in examples/neighbors/plot_nca_illustration.py #14117 #14151

Merged
glemaitre merged 10 commits intoscikit-learn:masterfrom
rodneyosodo:examples/neighbors/plot_nca_illustration
Jul 2, 2019
Merged

Fix warnings in examples/neighbors/plot_nca_illustration.py #14117 #14151
glemaitre merged 10 commits intoscikit-learn:masterfrom
rodneyosodo:examples/neighbors/plot_nca_illustration

Conversation

@rodneyosodo
Copy link
Copy Markdown
Contributor

I was able to fix the warnings try transforming the colour argument to an array. It was intially a tuple

The error was

'c' argument looks like a single numeric RGB or RGBA sequence, which should be avoided as value-mapping will have precedence in case its length matches with 'x' & 'y'.  Please use a 2-D array with a single row if you really want to specify the same RGB or RGBA value for all points.

Before the change

2019-06-22

After the change

2019-06-22 (3)

The plotting still remains the same

#WiDSML
@adrinjalali

@adrinjalali
Copy link
Copy Markdown
Member

I think you forgot to create a new branch for this PR. It shows the changes to the other file as well.

@adrinjalali
Copy link
Copy Markdown
Member

you also have failing tests

@rodneyosodo
Copy link
Copy Markdown
Contributor Author

I think you forgot to create a new branch for this PR. It shows the changes to the other file as well.

I had created a different branch the issue was length of the line and whitespaces

@adrinjalali
Copy link
Copy Markdown
Member

It doesn't look like the errors are related to your PR, you can ignore them I think, and just fix the unrelated changes in this PR.

@rodneyosodo
Copy link
Copy Markdown
Contributor Author

It doesn't look like the errors are related to your PR, you can ignore them I think, and just fix the unrelated changes in this PR.

I have fixed the unrelated changes 👍

line = ([pt_i[0], pt_j[0]], [pt_i[1], pt_j[1]])
ax.plot(*line, c=cm.Set1(y[j]),
linewidth=5*thickness[j])
ax.plot(*line, c=cm.Set1(y[j]), linewidth=5*thickness[j])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't use np.array. Why is the change not needed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the y array it accepts without any warnings but for the x one it refuses

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You don't need this change (it is only in scatter plot)

@glemaitre
Copy link
Copy Markdown
Member

I don't get the warning in the last matplotlib version (i.e., 3.1.0)
Which version of matplotlib are you using?

@rodneyosodo
Copy link
Copy Markdown
Contributor Author

I don't get the warning in the last matplotlib version (i.e., 3.1.0)
Which version of matplotlib are you using?

matplotlib 3.1.0
Its apparently the same

@glemaitre
Copy link
Copy Markdown
Member

Oh, I execute the wrong file ;). You are right the warning is there.

@glemaitre glemaitre self-requested a review July 2, 2019 08:18
@glemaitre
Copy link
Copy Markdown
Member

I pushed the fix for older matplotlib version normally

@glemaitre glemaitre merged commit cee79b0 into scikit-learn:master Jul 2, 2019
@glemaitre
Copy link
Copy Markdown
Member

@0x6f736f646f Thanks for your contribution

@rodneyosodo
Copy link
Copy Markdown
Contributor Author

You are welcomed

koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants