Professional Documents
Culture Documents
32-VBA String Operators
32-VBA String Operators
A picture, so they say, will tell a thousand words. But what about a
graph or chart?
This page sets out some of the basics behind drawing and creating good graphs
and charts. By ‘good’, we mean ones that show what you want them to show, and
don’t mislead the reader.
Types of Charts
There are several di erent types of charts and graphs. The four most common are
probably line graphs, bar graphs and histograms, pie charts, and Cartesian graphs.
They are generally used for, and best for, quite di erent things.
Bar graphs to show numbers that are independent of each other. Example data might include
things like the number of people who preferred each of Chinese takeaways, Indian takeaways
and sh and chips.
Pie charts to show you how a whole is divided into di erent parts. You might, for example,
want to show how a budget had been spent on di erent items in a particular year.
Line graphs show you how numbers have changed over time. They are used when you have
data that are connected, and to show trends, for example, average night time temperature in
each month of the year.
Cartesian graphs have numbers on both axes, which therefore allow you to show how changes
in one thing a ect another. These are widely used in mathematics, and particularly in Algebra.
TOP
Axes
Graphs have two axes, the lines that run across the bottom and up the side. The line along the
bottom is called the horizontal or x-axis, and the line up the side is called the vertical or y-axis.
The x-axis may contain categories or numbers. You read it from the bottom left of the graph.
The y-axis usually contains numbers, again starting from the bottom left of the graph.
The numbers on the y-axis generally, but not always, start at 0 in the bottom left of the graph, and
move upwards. Usually the axes of a graph are labelled to indicate the type of data they show.
Beware of graphs where the y-axis doesn't start at 0, as they may be trying to fool you about the
data shown (and there is more about this in our page on Everyday Mathematics).
Some Data
Category 1 4.1
Category 2 2.5
Category 3 3.5
Category 4 4.7
You can see immediately that this graph gives you a clear picture of which
category is largest and which is smallest.
You can also use the graph to read o information about how many are in each category without
having to refer back to the data table, which may or may not be provided with every graph you see.
In general, you can draw bar graphs with the bars either horizontal or vertical, because it doesn’t
make any di erence. The bars do not touch.
A histogram is a speci c type of bar chart, where the categories are ranges of numbers.
Histograms therefore show combined continuous data.
You can choose to group them into ten-year age categories, 0–10, 11–20,
21–30 and so on:
Number
Age of
people
0-10 2
11-20 5
21-30 7
31-40 8
41-50 4
51-60 3
Pie Charts
A pie chart looks like a circle (or a pie) cut up into segments. Pie
charts are used to show how the whole breaks down into parts.
For example, this data shows the sales gures for a year, broken down by
quarters:
Quarterly Sales Figures 1st Qtr 2nd Qtr 3rd Qtr 4th Qtr
From the pie chart you can see immediately that sales in Quarter 1 were much bigger than all the
others: more than 50% of total annual sales.
Without knowing anything more about this business, you might be concerned about the way that
sales appeared to have dropped over the year.
The total sales in the year have to have occurred in one quarter or another. If you’ve got the gures
wrong, and Q1 should be smaller, one of the other quarters will have sales added to compensate,
assuming that you haven’t made a mistake with the total.
Pie charts show percentages of a whole - your total is therefore 100% and the segments of the pie
chart are proportionally sized to represent the percentage of the total. For more on percentages see
our page: Introduction to Percentages.
Usually it is not appropriate to use pie charts for more than 5 or 6 di erent categories. Lots of
segments are di cult to visualise and such data may be better displayed on a di erent type of
chart or graph.
Line Graphs
Line graphs are usually used to show dependent data, and
particularly trends over time.
Line graphs depict a point value for each category, which are joined in a line. We can use the data
from the pie chart as a line graph too.
You can see even more obviously that sales have fallen rapidly over the year, although the slow-
down is levelling out at the end of the year. Line graphs are particularly useful for identifying the
point in time at which a certain level of sales, revenue (or whatever the y value represents) was
reached.
In the example above, suppose we want to know during which quarter sales rst fell below 5. We
can draw a line across from 5 on the y-axis (red line on the example), and see that it was during
quarter 2.
Cartesian Graphs
Cartesian graphs are what mathematicians really mean when they talk about graphs. They compare
two sets of numbers, one of which is plotted on the x-axis and one on the y-axis. The numbers can
be written as Cartesian coordinates, which look like (x,y), where x is the number read from the x-
axis, and y the number from the y-axis.
Warning!
We can solve this by drawing two lines, one of John’s age compared with
Mary’s, and one of the ages that add together to give 12.
Mary's Age 1 2 3 4 5 6 7 8 9
John's Age
3 4 5 6 7 8 9 10 11
(=Mary + 2)
Line 2: John’s age when Mary is di erent ages between 1 and 9 if their
ages add up to 12
Mary's Age 1 2 3 4 5 6 7 8 9
John's Age
11 10 9 8 7 6 5 4 3
(=12 - Mary's Age)
Plotting the two lines on graph, with Mary’s age as the x-axis, you can see
that there is a point at which the lines cross. This is the only point at
which a) John is two years older than Mary and b) their ages add up to 12.
This must be their current ages, which are therefore 5 for Mary and 7 for
John.
For more about the uses of Cartesian graphs to solve problems in maths, take a
look at our pages on Simple Equations and More Complicated Equations.
However, be aware that these applications are somewhat limited in the type of charts that they can
draw, and you may not nd the results entirely what you expected! You really need a basic
understanding of graphs and charts so that you can compare what the computer has created to
what you want to show.
Computer applications also make it easy to produce overly complicated graphs. A 3D exploding pie
chart may look 'cool' but does it help you or others to visualise the data? It is often best to keep
graphs and charts simple with neat, clear formatting.
A Graph is Worth…
Whatever way you choose to draw your graphs, once you have the knack of
reading them, you will almost certainly nd that the old saying is right: a picture
really can tell a thousand words.
Whether a graph is worth a thousand numbers is a moot point, but it is certainly an e ective way of
showing several numbers together, and demonstrating the relationships or di erences between
them.