79408706

Date: 2025-02-03 11:54:32
Score: 0.5
Natty:
Report link

Follow the following examples retrieved from here

import matplotlib.pyplot as plt
import numpy as np

# Simple data to display in various forms
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)

plt.close('all')

# Four axes, returned as a 2-d array
f, axarr = plt.subplots(2, 2)

axarr[0, 0].plot(x, y)
axarr[0, 0].set_title('Axis [0,0]')

axarr[0, 1].scatter(x, y)
axarr[0, 1].set_title('Axis [0,1]')

axarr[1, 0].plot(x, y ** 2)
axarr[1, 0].set_title('Axis [1,0]')

axarr[1, 1].scatter(x, y ** 2)
axarr[1, 1].set_title('Axis [1,1]')

# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False)
plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False)

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Naveed Ahmed