Skip to content

Commit 5000572

Browse files
authored
Merge pull request #4 from kncrabtree/dev
Pull in zorder fix on 3d plots
2 parents 290fb9d + 7a3385e commit 5000572

14 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Supports nonstandard isotopologues and will calculate internal rotation paramete
66

77
<p align="center">
88
<img src="https://github.com/kncrabtree/moments/assets/20146313/338e14c3-1f8c-48c7-9d61-010cb9c6c4ed" width=400 align="center"/>
9-
<img src="https://github.com/kncrabtree/moments/assets/20146313/5d88d623-0ea2-421c-b832-9814f4e91a83" width=400 align="center"/>
9+
<img src="https://github.com/kncrabtree/moments/assets/20146313/01777d01-63fa-4aaf-95ef-6b2ffb5ee255" width=400 align="center"/>
1010
</p>
1111

1212
### Installation and Requirements
-2.03 KB
Loading
-845 Bytes
Loading
-1.57 KB
Loading
Loading
Loading
Loading
Loading
-1005 Bytes
Loading
Loading
-275 Bytes
Loading
-3.13 KB
Loading
-8.79 KB
Loading

moments.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ def moments_calc(xyzfile,rotor_atoms=None,isotopes=None,quiet=False,noplots=Fals
320320
x = atom.vdw/6*np.outer(np.cos(u),np.sin(v))+xx
321321
y = atom.vdw/6*np.outer(np.sin(u),np.sin(v))+yy
322322
z = atom.vdw/6*np.outer(np.ones(np.size(u)),np.cos(v))+zz
323-
ax.plot_surface(x,y,z,color=atom.color,zorder=yy*((-1)**j))
323+
ax.plot_surface(x,y,z,color=atom.color,zorder=-yy)
324324
ax.text(xx,
325325
yy,
326-
zz,f'{atom.label}{i}',ha='center',va='center',zorder=yy*((-1)**j)+atom.vdw/6+0.01,fontsize=min(a_text,min(b_text,c_text)))
326+
zz,f'{atom.label}{i}',ha='center',va='center',zorder=-yy+atom.vdw/6+0.01,fontsize=min(a_text,min(b_text,c_text)))
327327
for i in range(len(a)):
328328
for k in range(i+1,len(a)):
329329
if bond_matrix[i,k]:
@@ -344,19 +344,19 @@ def moments_calc(xyzfile,rotor_atoms=None,isotopes=None,quiet=False,noplots=Fals
344344
x = xyz[0,:].reshape(100,100) + xx1
345345
y = xyz[1,:].reshape(100,100) + yy1
346346
z = xyz[2,:].reshape(100,100) + zz1
347-
if yy1*((-1)**j) <= yy2*((-1)**j):
348-
zorder = yy1 - a[i].vdw/6*((-1)**j) - .05*((-1)**j)
347+
if yy1 >= yy2:
348+
zorder = yy1 + a[i].vdw/6 + .05
349349
else:
350-
zorder = yy2 - a[k].vdw/6*((-1)**j) - 0.05*((-1)**j)
351-
ax.plot_surface(x,y,z,color='#dddddd',zorder=zorder*((-1)**j))
350+
zorder = yy2 + a[k].vdw/6 + 0.05
351+
ax.plot_surface(x,y,z,color='#dddddd',zorder=-zorder)
352352
ax.set_aspect('equal')
353353
ax.set_axis_off()
354354
xmin,xmax = ax.get_xlim()
355355
ymin,ymax = ax.get_ylim()
356356
zmin,zmax = ax.get_zlim()
357-
ax.plot(np.linspace(xmin,xmax,50),np.zeros(50),np.zeros(50),color='#00000088',zorder=-0,lw=0.5)
358-
ax.plot(np.zeros(50),np.linspace(ymin,ymax,50),np.zeros(50),color='#00000088',zorder=-0,lw=0.5)
359-
ax.plot(np.zeros(50),np.zeros(50),np.linspace(zmin,zmax,50),color='#00000088',zorder=-0,lw=0.5)
357+
ax.plot(np.linspace(xmin,xmax,50),np.zeros(50),np.zeros(50),color='#00000088',zorder=-1000,lw=0.5)
358+
ax.plot(np.zeros(50),np.linspace(ymin,ymax,50),np.zeros(50),color='#00000088',zorder=-1000,lw=0.5)
359+
ax.plot(np.zeros(50),np.zeros(50),np.linspace(zmin,zmax,50),color='#00000088',zorder=-1000,lw=0.5)
360360

361361
if(j==0):
362362
ax.text(xmax,.02*ymax,0.02*zmax,'a')
@@ -368,7 +368,7 @@ def moments_calc(xyzfile,rotor_atoms=None,isotopes=None,quiet=False,noplots=Fals
368368
ax.text(.02*xmax,.02*ymax,zmax,'c')
369369
elif(j==2):
370370
ax.text(xmax,.02*ymax,0.02*zmax,'b')
371-
ax.text(.02*xmax,ymax,0.02*zmax,'a')
371+
ax.text(.02*xmax,-ymax,0.02*zmax,'a')
372372
ax.text(.02*xmax,.02*ymax,zmax,'c')
373373

374374
ax.set_xlim(xmin/1.25,xmax/1.25)

0 commit comments

Comments
 (0)