Last answered:

11 May 2021

Posted on:

16 Apr 2021

0

Getting an error for plotting

I am getting this error for plotting.

 operands could not be broadcast together with remapped shapes [original->remapped]: (1000,) and requested shape (1000,1)
2 answers ( 0 marked as helpful)
Posted on:

11 May 2021

4

xs and zs have to be reshape as well.

targets = targets.reshape(observations,)
xs = xs.reshape(observations,)
zs = zs.reshape(observations,)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(xs,zs,targets)
ax.set_xlabel('xs')
ax.set_ylabel('zs')
ax.set_zlabel('targets')
ax.view_init(azim=100)
plt.show()
targets = targets.rehsape(observations,1)
xs = xs.reshape(observations,1)
zs = zs.reshape(observations,1)

Posted on:

11 May 2021

0

There was a typo with rehsape
targets = targets.reshape(observations,)
xs = xs.reshape(observations,)
zs = zs.reshape(observations,)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot(xs,zs,targets)
ax.set_xlabel('xs')
ax.set_ylabel('zs')
ax.set_zlabel('targets')
ax.view_init(azim=100)
plt.show()
targets = targets.reshape(observations,1)
xs = xs.reshape(observations,1)
zs = zs.reshape(observations,1)

Submit an answer