jolars / eulerr

Area-Proportional Euler and Venn Diagrams with Ellipses
https://jolars.github.io/eulerr/
GNU General Public License v3.0
130 stars 18 forks source link

radius and co-ordinates changes on every run with four sets venn diagram #88

Closed moglideveloper closed 2 years ago

moglideveloper commented 2 years ago

Context :
Trying to create some venn diagram animation using R. https://github.com/moglideveloper/animation


Attempt 1 (with two sets):
Knit animation/with2Sets/animation.Rmd and open
generated animation.html in browser.
It gives a satisfactory animation (refer below)
Two Sets Diagram


Attempt 2 (with four sets):
Knit animation/with4Sets/animation.Rmd and open
generated animation.html in browser.
Animation is not satisfactory (refer below)
Four Sets Diagram

Looks like every time diagram is generated for four sets, co-ordinates and
radius of Venn diagram changes.


To confirm, that co-ordinates and radius of Venn diagram
changes on every run, try executing executeThisFileMultipleTimes.R
multiple times and verify the generated diagram.
Refer below sample generated diagrams :

Sample run 3 Sample run 2 Sample run 1


Question:

How we can make sure, that co-ordinates and radius of Venn diagrams,
doesn't changes on every draw ?
https://github.com/moglideveloper/animation

jolars commented 2 years ago

Have you tried using set.seed() to fix the pseudo-random number generator? eulerr uses random initial starting positions, which means that each fit of the diagram is likely to be different.

There are a few normalization routines, which for instance ensure that two-set diagrams remain the same, but this doesn't work exactly the same for diagrams with more sets.

Can you please try to use set.seed() before calling euler(), setting it to the same value each time, please? I am not 100% sure that it will resolve the issue perfectly, but please try this first.

moglideveloper commented 2 years ago

As suggested, set.seed solved this.

Thanks