-2

i'm newbie in python but i don't know how to solve this problem

I need an histogram in my code. I use this:

import matplotlib.pyplot as plt
plt.hist(datos["Ozone"], bins=10)

Note: datos is a dataframe.

I tested with other more basic examples, but never show the graph of the histogram. I think is a problem with the Console, but i don't know how solve the problem.

0

1 Answer 1

1

You have to write:

plt.show()

at the end to see your plot.

EDIT: In case you are using jupyter notebooks, there is no need for plt.show(). You can just add two lines of code as follows:

import matplotlib.pyplot as plt
%matplotlib qt
%matplotlib inline
plt.hist(datos["Ozone"], bins=10)
Sign up to request clarification or add additional context in comments.

3 Comments

Hello, i tried that and says: UsageError: unrecognized arguments: # keeps it within the notebook
%matplotlib qt # displays a pop-up of the plot %matplotlib inline # keeps it within the notebook
Great! I have also added it under EDIT in the main answer. Happy coding! :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.