python - Plot shows up and disappears fast in R -


i plotting graphs using r. when run program plot appears , disappears. how can make plot stay?`

i running following code found in dynamic time warping in python

import numpy np  import rpy2.robjects.numpy2ri rpy2.robjects.packages import importr  # set our r namespaces r = rpy2.robjects.r dtw = importr('dtw')  # generate our data idx = np.linspace(0, 2*np.pi, 100) template = np.cos(idx) query = np.sin(idx) + np.array(r.runif(100))/10  # calculate alignment vector , corresponding distance alignment = r.dtw(query, template, keep=true)4 plot(alignments) dist = alignment.rx('distance')[0][0]  print(dist) 

basically main file in python, have installed rpy2, remotely connecting unix machine. plot shows disappears. happens r plots. when run matplotlib plots stay(not disappear). wondering whether have put line of code make plots "stay". example matlab "holdon".

one solution wait user type "enter" before program finishes:

raw_input("please type enter...") 

this useful matplotlib plots (instead of using pyplot.show(): closes plots automatically).

ps: saw suggested in link comments original question. approve. :)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -