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

Plot chapter 2 not working #142

Closed
daledet opened this issue Dec 10, 2020 · 8 comments
Closed

Plot chapter 2 not working #142

daledet opened this issue Dec 10, 2020 · 8 comments

Comments

@daledet
Copy link

daledet commented Dec 10, 2020

From Chapter 2 P.35 - Should the following code be nested under the function or under the for loop?

    plot_decision_regions(X, y, classifier=ppn)
    plt.xlabel('sepal length [cm]')
    plt.ylabel('petal length [cm]')
    plt.legend(loc='upper left')
    plt.show()

I have tried both, and the plot does not show up either way.

@rasbt
Copy link
Owner

rasbt commented Dec 10, 2020

From Chapter 2 P.35 - Should the following code be nested under the function or under the for loop?

No, like you typed it should be fine.

Screen Shot 2020-12-10 at 9 22 27 AM

Can you check if something simple like

import matplotlib.pyplot as plt

plt.show([1, 2], [3, 4])

shows a plot?

@daledet
Copy link
Author

daledet commented Dec 10, 2020

I just checked, and no that code is not showing a plot.

@rasbt
Copy link
Owner

rasbt commented Dec 10, 2020

That might be some general matplotlib configuration issue then. I recommend debugging that first. It will likely solve the other problem then

@daledet
Copy link
Author

daledet commented Dec 10, 2020

OK thanks.
With the other issue. I have the Perceptron class in my code, but it is not working.

@daledet
Copy link
Author

daledet commented Dec 10, 2020

None of this is working.
I hate Jupyter notebooks with every fiber of my being.

@rasbt
Copy link
Owner

rasbt commented Dec 10, 2020

Maybe you added the Percpetron class code but didn't execute it?

If things get out of hand, I recommend restartign the notebook and executing all cells
Screen Shot 2020-12-10 at 9 58 09 AM

If you are on older jupyter notebook and/or matpltotlib versions, adding and executing

%matplotlib inline

in a cell on top of the notebook may help with showing the plots.

@daledet
Copy link
Author

daledet commented Dec 11, 2020

My word! Restart Kernal and Run All Cells is the elixir of life! It is the life force that fuels the dreams of champions!
A decent nap followed by a strong cuppa joe is pretty helpful too. Thanks for guiding me past this first major JN hurdle!

@daledet daledet closed this as completed Dec 11, 2020
@rasbt
Copy link
Owner

rasbt commented Dec 11, 2020

Nice. Glad it solved the issue

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