siavashk / pycpd

Pure Numpy Implementation of the Coherent Point Drift Algorithm
MIT License
510 stars 115 forks source link

Running Examples - Plot not showing #42

Closed sheridan-fong closed 4 years ago

sheridan-fong commented 4 years ago

Hi,

When running examples only the first iteration and their respective point placements appear on the plot. The following iterations do not appear and I am unsure why.

Thank you in advance!

gattia commented 4 years ago

Can you provide some more information? What examples? Is it all of them? What environment? Are you running them from the command line? Any other information that you have would be helpful.

siavashk commented 4 years ago

Is your issue similar to https://github.com/siavashk/pycpd/issues/30?

Ritchizh commented 4 years ago

I had the same plotting issue: the first iteration was plotted, but others were blank. Changing the code as follows worked for me:

pic_num =1

def visualize(iteration, error, X, Y, ax):

    global pic_num
    fig = plt.figure(pic_num)
    ax = fig.add_subplot(111, projection='3d')

    ax.scatter(X[:, 0],  X[:, 1], X[:, 2], color='red', label='Target')
    ax.scatter(Y[:, 0],  Y[:, 1], Y[:, 2], color='blue', label='Source')
    ax.text2D(0.87, 0.92, 'Iteration: {:d}'.format(
        iteration), horizontalalignment='center', verticalalignment='center', transform=ax.transAxes, fontsize='x-large')
    ax.legend(loc='upper left', fontsize='x-large')

    pic_num +=1

(To make it 2D: ax = fig.add_subplot(111) )

sandwich25 commented 4 years ago

Hi, I have the same problem and I'm using Spyder with python 3.6. Only the result for the first iteration is showed as shown in the attachment.

Thank you in advance.

Untitled
siavashk commented 4 years ago

@sandwich25 this seems to be a compatibility issue between matplotlib and spyder. I do not use spyder as an integrated development environment (IDE), so I cannot give you a definitive answer. The solution is probably similar to https://github.com/siavashk/pycpd/issues/30#issuecomment-531438477.

I would suggest looking into the plotting options in your IDE. The answers in this Stackoverflow question might help you.