0

I use the following code to place two plots on left and right of the plane. However, as you can see the plots have overlap. How can I fix that?

fig = plt.figure(figsize = (16,8))
ax = fig.add_subplot(1, 1, 1)
ax.scatter( F1, F2, c=colors )

ax2 = fig.add_subplot(1, 2, 2)
ax2.scatter( F1, F3, c=colors )

enter image description here

1 Answer 1

2

You are creating overlapping subplots

ax = fig.add_subplot(1, 1, 1) # 1 row 1 col # pos 1
ax2 = fig.add_subplot(1, 2, 2) # 1 row, 2 col # pos 2

If you want to divide the plot space by 2 you should use:

ax = fig.add_subplot(121)
ax2 = fig.add_subplot(122)
Sign up to request clarification or add additional context in comments.

1 Comment

This is correct, but please put commas between the digits.

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.