Rotating 3D t-SNE animated gif scatterplot with matplotlib mahler83, 2019-10-112023-07-19 So I’ve been through a few hours of searching + trial & error and came up with a simple solution to draw an animated GIF 3D scatterplot.(minimum library installs, exclude bash commands) X = data.iloc[:,0:-1] Y = data.iloc[:,-1].astype('int') from sklearn.manifold import TSNE tsne = TSNE(n_components=3, random_state=RS, perplexity=10) tsne_fit = tsne.fit_transform(X) n_components should be set to 3 in order to draw a 3D plot.perpliexity should be adjusted by trial and error to find the best value that represents your data. sqrt(N) is a good starting point. from mpl_toolkits.mplot3d import Axes3D from matplotlib import animation fig = plt.figure(figsize=(10,10)) ax = Axes3D(fig) colors = 'b', 'r' labels = 'Group1', 'Group2' for i, c, label in zip(range(len(labels)), colors, labels): ax.scatter(tsne_fit[data['Group']==i, 0], tsne_fit[data['Group']==i, 1], tsne_fit[data['Group']==i, 2], s=30, c=c, label=label, alpha=0.5) fig.legend() Axes3D is for 3D plotting.matplotlib.animation is for making animated GIF. Draw the scatterplot. In my case, I used scatter() twice to label the outcome feature.Added alpha=0.5 for better visualization when datapoints overlap. def rotate(angle): ax.view_init(azim=angle) angle = 3 ani = animation.FuncAnimation(fig, rotate, frames=np.arange(0, 360, angle), interval=50) ani.save('inhadr_tsne1.gif', writer=animation.PillowWriter(fps=20)) Build an arbitrary function rotate() that updates the view of the plot. This function will be called by FuncAnimation().The writer is set to PillowWriter since it’s included by default in matplotlib. But while searching, I found that in some cases there are some problems in the animation, and can be solved by using a different writer, such as FFMpegWriter.angle=3 means the plot rotates 3 degrees every frame. (120 frames in total)interval=50, fps=20 values can be tweaked to change the rotation speed of animation. bingle bangle~ Took 10 seconds to draw this.대만족! This is definitely going to be put in my next presentation! Share this:TwitterFacebook IT Lab Stuff Tips & Techs
PPT 2010으로 도장 이미지 만들기(생성) 2012-12-102023-07-19 가끔은 도장을 스캔해둔 파일이 없는데 날인해서 워드나 한글 문서를 보내줘야 하는 경우가 있습니다. 이때 파워포인트 2010만 있다면 간단하게 도장 그림파일을 제작할 수 있습니다! 1. 우선 원을 그려줍니다. Shift키를 누르면서 드래그하면 타원이 되는 것을 막을 수 있습니다. 2. 도장 테두리가 되도록 두꺼운 빨강 원을 만듭시다. 채우기 -> 채우기 없음 선색 ->… Share this:TwitterFacebook Read More
Academic writing 논문 리뷰 과제 질문 목록 2021-04-292023-07-19 학생들에게 논문 읽고 리포트를 쓰게 할 때 다음 질문에 답하는 형태로 내도록 하고 있다. 1. 이 논문이 나오게 된 역사적인 이유는? 즉, 이 분야에서 어떤 연구들이 진행되어왔고 어떤 맥락에서 이번 연구가 시작된 것인가? 논문 주제를 잡는 방법을 배우고 introduction에 들어갈 중요한 내용을 배울 수 있는 질문. 2. 이 논문은 어떤… Share this:TwitterFacebook Read More
Tips & Techs 사학연금 대학교 기관코드 조회 방법 2017-01-162023-07-19 사학연금 관련 서류에 “기관코드”라는 것을 기입해야 하는데, 공식적으로는 온라인 조회가 불가능하고 각 학교의 행정실을 통해 문의하도록 되어있다. 행정실에 통화를 시도했으나 “통화량이 많아 연결이 불가능합니다”라는 멘트가 뜨고, 나는 열받고… 결국 잠시 후에 전화를 걸어 코드를 확인했지만, 사학연금 홈페이지에서 비밀번호 조회를 하다가 학교별 사학연금 기관코드를 검색 가능한 페이지를 찾아냈다. http://www.tp.or.kr:8088/tp/cc/PIASItSrUF2_new.jsp?rFlag=RR&pFlag=Y&objId=cd_inst 회원가입여부… Share this:TwitterFacebook Read More
Sorry, I’ve never tried annotation. Does this help? https://stackoverflow.com/questions/56293154/axes3d-text-annotate-3d-scatter-plot