Excel – How to tell Excel to plot one column on x axis and another column on vertical axis

chartsmicrosoft excel

I intend to plot y=cos(cX) in Excel, where c is a constant produced in first cell of column C using RANDBETWEEN(-50,50). Column 'A' represents X values (from -100 to 123) and column B contains f(x) values generated using the function f(x)=cos(cX).

Then I select columns A and B and hit insert chart (2D line chart), which gives the following plot:

enter image description here

This is not What I wanted. I want X values to be plotted on horizontal axis and Y values to be plotted on the vertical axis. Here, it is inverse. How can I make it show the way I want?

Best Answer

It looks only scatter type graphs can be used to best plot x-y pairs. For the graph in the above question, I removed the 2D line chart and then selected to insert a scatter chart with smooth lines, as follows:
enter image description here

The newly inserted chart is empty. To select which data it is to plot, I clicked "Chart Tools>Design>Select Data". Then, in the "Select Data Source" dialog, I clicked "Add", as follows:
enter image description here
Next, "Edit Series" dialog appears which I fill with the following information:
enter image description here
After pressing OK, the following chart appears, on which x-y pairs have been plotted.
enter image description here
As f(x) formula calculating B column's values (=COS($C$1*A1)) uses a different C1 value each time the sheet is re-calculated, we will have different charts each time we press Formulas>Calculate Sheet. Several examples follow:

enter image description here
enter image description here
enter image description here
enter image description here

Related Question