Using pandas
and plotly
Python libraries, we extract and plot the impact factors of the following journals:
The table of impact factors for each journal, starting from 2008, can be found through the Journal Impact Factor Search Engine http://www.bioxbio.com/if/html/
For example, at http://www.bioxbio.com/if/html/CHAOS.html is displayed the table for Chaos:
We read the table as a pandas.DataFrame
:
import pandas as pd
import numpy as np
url=r'http://www.bioxbio.com/if/html/CHAOS.html'
dfr = pd.read_html(url, header=0)#returns a list of tables
dfr0=dfr[0]
dfr0
Year | Impact Factor (IF) | Total Articles | Total Cites | |
---|---|---|---|---|
0 | 2014/2015 | 1.954 | 180 | 5026 |
1 | 2013 | 1.761 | 189 | 4602 |
2 | 2012 | 2.188 | 247 | 4517 |
3 | 2011 | 2.076 | 196 | 3985 |
4 | 2010 | 2.081 | 198 | 3773 |
5 | 2009 | 1.795 | 198 | 3787 |
6 | 2008 | 2.152 | 199 | 3403 |
In order to read succesively the tables corresponding to the chosen journals, we define a list of strings that are appended to the above URL:
ur=['CELEST-MECH-DYN-ASTR', 'CHAOS', 'CHAOS-SOLITON-FRACT','COMMUN-NONLINEAR-SCI', \
'DISCRETE-CONT-DYN-A', 'DISCRETE-CONT-DYN-B','INT-J-BIFURCAT-CHAOS',\
'J-PHYS-A-MATH-THEOR', 'NONLINEARITY','PHYSICA-D','REGUL-CHAOTIC-DYN',\
'SIAM-J-APPL-DYN-SYST']
stitle
is the tuple of titles for the plotly plots that will be generated from recorded data:
stitle=tuple(['Celest Mech Dyn Astr', 'Chaos', 'Chaos, Solitons, Fractals',\
'Commun Nonl Science', 'Discrete Cont Dyn A', 'Discrete Cont Dyn B',\
'Int J Bifurcat Chaos', 'J Phys A Math Theor', ' Nonlinearity', \
'Physica D', ' Regular Chaotic Dyn', ' SIAM J Appl Dyn Syst'])
dfs=[]
for u in ur:
url=r'http://www.bioxbio.com/if/html/'+u+'.html'
df = pd.read_html(url, header=0)
df0=df[0]
df0=df0.replace('-', '0', regex=True)
dfn=list(df0['Impact Factor (IF)'])
dfs.append(dfn)
The Journal Communications in Nonlinear Science and Numerical Simulation is monitored only since 2010. We insert 0 as its impact for 2008 and 2009:
impacts=[]
for d in dfs:
d=map(float, d)
impacts.append(d[::-1])#revert the impacts such that to get their list starting with 2008
The impact factors of each journal are now displayed in a plotly
scatter plot:
import plotly.plotly as py
import plotly.tools as tls
from plotly.graph_objs import *
def make_Scatter(sbplt, y ):
return Scatter(
x=[2008, 2009, 2010, 2011, 2012, 2013, 2014],
y=y,
mode='markers+lines',
marker=Marker(
color='rgb(0, 143, 213)',
size=6
),
line=Line(
color= 'rgb(0, 143, 213)', #'#2c7fb8',
width=2),
name=' ',
xaxis= 'x{}'.format(sbplt),
yaxis= 'y{}'.format(sbplt),
)
axis_style = dict(
zeroline=False,
showgrid=True,
gridwidth=1,
gridcolor='#FFFFFF')
def make_XAxis():
xaxis = XAxis(axis_style, range=[2008, 2014],
nticks=7,
dtick=1,
showticklabels=False
)
return xaxis
def make_YAxis():
yaxis = YAxis(axis_style, range=[0,3.4])
return yaxis
figure = tls.make_subplots(rows=3, cols=4, subplot_titles=stitle,
horizontal_spacing=0.05,
vertical_spacing=0.055)
This is the format of your plot grid: [ (1,1) x1,y1 ] [ (1,2) x2,y2 ] [ (1,3) x3,y3 ] [ (1,4) x4,y4 ] [ (2,1) x5,y5 ] [ (2,2) x6,y6 ] [ (2,3) x7,y7 ] [ (2,4) x8,y8 ] [ (3,1) x9,y9 ] [ (3,2) x10,y10 ] [ (3,3) x11,y11 ] [ (3,4) x12,y12 ]
sbp=range(1,13)
pl_width=1000
pl_height=675
figure['layout'].update(plot_bgcolor='#EFECEA',
showlegend=False,
hovermode='closest',
autosize=False,
width=pl_width,
height=pl_height)
title = 'Impact Factors for a few Journals in Nonlinear Science <br> (updated July 1, 2015)'
figure['layout'].update(title=title,
font= Font(family="Open Sans, sans-serif"))
anno_text="Data source:\
<a href='http://www.bioxbio.com/if/'> [1]</a>, Code:\
<a href='http://nbviewer.ipython.org/gist/empet/eeb8bbe354e709bf590b'> [2]</a>"
figure['layout']['annotations']+=[
Annotation(
showarrow=False,
text=anno_text,
xref='paper',
yref='paper',
x=0,
y=-0.15,
xanchor='left',
yanchor='bottom',
font=Font(
size=12 )
)
]
for sbplt in sbp: #change the default font size for subplots title
figure['layout']['annotations'][sbplt-1]['font']= {'size': 12}
for s in sbp:
k=sbp.index(s)
y=impacts[k]
figure['data'] += [make_Scatter(s,impacts[k])]
figure['layout'].update({'xaxis{}'.format(s): make_XAxis()})
figure['layout'].update({'yaxis{}'.format(s): make_YAxis()})
for s in range(9,13):
xaxis_splt = figure['layout']['xaxis{}'.format(s)]
xaxis_splt.update(showticklabels=True,
dtick=1,
tickangle=-45,
ticks='outside',
nticks=6)
for s in range(1,10,4):
yaxis_splt = figure['layout']['yaxis{}'.format(s)]
yaxis_splt.update(showticklabels=True,
dtick=0.5,
ticks='outside')
py.sign_in("empet", "my_api_key")
#py.plot(figure, filename='Impact-Factors-NSJ', width=1000, height=700, #world_readable=False)#https://plot.ly/1290/~empet/
py.plot(figure, filename='Impact-Factors-DS', width=1000, height=700, world_readable=False)
from IPython.core.display import HTML
def css_styling():
styles = open("./custom.css", "r").read()
return HTML(styles)
css_styling()