yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #24398
[Question #694056]: Polar Histogram JCF Cracks
New question #694056 on Yade:
https://answers.launchpad.net/yade/+question/694056
Dear all,
I am plotting the polar histogram of cracks obtained using JCF in an dense aggregate.
However the polar histogram I am obtaining is not distributed over 360º, but only from 90 to 270º.
Here is the MWS:
import pylab # the matlab-like interface of matplotlib
pylab.ioff()
import numpy
import os.path
with open("cracks_shp.txt") as f:
lines = f.readlines()
lines = [l.split()[7:10] for l in lines]
lines = [[float(v) for v in l] for l in lines]
angles = []
for a in lines:
norm1=a[0]
norm2=a[1]
norm3=a[2]
angles.append(atan(a[1]/a[0]))
pylab.hist(angles,bins=20)
# polar histogram
pylab.figure()
## prepare data
values,bins=numpy.histogram(angles,bins=20)
## prepare polar plot
pylab.subplot(111,polar=True);
## plot bar chart, with the histogram data
### bins has one edge extra, remove it: [:-1]
pylab.bar(left=bins[:-1],height=values,width=.7*pi/20);
pylab.show()
--
You received this question notification because your team yade-users is
an answer contact for Yade.