From: Frederik Vanrenterghem Date: Mon, 27 Nov 2023 09:25:50 +0000 (+0800) Subject: Herstel voor laatste org versie. X-Git-Url: http://git.vanrenterghem.biz/www2.vanrenterghem.biz.git/commitdiff_plain/3c9920148567c38da1fd09f8665264c436d85a8a Herstel voor laatste org versie. --- diff --git a/source/assets/golden_spiral-coord_polar-fail.png b/source/assets/golden_spiral-coord_polar-fail.png index 5ff82de..62b9bc4 100644 Binary files a/source/assets/golden_spiral-coord_polar-fail.png and b/source/assets/golden_spiral-coord_polar-fail.png differ diff --git a/source/assets/golden_spiral-ggplot-coord-fixed.png b/source/assets/golden_spiral-ggplot-coord-fixed.png index 6c6d2bf..880311b 100644 Binary files a/source/assets/golden_spiral-ggplot-coord-fixed.png and b/source/assets/golden_spiral-ggplot-coord-fixed.png differ diff --git a/source/assets/golden_spiral-plotrix.png b/source/assets/golden_spiral-plotrix.png index dd65991..7cdd3cb 100644 Binary files a/source/assets/golden_spiral-plotrix.png and b/source/assets/golden_spiral-plotrix.png differ diff --git a/source/posts/Fibonacci_golden_spiral.org b/source/posts/Fibonacci_golden_spiral.org index c4eeed8..948ac3c 100644 --- a/source/posts/Fibonacci_golden_spiral.org +++ b/source/posts/Fibonacci_golden_spiral.org @@ -3,7 +3,7 @@ #+LANGUAGE: en #+PROPERTY: session *R* #+PROPERTY: cache yes -#+PROPERTY: results graphics +#+PROPERTY: results file graphics #+PROPERTY: exports both #+PROPERTY: tangle yes #+OPTIONS: toc:nil @@ -301,17 +301,17 @@ dist_from_origin <- sapply(seq_theta,polar_golden_spiral) | 46.7443082659106 | Plotting the function using coord_polar in ggplot2 does not work as intended. Unexpectedly, the x axis keeps extending instead of circling back once a full circle is reached. Turns out coord_polar might not really be intended to plot elements in polar vector format. -#+BEGIN_SRC R :session R :results output graphics :file ../pics/golden_spiral-coord_polar-fail.png :exports both +#+BEGIN_SRC R :session R :results output file graphics :file ../assets/golden_spiral-coord_polar-fail.png :exports both ggplot(data.frame(x = seq_theta, y = dist_from_origin), aes(x,y)) + geom_point() + coord_polar(theta="x") #+END_SRC #+RESULTS: -[[file:../pics/golden_spiral-coord_polar-fail.png]] +[[file:../assets/golden_spiral-coord_polar-fail.png]] To ensure what I was trying to do is possible, I employ a specialised plotfunction instead -#+BEGIN_SRC R :session R :results output graphics :file ../pics/golden_spiral-plotrix.png :exports both +#+BEGIN_SRC R :session R :results output file graphics :file ../assets/golden_spiral-plotrix.png :exports both plotrix::radial.plot(dist_from_origin, seq_theta,rp.type="s", point.col = "blue") #+END_SRC @@ -339,7 +339,7 @@ df <- data.frame(t(serie)) * Result With everything now ready in the right coordinate system, it's now only a matter of setting some options to make the output look acceptable. -#+BEGIN_SRC R :session R :results output graphics :file ../pics/golden_spiral-ggplot-coord-fixed.png :width 800 :height 800 :exports both +#+BEGIN_SRC R :session R :results output file graphics :file ../assets/golden_spiral-ggplot-coord-fixed.png :width 800 :height 800 :exports both ggplot(df, aes(x=X1,y=X2)) + geom_path(color="blue") + theme(panel.grid.minor = element_blank(),