# Investigating Starfighters with Bar Charts: Function of a Variable

Last time, we went over Bar Charts you could create from Counts of Unique Values. However, sometimes you want to convey more information than just simple counts. For example, you could have a number of parts from different models. The number of occurrences themselves don't offer much value, so you may want a chart displaying the means, sums, or even standard deviations of the different parts. It's this case that we're after when we go to **Graph > Bar Charts > Function of a Variable**.

To illustrate this, I have a small data set investigating starfighters built in the Star Wars galaxy:

We’re interested in two variables: the size of the ship, and how much cargo the ship can hold. We have 6 different models of starfighters built by 3 different corporations. We can use bar charts to compare how these different groups of fighters are being produced.

## Bar Charts with a Function of a Variable

Let’s say we’re interested in which manufacturer builds the largest ships. We have a few different models, and each individual ship will have a slightly different length, so we are interested in the mean length for each. Let’s start at **Graph > Bar Chart**, but this time let’s change our drop-down to function of a variable. Choose Simple with One Y, and enter size as the graph variable and manufacturer as the categorical variable. Make sure that the function is listed as Mean, as we want to know who, on average, builds the largest starfighters. Minitab gives us the following graph:

We can see that Koensayr Manufacturing, who are known for K-Wing and Y-Wing starfighters, comes out on top with the largest size. Sienar Fleet, on the other hand, produce smaller ships. They are mainly known for producing the smaller TIE Fighters.

They key takeaway from this graph is that if you have a number of observations for each category, Minitab Statistical Software will then perform an operation on them to get what is actually plotted.

## Bar Charts with Two Categorical Variables

We can also use more than one categorical variable and either cluster them or stack them. In my last post, I discussed innermost and outermost grouping variables, and we can use that same logic here. If you have two categorical variables, you can just enter them in your dialog consecutively.

If we are interested in not just the size by company, but each model as well, we will enter Company first, followed by Model. We are still interested in the mean, so we will leave that as is.

There is one more step that is important, and it's something to keep an eye on because each corporation produces different ships. This creates an empty space for the nonexistent Incom/TIE/LN Class, for example, as well as numerous others. We want to clean up that space, and we can do that by clicking the Data Options button, sliding over to the Group Options tab, and unchecking ‘Include empty cells.’ This gives us the following graph:

## Using the Stacked Bar Chart

We have one option left, and that is the stacked chart. In addition to size, we are interested in how much cargo each fighter can hold. We want to see how much total cargo each company holds in their fleet. To do this, we can "stack" the cargo capacity for each ship and see who comes out on top. To do that, we can fill out our dialog as follows:

which gives us the following, final graph:

As you are beginning to see, the Bar Chart is a very simple, yet very powerful tool. This allows Minitab to accommodate numerous date setups, and looks. We've already created six completely different charts, and there're still many more options we haven't explored. I'll continue going over these in a future post...