4

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?

1
  • 1
    Your problem is using the wrong type of chart. The X axis shows the serial number of the "category", your first data column is the blue line, and the second data column is the line hovering around zero. Change the chart type to scatter chart.
    – fixer1234
    Commented Jul 5, 2015 at 22:26

1 Answer 1

8

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

1
  • 1
    You can save a trip to the Select Data dialog if you put the X data in the first column and the Y data in the second, with a blank cell above the X values and the Y label above the Y values. Commented Jan 11, 2016 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .