Can I customize the color of clusters of data in 3d plotting?

On the 3d plot below, I visualised data distribution, marking different colors by categories.


But as you can see in case of 2 and 10(red) and 4 and 20(blue), some different and neighbored categories are marked with same color so that their data might be looked as same category. Plus, the black ones do not show the category number well. So I wanna solve these two problems.

I can use both 'scatterplot3d' and 'plot3d' functions for plotting 3 dimensional data(in example, plot3d was used). I distinguished the color by elements designate colors that each function provides, but have no idea how to customize with my requirements. At first ggplot2 seemed to be a solution, but it is for 2d plotting. So to wrap up, my questions are these :

  1. What should I do to make every category/cluster has a unique color in 3d plot? Is there any command that giving different colors for all categories?
  2. To prevent the letter is being screened by colors, I would exclusive dark color. What should I do to include only certain colors that I want?

Can you provide a data frame using this code?
dput(head(YOURDATAFRAME, 100))
and the code needed to generate the figure

1 Like

Here it is. But I didn't study about how the code works for this yet.

    PC1 PC2 PC3
1   209 724 607
2   819 738 909
3   996 988   4
4   992 991   3
5   996 989   4
6   994 989   4
7   763 727 920
8   826 716 947
9   834 745 938
10  909 773 960
11  926 772 969
12  995 991   4
13  909 714 951
14  154 735 497
15  175 730 501
16  994 990   4
17  574 713 800
18  354 709 717
19  768 769 838
20  826 753 902
21  995 988   4
22  993 991   4
23  971 709 991
24  904 733 961
25  839 753 925
26  869 751 945
27   94 722 450
28  289 717 711
29  905 777 956
30  812 772 902
31  873 712 924
32  792 662 926
33  911 668 974
34  910 667 972
35  618 686 825
36  949 711 974
37  949 690 976
38  963 695 988
39  932 737 971
40  612 695 854
41  444 704 780
42  196 708 586
43  220 711 597
44  346 709 716
45  854 735 934
46  898 651 972
47  913 672 973
48  859 738 935
49  148 736 495
50  140 735 491
51  157 728 491
52   91 728 455
53  676 702 883
54  226 731 521
55  392 732 671
56  326 746 568
57  246 738 535
58  227 726 517
59  210 729 514
60  208 729 514
61  212 731 517
62  176 728 501
63  174 729 500
64  178 731 503
65  162 725 491
66  146 724 481
67  172 729 499
68  161 727 492
69  164 729 496
70  177 731 504
71  123 724 470
72  142 724 479
73  108 721 458
74  136 725 477
75  106 721 457
76  167 726 494
77  152 725 486
78  124 725 472
79  135 725 477
80  273 738 545
81  219 732 520
82  112 724 463
83  109 724 462
84  532 736 703
85  491 737 695
86  944 738 977
87  109 742 483
88  427 731 788
89   97 742 476
90  124 742 491
91  301 737 725
92  501 731 795
93  358 735 734
94  356 733 733
95  700 750 859
96  155 742 504
97  138 740 495
98  110 737 477
99  118 739 484
100 139 739 495

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.