User Tools

Site Tools


r:social_network_analysis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
r:social_network_analysis [2019/12/03 15:41]
hkimscil [Triad Data Visualizations]
r:social_network_analysis [2019/12/03 15:44] (current)
hkimscil [Analysis (vis)]
Line 173: Line 173:
     geom_density_tern() ​                                #​define a data geometery     geom_density_tern() ​                                #​define a data geometery
  
-ggtern(data=demodata1,​ aes(x=T1A, y=T1B, z=T1C)) +              #define data sources+ggtern(data=demodata1,​ aes(x=Triad1A, y=Triad1B, z=Triad1C)) +              #define data sources
     geom_density_tern(aes(fill=..level..,​ alpha=..level..)) ​    #​define a data geometery with an aesthetic ​   ​     geom_density_tern(aes(fill=..level..,​ alpha=..level..)) ​    #​define a data geometery with an aesthetic ​   ​
 </​code>​ </​code>​
Line 179: Line 179:
 <​code>​ <​code>​
 #Or you can apply a color gradient to space between the contour lines #Or you can apply a color gradient to space between the contour lines
-ggtern(data=demodata1,​ aes(x=T1A, y=T1B, z=T1C)) +                          #define data sources +ggtern(data=demodata1,​ aes(x=Triad1A, y=Triad1B, z=Triad1C)) +               ​#define data sources 
-    stat_density_tern(aes(fill=..level..,​ alpha=..level..),​geom='​polygon'​) +#now you need to use stat_density_tern+    stat_density_tern(aes(fill=..level..,​ alpha=..level..),​geom='​polygon'​) + #now you need to use stat_density_tern
     scale_fill_gradient2(high = "​red"​) +                                    #define the fill color     scale_fill_gradient2(high = "​red"​) +                                    #define the fill color
     guides(color = "​none",​ fill = "​none",​ alpha = "​none"​) ​                  #we don't want to display legend items     guides(color = "​none",​ fill = "​none",​ alpha = "​none"​) ​                  #we don't want to display legend items
 </​code>​ </​code>​
  
 +<​code>​
 +ggtern(data=demodata1,​ aes(x=Triad1A,​ y=Triad1B, z=Triad1C)) + 
 +    stat_density_tern(aes(fill=..level..,​ alpha=..level..),​ geom='​polygon'​) +
 +    scale_fill_gradient2(high = "​blue"​) +  ​
 +    geom_point() +
 +    theme_showarrows() +
 +    ggtitle("​My Favorite Color"​) +
 +    xlab("​Red"​) + 
 +    ylab("​Yellow"​) +
 +    zlab("​Blue"​) +
 +    guides(color = "​none",​ fill = "​none",​ alpha = "​none"​)
 +</​code>​
  
 ===== triad_data1.csv ===== ===== triad_data1.csv =====
r/social_network_analysis.txt · Last modified: 2019/12/03 15:44 by hkimscil