I am trying to make a circular plot of several angles' occurrences in one graph similar to these ones:
The idea is to represent the distribution of each torsional angle (alpha, beta, etc.) with one circle. The higher the occurrence of that angle the darker the line within that circle.
My input file looks like this:
1.00 14.01 171.64 -17.49 168.69 -150.94 10.27 -20.86 145.12 145.05 -7.43 -161.90 -5.87
2.00 18.15 -172.52 -7.12 162.23 164.93 11.60 -1.73 154.66 158.51 -27.71 -174.80 0.62
3.00 4.94 -167.07 -3.86 144.74 -164.88 -2.33 -19.91 145.94 148.27 -5.93 175.08 -12.85
4.00 -15.02 -150.01 -12.18 155.77 -143.32 2.34 -12.78 137.45 142.44 -18.65 165.76 14.60
5.00 -11.59 -154.16 -3.87 145.04 -170.26 11.28 -2.69 152.88 162.17 -28.51 -168.32 -9.84
First column is just index number and columns 2-12 are the distributions of 12 angles I want to plot. My angle values go from -180:180. I can easily change my input data depending on what I need for r.
I am new to r and trying to do this using ggplot2. My main problem is I am not sure what is the best way to represent the distribution data in this case. One way that I thought of is to make 12 circles by ylim(c(1,12)) and represent each angle distribution by a rectangle with min and max distribution values as coordinates for that rectangle (so first column (or first angle) will be represented by a rectangle with ymin=1 and ymax=2, xmin=min(of column 1) and xmax=max(of column 1), etc.):
data = read.table("myinputfile")
ggplot(data, aes(xvar=-180:180,y=data$V2)) +
ylim(c(1,13)) +
geom_rect(aes(ymin=1, ymax=2, xmin=min(data$V2), xmax=max(data$V2))) +
coord_polar()
This way I just tried to do one angle (column) to see if it will work, but it did not.
I have also tried using geom_point
or geom_boxplot
(which are better to represent distribution data than geom_rect
) but was unsuccessful.
Any insights, ideas, comments are greatly appreciated!