0

I have written this but its not displaying correctly as a line graph. What am I doing wrong? Normalpwr are to all my x-coordinates corresponding with axfuelline as my y-coordinates. I appreciate any help/tips!

normalpwr = [0.232, 0.397, 0.562, 0.681, 0.754, 0.797, 0.83, 0.843, 0.855, 0.867, 0.883, 0.9, 0.921, 0.943, 0.967, 0.992, 1.017, 1.043, 1.068, 1.092, 1.115, 1.137, 1.157, 1.176, 1.193, 1.209, 1.224, 1.236, 1.249, 1.261, 1.272, 1.283, 1.292, 1.289, 1.274, 1.234, 1.174, 1.048, 0.86, 0.61, 0.361]
axfuelline = [0.000, 0.025, 0.050, 0.075, 0.100, 0.125, 0.150, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.450, 0.475, 0.5, 0.525, 0.550, 0.575, 0.6, 0.625, 0.650, 0.675, 0.7, 0.725, 0.750, 0.8, 0.825, 0.85, 0.875, 0.9, 0.925, 0.950, 0.975, 1]
x = normalpwr[i]
y = axfuelline[i]
plt.plot(x,y, 'ro')
plt.show()
3
  • 1
    What is "i"? You're asking it to plot one point. Do you have a problem aside from that? Commented Jul 24, 2017 at 19:56
  • What is i? If i is an array of numbers then it should be fine. Otherwise. You are plotting just one number against another Commented Jul 24, 2017 at 19:57
  • your code ends up doing a similar thing to a question I answered a few days ago.. take a look at what he was doing, and why what I suggested fixed the problem Commented Jul 25, 2017 at 15:49

1 Answer 1

1

Firstly, your lists are not of the same size. normalpwr is of length 41, while axfuelline is of length 40.

Beside this point, you want to plot a line graph. You are on the right way, but you should not add [i] when defining x and y, since this indicates that you want to use an index (which tells the code to use one part of the list).

Rather, you want to use:

    x = normalpwr
    y = axfuelline
    plt.plot(x,y)
    plt.show()

Note that I also removed 'ro' from the plot function, because this plots the points as red dots, rather than a line.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.