0

enter image description here

enter image description here

So I have data, in the form of 2 numpy arrays, that look like the above when plotted. For some reason, when I add the 2 numpy arrays together, element-wise as such:

c = a + b

and then plot c, I get this:

enter image description here

All I'm doing is plot.plot(c)

But that doesn't make sense right? I shouldn't get the same exact plot as plot b (except shifted up) when adding those 2 together right? I'm really confused about this.

3 Answers 3

1

You shouldn't. However, plot can be deceiving. a is almost constant: max changes is about 2e-3 compare to 0.7 in b.

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

1 Comment

I see. Is there any way I can make it so that the changes in a are more strongly reflected when added together?
0

a is practically a constant, the variations in a are much smaller than the variations in b so when you sum them together you only wind up seeing the variations in b on a plot. This will be more apparent if you plot c = 1000*a + b

2 Comments

I see, hm.. do you mean doing 1000*a + b will make the changes more apparent?
@dooder yes; the variation in a is so small that it may as well just be a=5.95 when it gets added to b, which has large variations. So multiplying a by 1000 will increase the size of its variations enough to be noticeable, for demonstration purposes
0

I agree with all the other answers above. I think it will be much clearer to the original poster if they try drawing all three plots on the same graph, rather than showing each of them on a separate graph.

plt.plot(a)
plt.plot(b)
plt.plot(a + b)
plt.show()

4 Comments

I see. Is there any way I can make it so that the changes in a are more strongly reflected when added together?
What is it you're trying to achieve? Have you tried what @Michael suggested?
Oh ok, I just tried it. Yes, that looks much better. Would it better to instead normalize values a and then add them together though? Thank you!
You still haven't told us what you're trying to achieve. So we can't recommend to you how to achieve it? We have no idea what a or b are supposed to represent, nor what their sum is supposed to be.

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.