Skip to content

Instantly share code, notes, and snippets.

@empet
Last active September 6, 2015 20:39
Show Gist options
  • Save empet/eeb8bbe354e709bf590b to your computer and use it in GitHub Desktop.
Save empet/eeb8bbe354e709bf590b to your computer and use it in GitHub Desktop.
Impact Factors for a few Nonlinear Science Journals
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## <center> Impact Factors for a few Nonlinear Science Journals </center>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using `pandas` and `plotly` Python libraries, we extract and plot the impact factors of the following journals:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- Celestial Mechanics and Dynamical Astronomy\n",
"- Chaos\n",
"- Chaos, Solitons, and Fractals\n",
"- Communications In Nonlinear Science And Numerical Simulation\n",
"- Discrete and Continuous Dynamical Systems, Series A\n",
"- Discrete and Continuous Dynamical Systems, Series B\n",
"- International Journal of Bifurcation and Chaos (IJBC)\n",
"- Journal of Physics A: Mathematical and Theoretical\n",
"- Nonlinearity\n",
"- Physica D: Nonlinear Phenomena\n",
"- Regular & Chaotic Dynamics \n",
"- SIAM Journal on Applied Dynamical Systems"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The table of impact factors for each journal, starting from 2008, can be found through the *Journal Impact Factor Search Engine*\n",
" [http://www.bioxbio.com/if/html/](http://www.bioxbio.com/if/)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For example, at \n",
"[http://www.bioxbio.com/if/html/CHAOS.html](http://www.bioxbio.com/if/html/CHAOS.html) is displayed the table for *Chaos*:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We read the table as a `pandas.DataFrame`:"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Year</th>\n",
" <th>Impact Factor (IF)</th>\n",
" <th>Total Articles</th>\n",
" <th>Total Cites</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2014/2015</td>\n",
" <td>1.954</td>\n",
" <td>180</td>\n",
" <td>5026</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2013</td>\n",
" <td>1.761</td>\n",
" <td>189</td>\n",
" <td>4602</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2012</td>\n",
" <td>2.188</td>\n",
" <td>247</td>\n",
" <td>4517</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2011</td>\n",
" <td>2.076</td>\n",
" <td>196</td>\n",
" <td>3985</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2010</td>\n",
" <td>2.081</td>\n",
" <td>198</td>\n",
" <td>3773</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>2009</td>\n",
" <td>1.795</td>\n",
" <td>198</td>\n",
" <td>3787</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>2008</td>\n",
" <td>2.152</td>\n",
" <td>199</td>\n",
" <td>3403</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Year Impact Factor (IF) Total Articles Total Cites\n",
"0 2014/2015 1.954 180 5026\n",
"1 2013 1.761 189 4602\n",
"2 2012 2.188 247 4517\n",
"3 2011 2.076 196 3985\n",
"4 2010 2.081 198 3773\n",
"5 2009 1.795 198 3787\n",
"6 2008 2.152 199 3403"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"url=r'http://www.bioxbio.com/if/html/CHAOS.html'\n",
"dfr = pd.read_html(url, header=0)#returns a list of tables\n",
"dfr0=dfr[0]\n",
"dfr0"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to read succesively the tables corresponding to the chosen journals, we define a list\n",
"of strings that are appended to the above URL:"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"ur=['CELEST-MECH-DYN-ASTR', 'CHAOS', 'CHAOS-SOLITON-FRACT','COMMUN-NONLINEAR-SCI', \\\n",
" 'DISCRETE-CONT-DYN-A', 'DISCRETE-CONT-DYN-B','INT-J-BIFURCAT-CHAOS',\\\n",
" 'J-PHYS-A-MATH-THEOR', 'NONLINEARITY','PHYSICA-D','REGUL-CHAOTIC-DYN',\\\n",
" 'SIAM-J-APPL-DYN-SYST']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`stitle` is the tuple of titles for the plotly plots that will be generated from recorded data:"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"stitle=tuple(['Celest Mech Dyn Astr', 'Chaos', 'Chaos, Solitons, Fractals',\\\n",
" 'Commun Nonl Science', 'Discrete Cont Dyn A', 'Discrete Cont Dyn B',\\\n",
" 'Int J Bifurcat Chaos', 'J Phys A Math Theor', ' Nonlinearity', \\\n",
" 'Physica D', ' Regular Chaotic Dyn', ' SIAM J Appl Dyn Syst'])"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"dfs=[]\n",
"for u in ur:\n",
" url=r'http://www.bioxbio.com/if/html/'+u+'.html'\n",
" df = pd.read_html(url, header=0)\n",
" df0=df[0]\n",
" df0=df0.replace('-', '0', regex=True)\n",
" dfn=list(df0['Impact Factor (IF)'])\n",
" dfs.append(dfn)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The Journal *Communications in Nonlinear Science and Numerical Simulation* is monitored only since 2010. \n",
"We insert 0 as its impact for 2008 and 2009:"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"impacts=[]\n",
"\n",
"for d in dfs:\n",
" d=map(float, d)\n",
" impacts.append(d[::-1])#revert the impacts such that to get their list starting with 2008"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The impact factors of each journal are now displayed in a `plotly` scatter plot:"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import plotly.plotly as py \n",
"import plotly.tools as tls \n",
"from plotly.graph_objs import *"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def make_Scatter(sbplt, y ):\n",
" return Scatter(\n",
" x=[2008, 2009, 2010, 2011, 2012, 2013, 2014], \n",
" y=y, \n",
" mode='markers+lines',\n",
" \n",
" marker=Marker(\n",
" color='rgb(0, 143, 213)',\n",
" size=6\n",
" ),\n",
" line=Line(\n",
" color= 'rgb(0, 143, 213)', #'#2c7fb8',\n",
" width=2),\n",
" name=' ',\n",
" xaxis= 'x{}'.format(sbplt), \n",
" yaxis= 'y{}'.format(sbplt), \n",
" )\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"axis_style = dict(\n",
" zeroline=False, \n",
" showgrid=True, \n",
" gridwidth=1,\n",
" gridcolor='#FFFFFF') \n",
" \n",
"def make_XAxis():\n",
" xaxis = XAxis(axis_style, range=[2008, 2014],\n",
" nticks=7,\n",
" dtick=1,\n",
" showticklabels=False\n",
" ) \n",
" return xaxis\n",
"\n",
"\n",
"def make_YAxis():\n",
" yaxis = YAxis(axis_style, range=[0,3.4]) \n",
" return yaxis\n"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"This is the format of your plot grid:\n",
"[ (1,1) x1,y1 ] [ (1,2) x2,y2 ] [ (1,3) x3,y3 ] [ (1,4) x4,y4 ] \n",
"[ (2,1) x5,y5 ] [ (2,2) x6,y6 ] [ (2,3) x7,y7 ] [ (2,4) x8,y8 ] \n",
"[ (3,1) x9,y9 ] [ (3,2) x10,y10 ] [ (3,3) x11,y11 ] [ (3,4) x12,y12 ]\n",
"\n"
]
}
],
"source": [
"figure = tls.make_subplots(rows=3, cols=4, subplot_titles=stitle,\n",
" horizontal_spacing=0.05,\n",
" vertical_spacing=0.055)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"sbp=range(1,13)"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pl_width=1000 \n",
"pl_height=675\n",
"\n",
"figure['layout'].update(plot_bgcolor='#EFECEA',\n",
" showlegend=False, \n",
" hovermode='closest', \n",
" autosize=False, \n",
" width=pl_width, \n",
" height=pl_height) \n",
"\n",
"title = 'Impact Factors for a few Journals in Nonlinear Science <br> (updated July 1, 2015)'\n",
"figure['layout'].update(title=title, \n",
" font= Font(family=\"Open Sans, sans-serif\")) "
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"anno_text=\"Data source:\\\n",
"<a href='http://www.bioxbio.com/if/'> [1]</a>, Code:\\\n",
"<a href='http://nbviewer.ipython.org/gist/empet/eeb8bbe354e709bf590b'> [2]</a>\"\n",
"\n",
"\n",
"figure['layout']['annotations']+=[\n",
" Annotation(\n",
" showarrow=False, \n",
" text=anno_text, \n",
" xref='paper', \n",
" yref='paper', \n",
" x=0, \n",
" y=-0.15, \n",
" xanchor='left', \n",
" yanchor='bottom', \n",
" font=Font(\n",
" size=12 )\n",
" )\n",
"]\n",
"for sbplt in sbp: #change the default font size for subplots title\n",
" figure['layout']['annotations'][sbplt-1]['font']= {'size': 12}"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"for s in sbp:\n",
" k=sbp.index(s)\n",
" y=impacts[k]\n",
" figure['data'] += [make_Scatter(s,impacts[k])]\n",
" figure['layout'].update({'xaxis{}'.format(s): make_XAxis()})\n",
" figure['layout'].update({'yaxis{}'.format(s): make_YAxis()})\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"for s in range(9,13):\n",
" xaxis_splt = figure['layout']['xaxis{}'.format(s)] \n",
" xaxis_splt.update(showticklabels=True,\n",
" dtick=1,\n",
" tickangle=-45,\n",
" ticks='outside',\n",
" nticks=6)\n",
" \n",
"for s in range(1,10,4):\n",
" yaxis_splt = figure['layout']['yaxis{}'.format(s)] \n",
" yaxis_splt.update(showticklabels=True,\n",
" dtick=0.5,\n",
" ticks='outside') "
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"py.sign_in(\"empet\", \"my_api_key\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#py.plot(figure, filename='Impact-Factors-NSJ', width=1000, height=700, #world_readable=False)#https://plot.ly/1290/~empet/ \n",
"py.plot(figure, filename='Impact-Factors-DS', width=1000, height=700, world_readable=False) "
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
" /*body {\n",
" background-color: #F5F5F5;\n",
" }*/\n",
" div.cell{\n",
" width: 900px;\n",
" margin-left: 13% !important;\n",
" margin-right: auto;\n",
" }\n",
" #notebook li { /* More space between bullet points */\n",
" margin-top:0.8em;\n",
" }\n",
"\n",
" h1 {\n",
" font-family: 'Alegreya Sans', sans-serif;\n",
" }\n",
" .text_cell_render h1 {\n",
" font-weight: 200;\n",
" font-size: 40pt;\n",
" line-height: 100%;\n",
" color: rgb(8, 66, 133);\n",
" margin-bottom: 0em;\n",
" margin-top: 0em;\n",
" display: block;\n",
" }\n",
" h2 {\n",
" font-family: 'Fenix', serif;\n",
" text-indent:1em;\n",
" text-align:center;\n",
" }\n",
" .text_cell_render h2 {\n",
" font-weight: 200;\n",
" font-size: 28pt;\n",
" line-height: 100%;\n",
" color: rgb(8, 66, 133);\n",
" margin-bottom: 1.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" }\n",
" h3 {\n",
" font-family: 'Fenix', serif;\n",
" %margin-top:12px;\n",
" %margin-bottom: 3px;\n",
" }\n",
" .text_cell_render h3 {\n",
" font-weight: 300;\n",
" font-size: 18pt;\n",
" line-height: 100%;\n",
" color: rgb(8, 66, 133);\n",
" margin-bottom: 0.5em;\n",
" margin-top: 2em;\n",
" display: block;\n",
" }\n",
" h4 {\n",
" font-family: 'Fenix', serif;\n",
" }\n",
" .text_cell_render h4 {\n",
" font-weight: 300;\n",
" font-size: 16pt;\n",
" color: rgb(8, 66, 133);\n",
" margin-bottom: 0.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
" }\n",
" h5 {\n",
" font-family: 'Alegreya Sans', sans-serif;\n",
" }\n",
" .text_cell_render h5 {\n",
" font-weight: 300;\n",
" font-style: normal;\n",
" font-size: 16pt;\n",
" margin-bottom: 0em;\n",
" margin-top: 1.5em;\n",
" display: block;\n",
" }\n",
" div.text_cell_render{\n",
" font-family: 'Alegreya Sans',Computer Modern, \"Helvetica Neue\", Arial, Helvetica, Geneva, sans-serif;\n",
" line-height: 145%;\n",
" font-size: 130%;\n",
" width:900px;\n",
" margin-left:auto;\n",
" margin-right:auto;\n",
" %text-align:justify;\n",
" %text-justify:inter-word;\n",
" }\n",
" \n",
" \n",
" code{\n",
" font-size: 78%;\n",
" }\n",
" .rendered_html code{\n",
" background-color: transparent;\n",
" white-space: inherit; \n",
" }\n",
" .prompt{\n",
" display: None;\n",
" }\n",
" .rendered_html code{\n",
" background-color: transparent;\n",
" }\n",
"\n",
" blockquote{\n",
" display:block;\n",
" background: #f3f3f3;\n",
" font-family: \"Open sans\",verdana,arial,sans-serif;\n",
" width:610px;\n",
" padding: 15px 15px 15px 15px;\n",
" text-align:justify;\n",
" text-justify:inter-word;\n",
" }\n",
" blockquote p {\n",
" margin-bottom: 0;\n",
" line-height: 125%;\n",
" font-size: 100%;\n",
" }\n",
" /* element.style {\n",
" } */\n",
"</style>\n",
"<script>\n",
" MathJax.Hub.Config({\n",
" TeX: {\n",
" extensions: [\"AMSmath.js\"]\n",
" },\n",
" tex2jax: {\n",
" inlineMath: [ [\"$\",\"$\"], [\"\\\\(\",\"\\\\)\"] ],\n",
" displayMath: [ [\"$$\",\"$$\"], [\"\\\\[\",\"\\\\]\"] ]\n",
" },\n",
" displayAlign: \"center\", // Change this to \"center\" to center equations.\n",
" \"HTML-CSS\": {\n",
" styles: {\".MathJax_Display\": {\"margin\": 4}}\n",
" }\n",
" });\n",
"</script>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.core.display import HTML\n",
"def css_styling():\n",
" styles = open(\"./custom.css\", \"r\").read()\n",
" return HTML(styles)\n",
"css_styling()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment