- Laura Whiting

# Adding a Second Axis with the Same Equivalent Values as the First

In Stata you can have a second axis, where one is used for bars and one for lines, or something similar. Sometimes however the axes are showing different but equivalent measurements, and you want to show both equally. To do this, you need to word out what the equivalent values for the second axis will be so they match the first axis. For example, you want to show miles per gallon on one axis and kilometres per litre on the other. These are equivalent measurements, so to get the axes to line up you need to make sure that you convert the values for the first axis into their equivalent second axis values. In this case, if you have your mpg axis showing it starting at 10 with increases of 10 up to 40, you then convert this to your second kpl axis. So 10 mpg is equal to 4.25 kpl and 40 mpg is equal to 17 kpl. So your second axis will need to start at 4.25 with increases of 4.25 up to 17. You can apply these axis values using the **ylabel()** graph option.

To generate this graph in Stata, use the following commands: