jokergoo / circlize_book

Documentation for circlize package
http://jokergoo.github.io/circlize_book/book
Creative Commons Zero v1.0 Universal
37 stars 41 forks source link

Repeated calculation #1

Closed Yuanchao-Xu closed 6 years ago

Yuanchao-Xu commented 7 years ago

Thanks for your wonderful book, I got two questions here,

In 14.4 Put horizontally or vertically symmetric

Q1. I was wondering if the following codes are calculating the same thing?

row_sum = sum(rowSums(abs(mat)))
col_sum = sum(colSums(abs(mat)))

They both calculate the total sum of the matrix?

Q2. row_sector_degree = (360 - small_gap*(n_sector - 2) - big_gap*2) * (row_sum/(row_sum + col_sum)) + small_gap*(nr-1)

Since the situation in above Q1, so row_sum/(row_sum + col_sum) is actually 0.5, which makes sense since it's symmetric.

My question is small_gap*(n_sector - 2)(degree that small gaps take) big_gap*2 (degree that big gaps take) plus the row_sector_degree already take up all 360. (In your example, n_sector is 9, which means there are in total 9 intervals between sectors, plus the intervals' own degree, they should take up the whole circle.) So, I wonder what's this small_gap*(nr-1) for ?

Thanks.

jokergoo commented 7 years ago

Q1: Yes, you are right : )

Q2: row_sum/(row_sum + col_sum) equals to 0.5. I use different symbols just to make it clear to understand. In following term:

(360 - small_gap*(n_sector - 2) - big_gap*2) * (row_sum/(row_sum + col_sum)) + small_gap*(nr-1)

(360 - small_gap*(n_sector - 2) - big_gap*2) * (row_sum/(row_sum + col_sum)) is the total width of row sectors excluding small gaps in between. Later we add small_gap*(nr-1) which is the total width of gaps between row sectors, and the complete term is the width from the first row sector to the laster sector including the gaps in between.