Reputation: 89
So currently I'm creating a plot which consists of the code:
plt.imshow(prob_mesh[:, 1].reshape((1000, 1000)),
extent=(-4, 4, -4, 4), origin='lower')
plt.scatter(predicting_classes_pos_inputs[:, 0], predicting_classes_pos_inputs[:, 1], marker='o', c='w',
edgecolor='k')
Notice that both these two are supposed to be in the the same plot, now I would like to add:
plt.imshow(prob_mesh[:, 0].reshape((1000, 1000)),
extent=(-4, 4, -4, 4), origin='lower')
plt.scatter(predicting_classes_neg_inputs[:, 0], predicting_classes_neg_inputs[:, 1], marker='o', c='w',
edgecolor='k')
That is, I want these two be plotted in the same plot, but next to each other, hope you understand, how would one implement something like this?
Upvotes: 0
Views: 524
Reputation: 39052
IIUC, you want something like the following. Below is one working answer for you using some fake data. Just replace it with your actual data and see if it served your need.
import matplotlib.pyplot as plt
import numpy as np
prob_mesh = np.random.randint(-4, 4, (100, 100))
f, (ax1, ax2) = plt.subplots(1, 2)
ax1.imshow(prob_mesh[:, 1].reshape((10, 10)),extent=(-4, 4, -4, 4), origin='lower')
ax1.scatter(prob_mesh[:, 1], prob_mesh[:, 0], marker='o', c='w',edgecolor='k')
ax2.imshow(prob_mesh[:, 1].reshape((10, 10)),extent=(-4, 4, -4, 4), origin='lower')
ax2.scatter(prob_mesh[:, 1], prob_mesh[:, 0], marker='o', c='w',edgecolor='k')
Upvotes: 2