# Polar Histogram JCF Cracks

Asked by Luis Barbosa on 2020-11-17

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 = [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()

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
Last query:
 Jérôme Duriez (jduriez) said on 2020-11-18: #1

Hi,

There is no reason to distinguish between n and -n for a contact normal. Polar representations spanning 180° are then just fine, you do need to cover the 360°.

PS: the "W" in "MWS" is obviously insincere ;-)
FileNotFoundError: [Errno 2] No such file or directory: 'cracks_shp.txt'

 Luis Barbosa (luis-pires-b) said on 2021-03-16: #2

Thanks Jérôme Duriez, that solved my question.