# Are histograms related to bar charts?

### Question

Are histograms related to bar charts?

Although they appear somewhat similar, histograms and bar charts are different and serve specific purposes.

#### Histogram

Histograms are used for graphing a distribution of frequencies, for quantitative data.

Visually, all the bars are usually touching, with no space between them.

The bars represent the amount of values in the dataset that fall between each ‘bin’ or range of values. For example, each bin might show the number of people within certain age ranges (10-20, 20-30, …).

#### Bar chart

Bar charts are used to group data based on categories.

Visually, these are usually spaced apart.

Each bar represents how much of the data falls into a category. For example, a bar chart might show how many students there are per major in a university, where each major is a “category”.

4 Likes

Hello there,
I couldn’t understand this question: `How many values in the data set are equal to either 5 or 6?`
Please explain, along with the examples and their solution.

1 Like

I didn’t understand that either… i think it was 1 sample 5 or 6 because only value 5 has 5 samples. I dont get it.
So, I reviewed it, I think it means how many samples are in der 5 and 6 value range. So if you add the samples you’ll get the answer. Am I right?

Do you have a link to the lesson?

I’d interpret this as meaning something like a count of how many times any value in the dataset had a value of value = 5 or value = 6 for every value in the dataset. In code form something like `sum(value == 5 or value == 6 for value in dataset)` which relies on the value of `True` being 1.

That might not be too helpful depending on the context though, would need to see the lesson to be sure.

I think it is about the sum of the samples with value of 5 AND 6.

2 Likes

Ah yeah, I’ve got it:

Look at the histogram to the right. How many values in the data set are equal to either 5 or 6?

It does state `OR` though so you can simply add up the “Number of samples” (the y-axis count) for both values `5` and `6` (on the x-axis) for the second histogram on the RHS of the page.

So if we find `values == 5` on the x-axis we can see that a total of 5 samples have this value. Then we look up `values == 6` on the x-axis and we can see that there a total of 2 samples with this value.

This makes a grand total of 7 samples with a value of either `5` or `6`.

I hope that makes sense to you . If not please say so.

2 Likes