1

I have to plot two values as a histogram using python.

 File=[1,2,3] 
 File1=[3,4,5,6] 
 files=len(File) 
 files1=len(File1)

I want to plot the length of the files. files and files1 should be on the x-axis and the y-axis needs to have the count like 0, 10, 20 ....

Below is an example diagram. Example bar plot

2
  • Perhaps you could describe the result you want a little more fully? Commented Jan 5, 2016 at 10:08
  • I do not understand the question, please elaborate Commented Jan 5, 2016 at 10:09

1 Answer 1

1

I guess you want a bar plot like this:

import matplotlib.pyplot as plt

plt.bar([0, 1], [files, files1])
plt.show()

Check out the matplotlib examples if you want to find out how to format and change labels, axis limits, etc.

results

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @kazemakase. But i need a bar like what i have mentioned in sample picture. Could you please give me an idea how to get that?
@sara what exactly do you mean? There are two bars, one is 3 units high, the other 4 - just like in your example. Everything else is just a matter of formatting the axis range and the tick labels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.