24
24
25
25
plot.bibliometrix <- function (x , ... ){
26
26
27
+ data(" logo" ,package = " bibliometrix" ,envir = environment())
28
+ logo <- grid :: rasterGrob(logo ,interpolate = TRUE )
29
+
27
30
if (class(x )!= " bibliometrix" ){cat(' \n argument "x" have to be an object of class "bibliometrix"\n ' );return (NA )}
28
31
graphs = list ()
29
32
@@ -34,15 +37,30 @@ plot.bibliometrix<-function(x, ...){
34
37
if (pause == TRUE ){
35
38
cat(" Hit <Return> to see next plot: " )
36
39
line <- readline()}
37
-
38
- # Authors
39
- # barplot(x$Authors[1:k],horiz=TRUE,las=2,cex.names=0.5,main="Most Productive Authors",xlab="Articles")
40
+
40
41
xx = as.data.frame(x $ Authors [1 : k ])
42
+ xcoord <- c(k - 0.2 - (k )* 0.15 , k - 0.02 )+ 1
43
+ ycoord <- c(max(xx $ Freq ),max(xx $ Freq )- diff(range(xx $ Freq ))* 0.15 )
44
+ # Authors
45
+
46
+
41
47
g = ggplot(data = xx , aes(x = .data $ AU , y = .data $ Freq )) +
42
- geom_bar(stat = " identity" , fill = " steelblue " )+
48
+ geom_bar(stat = " identity" , fill = " grey90 " )+
43
49
labs(title = " Most productive Authors" , x = " Authors" )+
44
50
labs(y = " N. of Documents" )+
45
- theme_minimal() +
51
+ theme(text = element_text(color = " #444444" )
52
+ ,panel.background = element_rect(fill = ' #FFFFFF' )
53
+ ,panel.grid.minor = element_line(color = ' #EFEFEF' )
54
+ ,panel.grid.major = element_line(color = ' #EFEFEF' )
55
+ ,plot.title = element_text(size = 18 )
56
+ ,axis.title = element_text(size = 14 , color = ' #555555' )
57
+ ,axis.title.y = element_text(vjust = 1 , angle = 90 )
58
+ ,axis.title.x = element_text(hjust = 0 )
59
+ ,axis.text.x = element_text(size = 10 )
60
+ ,axis.line.x = element_line(color = " black" ,size = 0.5 )
61
+ ,axis.line.y = element_line(color = " black" ,size = 0.5 )
62
+ ) +
63
+ annotation_custom(logo , xmin = xcoord [1 ], xmax = xcoord [2 ], ymin = ycoord [1 ], ymax = ycoord [2 ]) +
46
64
coord_flip()
47
65
plot(g )
48
66
@@ -61,17 +79,36 @@ plot.bibliometrix<-function(x, ...){
61
79
names(xx2 )= c(" Country" ," Freq" ," Collaboration" )
62
80
xx = rbind(xx2 ,xx1 )
63
81
xx $ Country = factor (xx $ Country ,levels = xx $ Country [1 : dim(xx2 )[1 ]])
82
+
83
+ Freq <- x $ CountryCollaboration $ SCP [1 : k ]+ x $ CountryCollaboration $ MCP [1 : k ]
84
+ st <- floor(k / 10 )
85
+ # xcoord <- c(st-0.2-(st)*0.85, 0.02)+1
86
+ xcoord <- c(1 ,max(st ,3 ))
87
+ ycoord <- c(max(Freq ),max(Freq )- diff(range(Freq ))* 0.15 )
88
+
64
89
g = suppressWarnings(ggplot(data = xx , aes(x = .data $ Country , y = .data $ Freq ,fill = .data $ Collaboration )) +
65
90
geom_bar(stat = " identity" )+
66
91
scale_x_discrete(limits = rev(levels(xx $ Country )))+
67
92
scale_fill_discrete(name = " Collaboration" ,
68
93
breaks = c(" SCP" ," MCP" ))+
69
94
labs(title = " Most Productive Countries" , x = " Countries" , y = " N. of Documents" ,
70
95
caption = " SCP: Single Country Publications, MCP: Multiple Country Publications" )+
71
- theme_minimal() +
72
- theme(plot.caption = element_text(size = 9 , hjust = 0.5 ,
73
- color = " blue" , face = " italic" ))+
74
- coord_flip())
96
+ theme(text = element_text(color = " #444444" )
97
+ ,panel.background = element_rect(fill = ' #FFFFFF' )
98
+ ,panel.grid.minor = element_line(color = ' #EFEFEF' )
99
+ ,panel.grid.major = element_line(color = ' #EFEFEF' )
100
+ ,plot.title = element_text(size = 18 )
101
+ ,axis.title = element_text(size = 14 , color = ' #555555' )
102
+ ,axis.title.y = element_text(vjust = 1 , angle = 90 )
103
+ ,axis.title.x = element_text(hjust = 0 )
104
+ ,axis.text.x = element_text(size = 10 )
105
+ ,axis.line.x = element_line(color = " black" ,size = 0.5 )
106
+ ,axis.line.y = element_line(color = " black" ,size = 0.5 )
107
+ ) +
108
+ annotation_custom(logo , xmin = xcoord [1 ], xmax = xcoord [2 ], ymin = ycoord [1 ], ymax = ycoord [2 ]) +
109
+ coord_flip())
110
+
111
+
75
112
plot(g )
76
113
graphs $ MostProdCountries = g
77
114
} else {graphs $ MostProdCountries = NA }
@@ -81,11 +118,6 @@ plot.bibliometrix<-function(x, ...){
81
118
line <- readline()}
82
119
83
120
# Articles per Year
84
- # Y=table(x$Years)
85
- # Ym=table(x$Years[x$nAUperPaper>1])
86
- # plot(as.numeric(row.names(Y)),Y,type="l",main="Articles per Year",xlab="Year",ylab="N.Articles",col="blue")
87
- # lines(as.numeric(row.names(Ym)),Ym,col="red")
88
- # legend(x="topleft",c("Total Articles","Multi Auth. Articles"),col=c("blue","red"),lty = c(1, 1),cex=0.6,bty="n")
89
121
90
122
Tab = table(x $ Years )
91
123
@@ -96,22 +128,29 @@ plot.bibliometrix<-function(x, ...){
96
128
97
129
names(Y )= c(" Year" ," Freq" )
98
130
131
+ xcoord <- c(max(Y $ Year )- 0.02 - diff(range(Y $ Year ))* 0.15 , max(Y $ Year )- 0.02 )+ 1
132
+ ycoord <- c(min(Y $ Freq ),min(Y $ Freq )+ diff(range(Y $ Freq ))* 0.15 )
133
+
99
134
g = ggplot(Y , aes(x = .data $ Year , y = .data $ Freq )) +
100
135
geom_line() +
101
- geom_area(fill = ' #002F80 ' , alpha = .5 ) +
136
+ geom_area(fill = ' grey90 ' , alpha = .5 ) +
102
137
labs(x = ' Year'
103
138
, y = ' Articles'
104
139
, title = " Annual Scientific Production" ) +
105
140
scale_x_continuous(breaks = (Y $ Year [seq(1 ,length(Y $ Year ),by = 2 )])) +
106
141
theme(text = element_text(color = " #444444" )
107
- ,panel.background = element_rect(fill = ' #EFEFEF ' )
108
- ,panel.grid.minor = element_line(color = ' #FFFFFF ' )
109
- ,panel.grid.major = element_line(color = ' #FFFFFF ' )
110
- ,plot.title = element_text(size = 24 )
142
+ ,panel.background = element_rect(fill = ' #FFFFFF ' )
143
+ ,panel.grid.minor = element_line(color = ' #EFEFEF ' )
144
+ ,panel.grid.major = element_line(color = ' #EFEFEF ' )
145
+ ,plot.title = element_text(size = 18 )
111
146
,axis.title = element_text(size = 14 , color = ' #555555' )
112
- ,axis.title.y = element_text(vjust = 1 , angle = 0 )
147
+ ,axis.title.y = element_text(vjust = 1 , angle = 90 )
113
148
,axis.title.x = element_text(hjust = 0 )
114
- )
149
+ ,axis.text.x = element_text(size = 10 , angle = 90 )
150
+ ,axis.line.x = element_line(color = " black" ,size = 0.5 )
151
+ ,axis.line.y = element_line(color = " black" ,size = 0.5 )
152
+ ) + annotation_custom(logo , xmin = xcoord [1 ], xmax = xcoord [2 ], ymin = ycoord [1 ], ymax = ycoord [2 ])
153
+
115
154
plot(g )
116
155
graphs $ AnnualScientProd = g
117
156
@@ -143,46 +182,58 @@ plot.bibliometrix<-function(x, ...){
143
182
Table2 = Table2 [order(Table2 $ Year ),]
144
183
row.names(Table2 )= Table2 $ Year }
145
184
185
+ xcoord <- c(max(Table2 $ Year )- 0.02 - diff(range(Table2 $ Year ))* 0.15 , max(Table2 $ Year )- 0.02 )+ 1
186
+ ycoord <- c(min(Table2 $ MeanTCperYear ),min(Table2 $ MeanTCperYear )+ diff(range(Table2 $ MeanTCperYear ))* 0.15 )
146
187
147
188
g = ggplot(Table2 , aes(x = .data $ Year , y = .data $ MeanTCperYear )) +
148
189
geom_line() +
149
- geom_area(fill = ' #002F80 ' , alpha = .5 ) +
190
+ geom_area(fill = ' grey90 ' , alpha = .5 ) +
150
191
labs(x = ' Year'
151
192
, y = ' Citations'
152
193
, title = " Average Article Citations per Year" )+
153
194
scale_x_continuous(breaks = (Table2 $ Year [seq(1 ,length(Table2 $ Year ),by = 2 )])) +
154
195
theme(text = element_text(color = " #444444" )
155
- ,panel.background = element_rect(fill = ' #EFEFEF ' )
156
- ,panel.grid.minor = element_line(color = ' #FFFFFF ' )
157
- ,panel.grid.major = element_line(color = ' #FFFFFF ' )
158
- ,plot.title = element_text(size = 24 )
196
+ ,panel.background = element_rect(fill = ' #FFFFFF ' )
197
+ ,panel.grid.minor = element_line(color = ' #EFEFEF ' )
198
+ ,panel.grid.major = element_line(color = ' #EFEFEF ' )
199
+ ,plot.title = element_text(size = 18 )
159
200
,axis.title = element_text(size = 14 , color = ' #555555' )
160
- ,axis.title.y = element_text(vjust = 1 , angle = 0 )
201
+ ,axis.title.y = element_text(vjust = 1 , angle = 90 )
161
202
,axis.title.x = element_text(hjust = 0 )
162
- )
203
+ ,axis.text.x = element_text(size = 10 , angle = 90 )
204
+ ,axis.line.x = element_line(color = " black" ,size = 0.5 )
205
+ ,axis.line.y = element_line(color = " black" ,size = 0.5 )
206
+ ) + annotation_custom(logo , xmin = xcoord [1 ], xmax = xcoord [2 ], ymin = ycoord [1 ], ymax = ycoord [2 ])
207
+
163
208
plot(g )
164
209
graphs $ AverArtCitperYear = g
165
210
166
211
if (pause == TRUE ){
167
212
cat(" Hit <Return> to see next plot: " )
168
213
line <- readline()}
169
214
215
+ xcoord <- c(max(Table2 $ Year )- 0.02 - diff(range(Table2 $ Year ))* 0.15 , max(Table2 $ Year )- 0.02 )+ 1
216
+ ycoord <- c(min(Table2 $ MeanTCperArt ),min(Table2 $ MeanTCperArt )+ diff(range(Table2 $ MeanTCperArt ))* 0.15 )
217
+
170
218
g = ggplot(Table2 , aes(x = .data $ Year , y = .data $ MeanTCperArt )) +
171
219
geom_line() +
172
- geom_area(fill = ' #002F80 ' , alpha = .5 ) +
220
+ geom_area(fill = ' grey90 ' , alpha = .5 ) +
173
221
labs(x = ' Year'
174
222
, y = ' Citations'
175
223
, title = " Average Total Citations per Year" )+
176
224
scale_x_continuous(breaks = (Table2 $ Year [seq(1 ,length(Table2 $ Year ),by = 2 )])) +
177
225
theme(text = element_text(color = " #444444" )
178
- ,panel.background = element_rect(fill = ' #EFEFEF ' )
179
- ,panel.grid.minor = element_line(color = ' #FFFFFF ' )
180
- ,panel.grid.major = element_line(color = ' #FFFFFF ' )
181
- ,plot.title = element_text(size = 24 )
226
+ ,panel.background = element_rect(fill = ' #FFFFFF ' )
227
+ ,panel.grid.minor = element_line(color = ' #EFEFEF ' )
228
+ ,panel.grid.major = element_line(color = ' #EFEFEF ' )
229
+ ,plot.title = element_text(size = 18 )
182
230
,axis.title = element_text(size = 14 , color = ' #555555' )
183
- ,axis.title.y = element_text(vjust = 1 , angle = 0 )
184
- ,axis.title.x = element_text(hjust = 0 , angle = 0 )
185
- )
231
+ ,axis.title.y = element_text(vjust = 1 , angle = 90 )
232
+ ,axis.title.x = element_text(hjust = 0 )
233
+ ,axis.text.x = element_text(size = 10 , angle = 90 )
234
+ ,axis.line.x = element_line(color = " black" ,size = 0.5 )
235
+ ,axis.line.y = element_line(color = " black" ,size = 0.5 )
236
+ ) + annotation_custom(logo , xmin = xcoord [1 ], xmax = xcoord [2 ], ymin = ycoord [1 ], ymax = ycoord [2 ])
186
237
plot(g )
187
238
graphs $ AverTotCitperYear = g
188
239
} else {
0 commit comments