@@ -6,6 +6,8 @@ library(RColorBrewer)
6
6
library(gridExtra)
7
7
library(cowplot)
8
8
library(broom)
9
+ library(egg) # ggarrange
10
+
9
11
10
12
#center breaks latex here
11
13
knitr::opts_chunk$set(warning = FALSE, fig.align = "default")
@@ -516,9 +518,52 @@ iter_plot_list <- c(list_plot_cntrs[1], list_plot_lbls[1],
516
518
list_plot_cntrs[3], list_plot_lbls[3],
517
519
list_plot_cntrs[4], list_plot_lbls[4])
518
520
519
- plot_grid(plotlist = iter_plot_list,
520
- nrow = 2,
521
- rel_heights = c(1.15, 1))
521
+ ggarrange(iter_plot_list[[1]] +
522
+ theme(axis.text.x = element_blank(),
523
+ axis.ticks.x = element_blank(),
524
+ axis.title.x = element_blank(),
525
+ plot.margin = margin(r = 2, b = 2)),
526
+ iter_plot_list[[2]] +
527
+ theme(axis.text.y = element_blank(),
528
+ axis.ticks.y = element_blank(),
529
+ axis.title.y = element_blank(),
530
+ axis.text.x = element_blank(),
531
+ axis.ticks.x = element_blank(),
532
+ axis.title.x = element_blank(),
533
+ plot.margin = margin(r = 2, l = 2, b = 2) ),
534
+ iter_plot_list[[3]] +
535
+ theme(axis.text.y = element_blank(),
536
+ axis.ticks.y = element_blank(),
537
+ axis.title.y = element_blank(),
538
+ axis.text.x = element_blank(),
539
+ axis.ticks.x = element_blank(),
540
+ axis.title.x = element_blank(),
541
+ plot.margin = margin(r = 2, l = 2, b = 2) ),
542
+ iter_plot_list[[4]] +
543
+ theme(axis.text.y = element_blank(),
544
+ axis.ticks.y = element_blank(),
545
+ axis.title.y = element_blank(),
546
+ axis.text.x = element_blank(),
547
+ axis.ticks.x = element_blank(),
548
+ axis.title.x = element_blank(),
549
+ plot.margin = margin(l = 2, b = 2) ),
550
+ iter_plot_list[[5]] +
551
+ theme(plot.margin = margin(r = 2, t = 2)),
552
+ iter_plot_list[[6]] +
553
+ theme(axis.text.y = element_blank(),
554
+ axis.ticks.y = element_blank(),
555
+ axis.title.y = element_blank(),
556
+ plot.margin = margin(r = 2, l = 2, t = 2) ),
557
+ iter_plot_list[[7]] +
558
+ theme(axis.text.y = element_blank(),
559
+ axis.ticks.y = element_blank(),
560
+ axis.title.y = element_blank(),
561
+ plot.margin = margin(r = 2, l = 2, t = 2) ),
562
+ iter_plot_list[[8]] + theme(axis.text.y = element_blank(),
563
+ axis.ticks.y = element_blank(),
564
+ axis.title.y = element_blank(),
565
+ plot.margin = margin(l = 2, t = 2) ),
566
+ nrow = 2)
522
567
```
523
568
524
569
Note that at this point, we can terminate the algorithm since none of the assignments changed
@@ -644,9 +689,71 @@ iter_plot_list <- c(list_plot_cntrs[1], list_plot_lbls[1],
644
689
list_plot_cntrs[4], list_plot_lbls[4],
645
690
list_plot_cntrs[5], list_plot_lbls[5])
646
691
647
- plot_grid(plotlist = iter_plot_list,
648
- ncol = 4,
649
- rel_heights = c(1.10, 1, 1))
692
+ # plot_grid(plotlist = iter_plot_list,
693
+ # ncol = 4,
694
+ # rel_heights = c(1.10, 1, 1))
695
+
696
+
697
+
698
+ ggarrange(iter_plot_list[[1]] +
699
+ theme(axis.text.x = element_blank(),
700
+ axis.ticks.x = element_blank(),
701
+ axis.title.x = element_blank(),
702
+ plot.margin = margin(r = 2, b = 2)),
703
+ iter_plot_list[[2]] +
704
+ theme(axis.text.y = element_blank(),
705
+ axis.ticks.y = element_blank(),
706
+ axis.title.y = element_blank(),
707
+ axis.text.x = element_blank(),
708
+ axis.ticks.x = element_blank(),
709
+ axis.title.x = element_blank(),
710
+ plot.margin = margin(r = 2, l = 2, b = 2) ),
711
+ iter_plot_list[[3]] +
712
+ theme(axis.text.y = element_blank(),
713
+ axis.ticks.y = element_blank(),
714
+ axis.title.y = element_blank(),
715
+ axis.text.x = element_blank(),
716
+ axis.ticks.x = element_blank(),
717
+ axis.title.x = element_blank(),
718
+ plot.margin = margin(r = 2, l = 2, b = 2)),
719
+ iter_plot_list[[4]] +
720
+ theme(axis.text.y = element_blank(),
721
+ axis.ticks.y = element_blank(),
722
+ axis.title.y = element_blank(),
723
+ axis.text.x = element_blank(),
724
+ axis.ticks.x = element_blank(),
725
+ axis.title.x = element_blank(),
726
+ plot.margin = margin(l = 2, b = 2) ),
727
+ iter_plot_list[[5]] +
728
+ theme(axis.text.x = element_blank(),
729
+ axis.ticks.x = element_blank(),
730
+ axis.title.x = element_blank(),
731
+ plot.margin = margin(r = 2, t = 2, b = 1)),
732
+ iter_plot_list[[6]] +
733
+ theme(axis.text.y = element_blank(),
734
+ axis.ticks.y = element_blank(),
735
+ axis.title.y = element_blank(),
736
+ axis.text.x = element_blank(),
737
+ axis.ticks.x = element_blank(),
738
+ axis.title.x = element_blank(),
739
+ plot.margin = margin(r = 2, l = 2, t = 2, b = 1) ),
740
+ iter_plot_list[[7]] +
741
+ theme(axis.text.y = element_blank(),
742
+ axis.ticks.y = element_blank(),
743
+ axis.title.y = element_blank(),
744
+ plot.margin = margin(r = 2, l = 2, t = 2, b = 2) ),
745
+ iter_plot_list[[8]] + theme(axis.text.y = element_blank(),
746
+ axis.ticks.y = element_blank(),
747
+ axis.title.y = element_blank(),
748
+ plot.margin = margin(l = 2, t = 2, b = 2)),
749
+ iter_plot_list[[9]] +
750
+ theme(plot.margin = margin(r = 2)),
751
+ iter_plot_list[[10]] +
752
+ theme(axis.text.y = element_blank(),
753
+ axis.ticks.y = element_blank(),
754
+ axis.title.y = element_blank(),
755
+ plot.margin = margin(l = 2) ),
756
+ ncol = 4)
650
757
```
651
758
652
759
This looks like a relatively bad clustering of the data, but K-means cannot improve it.
0 commit comments