#!/usr/bin/env python
# coding: utf-8
# ##
Impact Factors for a few Nonlinear Science Journals
# Using `pandas` and `plotly` Python libraries, we extract and plot the impact factors of the following journals:
# - Celestial Mechanics and Dynamical Astronomy
# - Chaos
# - Chaos, Solitons, and Fractals
# - Communications In Nonlinear Science And Numerical Simulation
# - Discrete and Continuous Dynamical Systems, Series A
# - Discrete and Continuous Dynamical Systems, Series B
# - International Journal of Bifurcation and Chaos (IJBC)
# - Journal of Physics A: Mathematical and Theoretical
# - Nonlinearity
# - Physica D: Nonlinear Phenomena
# - Regular & Chaotic Dynamics
# - SIAM Journal on Applied Dynamical Systems
# 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/](http://www.bioxbio.com/if/)
# For example, at
# [http://www.bioxbio.com/if/html/CHAOS.html](http://www.bioxbio.com/if/html/CHAOS.html) is displayed the table for *Chaos*:
# We read the table as a `pandas.DataFrame`:
# In[36]:
import pandas as pd
import numpy as np
# In[37]:
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
# 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:
# In[38]:
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:
# In[39]:
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'])
# In[40]:
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:
# In[41]:
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:
# In[42]:
import plotly.plotly as py
import plotly.tools as tls
from plotly.graph_objs import *
# In[43]:
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),
)
# In[44]:
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
# In[45]:
figure = tls.make_subplots(rows=3, cols=4, subplot_titles=stitle,
horizontal_spacing=0.05,
vertical_spacing=0.055)
# In[46]:
sbp=range(1,13)
# In[47]:
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
(updated July 1, 2015)'
figure['layout'].update(title=title,
font= Font(family="Open Sans, sans-serif"))
# In[48]:
anno_text="Data source:\
[1], Code:\
[2]"
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}
# In[49]:
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()})
# In[50]:
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')
# In[51]:
py.sign_in("empet", "my_api_key")
# In[ ]:
#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)
# In[55]:
from IPython.core.display import HTML
def css_styling():
styles = open("./custom.css", "r").read()
return HTML(styles)
css_styling()