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

asked Jan 3, 2021 at 10:40

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)
answered Jan 3, 2021 at 10:50
1
  • This is correct, but please put commas between the digits. Commented Jan 3, 2021 at 17:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.