-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_widgets.R
36 lines (30 loc) · 827 Bytes
/
plot_widgets.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(ggplot2)
library(plotly)
scatter_widget <-
function(data){
p <- ggplot(
data = data, aes_string(x ='di', y = 'frontier_stat', text = 'ttwa11nm', colour = 'frontier_stat')
) +
geom_point(
) +
xlab('Segregation') +
ylab('Frontier density')
ggplotly(p)
}
## Example
#https://stackoverflow.com/questions/5106782/use-of-ggplot-within-another-function-in-r
#scatter_widget(ttwa)
rank_plot_widget <-
function(data){
p <- ggplot(
data = data, aes_string(x ='frontier_rank', y = 'frontier_stat', text = 'ttwa11nm', colour = 'frontier_stat')
) +
geom_point(
) +
xlab('Frontier density rank (1st = most dense)') +
ylab('Frontier density (higher = denser)')
print(p)
ggplotly(p)
}
# Example
# rank_plot_widget(ttwa)