diff --git a/PATSTAT/patstat_analysis_pipeline.ipynb b/PATSTAT/patstat_analysis_pipeline.ipynb index 73f55c7..b5508af 100644 --- a/PATSTAT/patstat_analysis_pipeline.ipynb +++ b/PATSTAT/patstat_analysis_pipeline.ipynb @@ -301,13 +301,13 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 297, "outputs": [ { "data": { "text/plain": "'C:\\\\Users\\\\radvanyi\\\\PycharmProjects\\\\ZSI_analytics\\\\PATSTAT'" }, - "execution_count": 48, + "execution_count": 297, "metadata": {}, "output_type": "execute_result" } @@ -321,10 +321,12 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 429, "outputs": [], "source": [ - "fromdir=\"first_round\"" + "fromdir=\"first_round\"\n", + "\n", + "os.makedirs(fr'{fromdir}/plots')" ], "metadata": { "collapsed": false @@ -332,7 +334,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 392, "outputs": [], "source": [ "appln_pers_f = pd.read_csv(f\"{fromdir}/first-filings-with-persons-raw.csv\", header=None,\n", @@ -340,6 +342,13 @@ "\n", "appln_pers_haninfo = pd.read_csv(f\"{outdir}/tls_206_scope.csv\", usecols=[\"person_id\",\"han_id\",\"han_name\",\"psn_sector\"])\n", "\n", + "appln_pers_haninfo[\"han_name\"] = appln_pers_haninfo[\"han_name\"].str.replace(\"Zhejiang Geely Holding Group Co., Ltd.\",\n", + " \"ZHEJIANG GEELY HOLDINGGROUP CO LTD\")\n", + "\n", + "\n", + "appln_pers_haninfo.loc[appln_pers_haninfo[\"han_name\"]==\"ZHEJIANG GEELY HOLDINGGROUP CO LTD\",\"han_id\"] = 3345915\n", + "# appln_pers_haninfo[\"psn_sector\"] = appln_pers_haninfo[\"psn_sector\"].fillna(\"UNKNOWN\")\n", + "\n", "appln_pers_f = appln_pers_f.merge(appln_pers_haninfo, on=\"person_id\")" ], "metadata": { @@ -348,16 +357,48 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 393, + "outputs": [ + { + "data": { + "text/plain": "han_id\n3345915 6\nName: count, dtype: int64" + }, + "execution_count": 393, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "appln_pers_haninfo[appln_pers_haninfo[\"han_name\"]==\"ZHEJIANG GEELY HOLDINGGROUP CO LTD\"][\"han_id\"].value_counts()" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 394, + "outputs": [], + "source": [ + "pers_sector_primary = pers.groupby(\"han_id\", as_index=False)[\"psn_sector\"].agg(\n", + " lambda x: pd.Series.mode(x)[0]).rename(columns={\"psn_sector\":\"psn_sector_primary\"})\n", + "appln_pers_f = appln_pers_f.merge(pers_sector_primary, on='han_id')" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 395, "outputs": [], "source": [ "tls_801 = pd.read_csv(r\"./EU_CH_scope/table_tls801.csv\", low_memory=False)\n", "# tls_801.head()\n", "scope_df = tls_801[((tls_801.eu_member==\"Y\")|\n", - " (tls_801.ctry_code == 'CN')|\n", " (tls_801.ctry_code == 'NO')|\n", " (tls_801.ctry_code == 'CH')|\n", - " (tls_801.ctry_code == 'UK'))]\n", + " (tls_801.ctry_code == 'GB'))]\n", "scope_countries = scope_df[\"ctry_code\"].unique()" ], "metadata": { @@ -366,13 +407,13 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 396, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "1116\n" + "1055\n" ] } ], @@ -395,13 +436,13 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 397, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "1116\n" + "1055\n" ] } ], @@ -415,14 +456,14 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 398, "outputs": [ { "data": { - "text/plain": " appln_id appln_auth person_id invt_seq_nr applt_seq_nr \n76 410448968 DE 7067540 0 1 \\\n87 420386087 DE 7067540 0 1 \n88 420386089 DE 7067540 0 1 \n828 410512383 EP 220 0 1 \n1454 333687134 EP 10329 0 1 \n... ... ... ... ... ... \n147073 549690891 EP 85841201 1 0 \n147074 549690895 EP 85841201 1 0 \n147075 549690901 EP 85841201 1 0 \n147076 549690897 EP 85841201 1 0 \n147077 549788919 EP 85774895 2 0 \n\n person_name person_ctry_code psn_sector han_id \n76 Evonik Degussa GmbH DE COMPANY 840063 \\\n87 Evonik Degussa GmbH DE COMPANY 840063 \n88 Evonik Degussa GmbH DE COMPANY 840063 \n828 SIEMENS AKTIENGESELLSCHAFT DE COMPANY 2709504 \n1454 Alcatel Lucent FR COMPANY 68848 \n... ... ... ... ... \n147073 JONSSON, Tony SE UNKNOWN 185841201 \n147074 JONSSON, Tony SE UNKNOWN 185841201 \n147075 JONSSON, Tony SE UNKNOWN 185841201 \n147076 JONSSON, Tony SE UNKNOWN 185841201 \n147077 TRAN NGUYEN, Johnny SE UNKNOWN 185774895 \n\n han_name \n76 EVONIK DEGUSSA GMBH \n87 EVONIK DEGUSSA GMBH \n88 EVONIK DEGUSSA GMBH \n828 SIEMENS AG \n1454 ALCATEL LUCENT \n... ... \n147073 JONSSON, Tony \n147074 JONSSON, Tony \n147075 JONSSON, Tony \n147076 JONSSON, Tony \n147077 TRAN NGUYEN, Johnny \n\n[4434 rows x 10 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_idappln_authperson_idinvt_seq_nrapplt_seq_nrperson_nameperson_ctry_codepsn_sectorhan_idhan_name
76410448968DE706754001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBH
87420386087DE706754001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBH
88420386089DE706754001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBH
828410512383EP22001SIEMENS AKTIENGESELLSCHAFTDECOMPANY2709504SIEMENS AG
1454333687134EP1032901Alcatel LucentFRCOMPANY68848ALCATEL LUCENT
.................................
147073549690891EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, Tony
147074549690895EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, Tony
147075549690901EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, Tony
147076549690897EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, Tony
147077549788919EP8577489520TRAN NGUYEN, JohnnySEUNKNOWN185774895TRAN NGUYEN, Johnny
\n

4434 rows × 10 columns

\n
" + "text/plain": " appln_id appln_auth person_id invt_seq_nr applt_seq_nr \n76 410448968 DE 7067540 0 1 \\\n87 420386087 DE 7067540 0 1 \n88 420386089 DE 7067540 0 1 \n173 337088926 EP 21790 0 1 \n974 410512383 EP 220 0 1 \n... ... ... ... ... ... \n147073 549690891 EP 85841201 1 0 \n147074 549690895 EP 85841201 1 0 \n147075 549690901 EP 85841201 1 0 \n147076 549690897 EP 85841201 1 0 \n147077 549788919 EP 85774895 2 0 \n\n person_name person_ctry_code psn_sector han_id \n76 Evonik Degussa GmbH DE COMPANY 840063 \\\n87 Evonik Degussa GmbH DE COMPANY 840063 \n88 Evonik Degussa GmbH DE COMPANY 840063 \n173 Evonik Degussa GmbH DE COMPANY 840063 \n974 SIEMENS AKTIENGESELLSCHAFT DE COMPANY 2709504 \n... ... ... ... ... \n147073 JONSSON, Tony SE UNKNOWN 185841201 \n147074 JONSSON, Tony SE UNKNOWN 185841201 \n147075 JONSSON, Tony SE UNKNOWN 185841201 \n147076 JONSSON, Tony SE UNKNOWN 185841201 \n147077 TRAN NGUYEN, Johnny SE UNKNOWN 185774895 \n\n han_name psn_sector_primary \n76 EVONIK DEGUSSA GMBH COMPANY \n87 EVONIK DEGUSSA GMBH COMPANY \n88 EVONIK DEGUSSA GMBH COMPANY \n173 EVONIK DEGUSSA GMBH COMPANY \n974 SIEMENS AG COMPANY \n... ... ... \n147073 JONSSON, Tony UNKNOWN \n147074 JONSSON, Tony UNKNOWN \n147075 JONSSON, Tony UNKNOWN \n147076 JONSSON, Tony UNKNOWN \n147077 TRAN NGUYEN, Johnny UNKNOWN \n\n[4367 rows x 11 columns]", + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_idappln_authperson_idinvt_seq_nrapplt_seq_nrperson_nameperson_ctry_codepsn_sectorhan_idhan_namepsn_sector_primary
76410448968DE706754001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBHCOMPANY
87420386087DE706754001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBHCOMPANY
88420386089DE706754001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBHCOMPANY
173337088926EP2179001Evonik Degussa GmbHDECOMPANY840063EVONIK DEGUSSA GMBHCOMPANY
974410512383EP22001SIEMENS AKTIENGESELLSCHAFTDECOMPANY2709504SIEMENS AGCOMPANY
....................................
147073549690891EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, TonyUNKNOWN
147074549690895EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, TonyUNKNOWN
147075549690901EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, TonyUNKNOWN
147076549690897EP8584120110JONSSON, TonySEUNKNOWN185841201JONSSON, TonyUNKNOWN
147077549788919EP8577489520TRAN NGUYEN, JohnnySEUNKNOWN185774895TRAN NGUYEN, JohnnyUNKNOWN
\n

4367 rows × 11 columns

\n
" }, - "execution_count": 71, + "execution_count": 398, "metadata": {}, "output_type": "execute_result" } @@ -436,21 +477,21 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 399, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "1116\n" + "1055\n" ] }, { "data": { - "text/plain": " appln_id appln_auth appln_kind filing_year nb_applicants \n51083 407234637 FI A 2011 1 \\\n240847 442945435 FR A 2015 1 \n685164 531137359 NL A 2020 1 \n235203 438685261 EP A 2015 1 \n430561 497548590 DE A 2017 2 \n... ... ... ... ... ... \n721473 579480994 DE A 2021 1 \n619328 523950441 EP A 2019 2 \n484715 490602095 EP A 2018 1 \n196502 450101287 DE A 2014 1 \n367660 477378741 GB A 2017 1 \n\n nb_inventors \n51083 2 \n240847 5 \n685164 3 \n235203 4 \n430561 8 \n... ... \n721473 3 \n619328 3 \n484715 1 \n196502 6 \n367660 1 \n\n[100 rows x 6 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_idappln_authappln_kindfiling_yearnb_applicantsnb_inventors
51083407234637FIA201112
240847442945435FRA201515
685164531137359NLA202013
235203438685261EPA201514
430561497548590DEA201728
.....................
721473579480994DEA202113
619328523950441EPA201923
484715490602095EPA201811
196502450101287DEA201416
367660477378741GBA201711
\n

100 rows × 6 columns

\n
" + "text/plain": " appln_id appln_auth appln_kind filing_year nb_applicants \n114926 405478585 EP A 2013 1 \\\n670680 532677899 EP A 2020 2 \n568605 520224479 EP A 2019 1 \n441101 483520394 FR A 2017 1 \n687085 554756101 DE A 2020 1 \n... ... ... ... ... ... \n235723 443704166 FR A 2015 3 \n670840 532706785 EP A 2020 2 \n415863 486019755 EP A 2017 1 \n608249 520115105 EP A 2019 1 \n753188 549690895 EP A 2021 2 \n\n nb_inventors \n114926 4 \n670680 2 \n568605 2 \n441101 2 \n687085 3 \n... ... \n235723 3 \n670840 2 \n415863 2 \n608249 4 \n753188 1 \n\n[100 rows x 6 columns]", + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_idappln_authappln_kindfiling_yearnb_applicantsnb_inventors
114926405478585EPA201314
670680532677899EPA202022
568605520224479EPA201912
441101483520394FRA201712
687085554756101DEA202013
.....................
235723443704166FRA201533
670840532706785EPA202022
415863486019755EPA201712
608249520115105EPA201914
753188549690895EPA202121
\n

100 rows × 6 columns

\n
" }, - "execution_count": 55, + "execution_count": 399, "metadata": {}, "output_type": "execute_result" } @@ -476,7 +517,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 399, "outputs": [], "source": [], "metadata": { @@ -485,7 +526,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 399, "outputs": [], "source": [], "metadata": { @@ -494,13 +535,13 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 400, "outputs": [ { "data": { - "text/plain": "appln_kind\nA 1114\nU 13\nName: count, dtype: int64" + "text/plain": "appln_kind\nA 1059\nU 7\nName: count, dtype: int64" }, - "execution_count": 57, + "execution_count": 400, "metadata": {}, "output_type": "execute_result" } @@ -514,7 +555,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 401, "outputs": [], "source": [ "# Co-patents per year" @@ -525,7 +566,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 430, "outputs": [ { "data": { @@ -546,16 +587,16 @@ "orientation": "v", "showlegend": false, "text": [ - 52.0, 48.0, - 73.0, + 42.0, 64.0, - 86.0, - 97.0, + 58.0, + 83.0, + 94.0, 148.0, - 179.0, - 166.0, - 145.0, + 174.0, + 151.0, + 135.0, 58.0 ], "textfont": { @@ -577,16 +618,16 @@ ], "xaxis": "x", "y": [ - 52, 48, - 73, + 42, 64, - 86, - 97, + 58, + 83, + 94, 148, - 179, - 166, - 145, + 174, + 151, + 135, 58 ], "yaxis": "y", @@ -608,16 +649,16 @@ "showlegend": false, "text": [ 0.0, - -0.07692307692307693, - 0.40384615384615385, - 0.23076923076923078, - 0.6538461538461539, - 0.8653846153846154, - 1.8461538461538463, - 2.4423076923076925, - 2.1923076923076925, - 1.7884615384615385, - 0.11538461538461539 + -0.125, + 0.3333333333333333, + 0.20833333333333334, + 0.7291666666666666, + 0.9583333333333334, + 2.0833333333333335, + 2.625, + 2.1458333333333335, + 1.8125, + 0.20833333333333334 ], "textfont": { "size": 12 @@ -640,16 +681,16 @@ "xaxis": "x2", "y": [ 0.0, - -0.07692307692307693, - 0.40384615384615385, - 0.23076923076923078, - 0.6538461538461539, - 0.8653846153846154, - 1.8461538461538463, - 2.4423076923076925, - 2.1923076923076925, - 1.7884615384615385, - 0.11538461538461539 + -0.125, + 0.3333333333333333, + 0.20833333333333334, + 0.7291666666666666, + 0.9583333333333334, + 2.0833333333333335, + 2.625, + 2.1458333333333335, + 1.8125, + 0.20833333333333334 ], "yaxis": "y2", "type": "scatter" @@ -1574,7 +1615,7 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -1632,7 +1673,9 @@ "# figsuper['layout']['yaxis'].update(tickformat=\".0f\")\n", "# figsuper['layout']['yaxis3'].update(tickformat=\".0f\")\n", "\n", - "figsuper.show(config= dict(displayModeBar = False, responsive = True))" + "figsuper.show(config= dict(displayModeBar = False, responsive = True),height=800,width=1600,scale = 4)\n", + "\n", + "figsuper.write_image(f\"{fromdir}/plots/overall_distr&trends.png\",height=900,width=900,scale = 4)" ], "metadata": { "collapsed": false @@ -1640,7 +1683,7 @@ }, { "cell_type": "code", - "execution_count": 66, + "execution_count": 440, "outputs": [ { "name": "stderr", @@ -1649,43 +1692,6 @@ "EP not found in ISO2\n" ] }, - { - "data": { - "text/plain": " filing_year appln_auth appln_id filing_year_relative_growth \n0 2011 AT 0.0 2012 \\\n1 2012 AT 1.0 2012 \n2 2013 AT 4.0 2012 \n3 2014 AT 0.0 2012 \n4 2015 AT 1.0 2012 \n.. ... ... ... ... \n160 2017 SE 3.0 2015 \n161 2018 SE 1.0 2015 \n162 2019 SE 0.0 2015 \n163 2020 SE 1.0 2015 \n164 2021 SE 0.0 2015 \n\n appln_id_relative_growth appln_id_cumsum Country \n0 -1.0 0.0 Austria \n1 0.0 1.0 Austria \n2 3.0 5.0 Austria \n3 -1.0 5.0 Austria \n4 0.0 6.0 Austria \n.. ... ... ... \n160 2.0 5.0 Sweden \n161 0.0 6.0 Sweden \n162 -1.0 6.0 Sweden \n163 0.0 7.0 Sweden \n164 -1.0 7.0 Sweden \n\n[165 rows x 7 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
filing_yearappln_authappln_idfiling_year_relative_growthappln_id_relative_growthappln_id_cumsumCountry
02011AT0.02012-1.00.0Austria
12012AT1.020120.01.0Austria
22013AT4.020123.05.0Austria
32014AT0.02012-1.05.0Austria
42015AT1.020120.06.0Austria
........................
1602017SE3.020152.05.0Sweden
1612018SE1.020150.06.0Sweden
1622019SE0.02015-1.06.0Sweden
1632020SE1.020150.07.0Sweden
1642021SE0.02015-1.07.0Sweden
\n

165 rows × 7 columns

\n
" - }, - "execution_count": 66, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data = (appln_f.groupby(['filing_year',\"appln_auth\"])[record_col]\n", - " .nunique(dropna=False).unstack()\n", - " .fillna(0)\n", - " .stack()\n", - " .reset_index()\n", - " .rename(columns={0:record_col}))\n", - "\n", - "data[\"appln_auth\"].str.replace(\"MO\",\"CN\")\n", - "\n", - "data = data.merge(data[data[record_col]>0].sort_values(by=[\"filing_year\"], ascending=True).drop_duplicates(subset=\"appln_auth\"),\n", - " on=[\"appln_auth\"], suffixes=[None,\"_relative_growth\"])\n", - "data[record_col+\"_relative_growth\"] = (data[record_col]-data[record_col+\"_relative_growth\"])/data[record_col+\"_relative_growth\"]\n", - "data = data.sort_values(by =[\"appln_auth\",\"filing_year\"], ascending=[True,True])\n", - "data[record_col+\"_cumsum\"] = (data.groupby('appln_auth',as_index=False)[record_col].cumsum())\n", - "data[\"Country\"] = cc.pandas_convert(series=data[\"appln_auth\"], to='name_short')\n", - "data[\"Country\"] = data[\"Country\"].str.replace(\"not found\",\"European Patent Office\")\n", - "data" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 67, - "outputs": [ { "data": { "application/vnd.plotly.v1+json": { @@ -1730,21 +1736,21 @@ 2020, 2021 ], - "xaxis": "x13", + "xaxis": "x11", "y": [ 0.0, 1.0, - 4.0, + 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 2.0, - 3.0, + 2.0, 0.0 ], - "yaxis": "y13", + "yaxis": "y11", "type": "scatter" }, { @@ -1787,7 +1793,7 @@ 2020, 2021 ], - "xaxis": "x14", + "xaxis": "x12", "y": [ 0.0, 0.0, @@ -1801,64 +1807,7 @@ 1.0, 1.0 ], - "yaxis": "y14", - "type": "scatter" - }, - { - "hovertemplate": "%{hovertext}
%{x}
Co-publications: %{y}", - "hovertext": [ - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China" - ], - "legendgroup": "", - "line": { - "color": "#636efa", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "markers+lines", - "name": "", - "orientation": "v", - "showlegend": false, - "x": [ - 2011, - 2012, - 2013, - 2014, - 2015, - 2016, - 2017, - 2018, - 2019, - 2020, - 2021 - ], - "xaxis": "x15", - "y": [ - 0.0, - 0.0, - 1.0, - 2.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "yaxis": "y15", + "yaxis": "y12", "type": "scatter" }, { @@ -1901,7 +1850,7 @@ 2020, 2021 ], - "xaxis": "x16", + "xaxis": "x13", "y": [ 0.0, 0.0, @@ -1915,7 +1864,7 @@ 1.0, 0.0 ], - "yaxis": "y16", + "yaxis": "y13", "type": "scatter" }, { @@ -1958,21 +1907,21 @@ 2020, 2021 ], - "xaxis": "x17", + "xaxis": "x14", "y": [ 0.0, 0.0, 0.0, 0.0, - 2.0, - 1.0, + 0.0, + 0.0, 0.0, 0.0, 2.0, 0.0, 0.0 ], - "yaxis": "y17", + "yaxis": "y14", "type": "scatter" }, { @@ -2015,21 +1964,21 @@ 2020, 2021 ], - "xaxis": "x18", + "xaxis": "x15", "y": [ 17.0, 15.0, 16.0, - 21.0, + 19.0, 28.0, 34.0, 56.0, - 104.0, - 115.0, - 87.0, + 102.0, + 109.0, + 86.0, 33.0 ], - "yaxis": "y18", + "yaxis": "y15", "type": "scatter" }, { @@ -2072,11 +2021,11 @@ 2020, 2021 ], - "xaxis": "x7", + "xaxis": "x6", "y": [ 3.0, - 4.0, - 3.0, + 2.0, + 1.0, 1.0, 3.0, 1.0, @@ -2086,7 +2035,7 @@ 0.0, 0.0 ], - "yaxis": "y7", + "yaxis": "y6", "type": "scatter" }, { @@ -2129,7 +2078,7 @@ 2020, 2021 ], - "xaxis": "x8", + "xaxis": "x7", "y": [ 10.0, 9.0, @@ -2140,10 +2089,10 @@ 13.0, 6.0, 11.0, - 15.0, + 14.0, 6.0 ], - "yaxis": "y8", + "yaxis": "y7", "type": "scatter" }, { @@ -2186,21 +2135,21 @@ 2020, 2021 ], - "xaxis": "x9", + "xaxis": "x8", "y": [ - 15.0, - 15.0, - 32.0, + 14.0, + 14.0, 31.0, + 29.0, 24.0, - 19.0, + 18.0, 30.0, 28.0, - 20.0, - 21.0, + 19.0, + 19.0, 15.0 ], - "yaxis": "y9", + "yaxis": "y8", "type": "scatter" }, { @@ -2243,7 +2192,7 @@ 2020, 2021 ], - "xaxis": "x10", + "xaxis": "x9", "y": [ 0.0, 0.0, @@ -2257,7 +2206,7 @@ 2.0, 2.0 ], - "yaxis": "y10", + "yaxis": "y9", "type": "scatter" }, { @@ -2300,7 +2249,7 @@ 2020, 2021 ], - "xaxis": "x11", + "xaxis": "x10", "y": [ 0.0, 0.0, @@ -2314,7 +2263,7 @@ 8.0, 1.0 ], - "yaxis": "y11", + "yaxis": "y10", "type": "scatter" }, { @@ -2357,7 +2306,7 @@ 2020, 2021 ], - "xaxis": "x12", + "xaxis": "x", "y": [ 0.0, 0.0, @@ -2371,7 +2320,7 @@ 0.0, 0.0 ], - "yaxis": "y12", + "yaxis": "y", "type": "scatter" }, { @@ -2414,10 +2363,10 @@ 2020, 2021 ], - "xaxis": "x", + "xaxis": "x2", "y": [ 4.0, - 2.0, + 1.0, 0.0, 1.0, 3.0, @@ -2428,7 +2377,7 @@ 0.0, 0.0 ], - "yaxis": "y", + "yaxis": "y2", "type": "scatter" }, { @@ -2471,7 +2420,7 @@ 2020, 2021 ], - "xaxis": "x2", + "xaxis": "x3", "y": [ 0.0, 0.0, @@ -2485,7 +2434,7 @@ 1.0, 0.0 ], - "yaxis": "y2", + "yaxis": "y3", "type": "scatter" }, { @@ -2528,21 +2477,21 @@ 2020, 2021 ], - "xaxis": "x3", + "xaxis": "x4", "y": [ - 3.0, - 2.0, - 2.0, + 0.0, + 0.0, 1.0, - 11.0, - 25.0, + 1.0, + 10.0, + 24.0, 36.0, - 32.0, - 12.0, - 6.0, + 29.0, + 4.0, + 1.0, 0.0 ], - "yaxis": "y3", + "yaxis": "y4", "type": "scatter" } ], @@ -2550,8 +2499,8 @@ "annotations": [ { "showarrow": false, - "text": "Spain", - "x": 0.075, + "text": "Portugal", + "x": 0.09200000000000001, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, @@ -2563,8 +2512,8 @@ }, { "showarrow": false, - "text": "Sweden", - "x": 0.24499999999999997, + "text": "Spain", + "x": 0.29600000000000004, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, @@ -2576,8 +2525,8 @@ }, { "showarrow": false, - "text": "United Kingdom", - "x": 0.415, + "text": "Sweden", + "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, @@ -2589,11 +2538,11 @@ }, { "showarrow": false, - "text": "Finland", - "x": 0.075, + "text": "United Kingdom", + "x": 0.7040000000000002, "xanchor": "center", "xref": "paper", - "y": 0.6433333333333333, + "y": 0.2866666666666666, "yanchor": "bottom", "yref": "paper", "font": { @@ -2602,8 +2551,8 @@ }, { "showarrow": false, - "text": "France", - "x": 0.24499999999999997, + "text": "Finland", + "x": 0.09200000000000001, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -2615,8 +2564,8 @@ }, { "showarrow": false, - "text": "Germany", - "x": 0.415, + "text": "France", + "x": 0.29600000000000004, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -2628,8 +2577,8 @@ }, { "showarrow": false, - "text": "Luxembourg", - "x": 0.585, + "text": "Germany", + "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -2641,8 +2590,8 @@ }, { "showarrow": false, - "text": "Netherlands", - "x": 0.7549999999999999, + "text": "Luxembourg", + "x": 0.7040000000000002, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -2654,8 +2603,8 @@ }, { "showarrow": false, - "text": "Portugal", - "x": 0.925, + "text": "Netherlands", + "x": 0.908, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -2668,7 +2617,7 @@ { "showarrow": false, "text": "Austria", - "x": 0.075, + "x": 0.09200000000000001, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -2681,20 +2630,7 @@ { "showarrow": false, "text": "Belgium", - "x": 0.24499999999999997, - "xanchor": "center", - "xref": "paper", - "y": 0.9999999999999999, - "yanchor": "bottom", - "yref": "paper", - "font": { - "size": 22 - } - }, - { - "showarrow": false, - "text": "China", - "x": 0.415, + "x": 0.29600000000000004, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -2707,7 +2643,7 @@ { "showarrow": false, "text": "Czech Republic", - "x": 0.585, + "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -2720,7 +2656,7 @@ { "showarrow": false, "text": "Denmark", - "x": 0.7549999999999999, + "x": 0.7040000000000002, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -2733,7 +2669,7 @@ { "showarrow": false, "text": "European Patent Office", - "x": 0.925, + "x": 0.908, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -2744,6 +2680,10 @@ } } ], + "font": { + "family": "Montserrat", + "size": 22 + }, "legend": { "tracegroupgap": 0 }, @@ -3570,7 +3510,7 @@ "anchor": "y", "domain": [ 0.0, - 0.15 + 0.18400000000000002 ], "linecolor": "black", "linewidth": 1, @@ -3608,8 +3548,8 @@ "xaxis2": { "anchor": "y2", "domain": [ - 0.16999999999999998, - 0.31999999999999995 + 0.20400000000000001, + 0.388 ], "linecolor": "black", "linewidth": 1, @@ -3650,8 +3590,8 @@ "xaxis3": { "anchor": "y3", "domain": [ - 0.33999999999999997, - 0.49 + 0.40800000000000003, + 0.5920000000000001 ], "linecolor": "black", "linewidth": 1, @@ -3692,8 +3632,8 @@ "xaxis4": { "anchor": "y4", "domain": [ - 0.51, - 0.66 + 0.6120000000000001, + 0.7960000000000002 ], "linecolor": "black", "linewidth": 1, @@ -3734,8 +3674,8 @@ "xaxis5": { "anchor": "y5", "domain": [ - 0.6799999999999999, - 0.83 + 0.8160000000000001, + 1.0 ], "linecolor": "black", "linewidth": 1, @@ -3776,8 +3716,8 @@ "xaxis6": { "anchor": "y6", "domain": [ - 0.85, - 1.0 + 0.0, + 0.18400000000000002 ], "linecolor": "black", "linewidth": 1, @@ -3785,6 +3725,7 @@ "mirror": true, "showgrid": true, "showline": true, + "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -3797,8 +3738,8 @@ "yaxis6": { "anchor": "x6", "domain": [ - 0.0, - 0.2866666666666666 + 0.35666666666666663, + 0.6433333333333333 ], "linecolor": "black", "linewidth": 1, @@ -3806,7 +3747,6 @@ "mirror": true, "showgrid": true, "showline": true, - "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -3818,8 +3758,8 @@ "xaxis7": { "anchor": "y7", "domain": [ - 0.0, - 0.15 + 0.20400000000000001, + 0.388 ], "linecolor": "black", "linewidth": 1, @@ -3849,6 +3789,7 @@ "mirror": true, "showgrid": true, "showline": true, + "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -3860,8 +3801,8 @@ "xaxis8": { "anchor": "y8", "domain": [ - 0.16999999999999998, - 0.31999999999999995 + 0.40800000000000003, + 0.5920000000000001 ], "linecolor": "black", "linewidth": 1, @@ -3903,8 +3844,8 @@ "xaxis9": { "anchor": "y9", "domain": [ - 0.33999999999999997, - 0.49 + 0.6120000000000001, + 0.7960000000000002 ], "linecolor": "black", "linewidth": 1, @@ -3946,8 +3887,8 @@ "xaxis10": { "anchor": "y10", "domain": [ - 0.51, - 0.66 + 0.8160000000000001, + 1.0 ], "linecolor": "black", "linewidth": 1, @@ -3989,8 +3930,8 @@ "xaxis11": { "anchor": "y11", "domain": [ - 0.6799999999999999, - 0.83 + 0.0, + 0.18400000000000002 ], "linecolor": "black", "linewidth": 1, @@ -4011,8 +3952,8 @@ "yaxis11": { "anchor": "x11", "domain": [ - 0.35666666666666663, - 0.6433333333333333 + 0.7133333333333333, + 0.9999999999999999 ], "linecolor": "black", "linewidth": 1, @@ -4020,7 +3961,6 @@ "mirror": true, "showgrid": true, "showline": true, - "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -4032,8 +3972,8 @@ "xaxis12": { "anchor": "y12", "domain": [ - 0.85, - 1.0 + 0.20400000000000001, + 0.388 ], "linecolor": "black", "linewidth": 1, @@ -4054,8 +3994,8 @@ "yaxis12": { "anchor": "x12", "domain": [ - 0.35666666666666663, - 0.6433333333333333 + 0.7133333333333333, + 0.9999999999999999 ], "linecolor": "black", "linewidth": 1, @@ -4075,8 +4015,8 @@ "xaxis13": { "anchor": "y13", "domain": [ - 0.0, - 0.15 + 0.40800000000000003, + 0.5920000000000001 ], "linecolor": "black", "linewidth": 1, @@ -4106,6 +4046,7 @@ "mirror": true, "showgrid": true, "showline": true, + "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -4117,8 +4058,8 @@ "xaxis14": { "anchor": "y14", "domain": [ - 0.16999999999999998, - 0.31999999999999995 + 0.6120000000000001, + 0.7960000000000002 ], "linecolor": "black", "linewidth": 1, @@ -4160,8 +4101,8 @@ "xaxis15": { "anchor": "y15", "domain": [ - 0.33999999999999997, - 0.49 + 0.8160000000000001, + 1.0 ], "linecolor": "black", "linewidth": 1, @@ -4199,155 +4140,41 @@ "tickfont": { "size": 16 } - }, - "xaxis16": { - "anchor": "y16", - "domain": [ - 0.51, - 0.66 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "x", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - }, - "tickangle": 45 - }, - "yaxis16": { - "anchor": "x16", - "domain": [ - 0.7133333333333333, - 0.9999999999999999 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "y", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - } - }, - "xaxis17": { - "anchor": "y17", - "domain": [ - 0.6799999999999999, - 0.83 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "x", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - }, - "tickangle": 45 - }, - "yaxis17": { - "anchor": "x17", - "domain": [ - 0.7133333333333333, - 0.9999999999999999 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "y", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - } - }, - "xaxis18": { - "anchor": "y18", - "domain": [ - 0.85, - 1.0 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "x", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - }, - "tickangle": 45 - }, - "yaxis18": { - "anchor": "x18", - "domain": [ - 0.7133333333333333, - 0.9999999999999999 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "y", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - } - }, - "font": { - "size": 22 } }, "config": { "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" } ], "source": [ + "data = (appln_f.groupby(['filing_year',\"appln_auth\"])[record_col]\n", + " .nunique(dropna=False).unstack()\n", + " .fillna(0)\n", + " .stack()\n", + " .reset_index()\n", + " .rename(columns={0:record_col}))\n", + "\n", + "data[\"appln_auth\"].str.replace(\"MO\",\"CN\")\n", + "\n", + "data = data.merge(data[data[record_col]>0].sort_values(by=[\"filing_year\"], ascending=True).drop_duplicates(subset=\"appln_auth\"),\n", + " on=[\"appln_auth\"], suffixes=[None,\"_relative_growth\"])\n", + "data[record_col+\"_relative_growth\"] = (data[record_col]-data[record_col+\"_relative_growth\"])/data[record_col+\"_relative_growth\"]\n", + "data = data.sort_values(by =[\"appln_auth\",\"filing_year\"], ascending=[True,True])\n", + "data[record_col+\"_cumsum\"] = (data.groupby('appln_auth',as_index=False)[record_col].cumsum())\n", + "data[\"Country\"] = cc.pandas_convert(series=data[\"appln_auth\"], to='name_short')\n", + "data[\"Country\"] = data[\"Country\"].str.replace(\"not found\",\"European Patent Office\")\n", + "\n", + "\n", "fig = px.line(data.sort_values(ascending=True, by='filing_year'),\n", " y=record_col,\n", " x='filing_year'\n", - " ,facet_col=\"Country\",facet_col_wrap=6,category_orders={\"Country\": sorted(data[\"Country\"].unique())},\n", + " ,facet_col=\"Country\",facet_col_wrap=5,category_orders={\"Country\": sorted(data[\"Country\"].unique())},\n", " markers=True,\n", " labels={\n", " record_col: 'Number of co-patents',\n", @@ -4360,7 +4187,7 @@ "fig.update_xaxes(\n", " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", " ticks=\"outside\")\n", - "fig.update_layout({'template':\"plotly\"})\n", + "fig.update_layout({'template':\"plotly\"},font_family=\"Montserrat\")\n", "fig.update_yaxes(title='')\n", "fig.update_xaxes(title='')\n", "fig.for_each_annotation(lambda a: a.update(text=a.text.split(\"=\")[-1]))\n", @@ -4368,13 +4195,15 @@ "figsuper_ppt = go.Figure(fig)\n", "\n", "figsuper_ppt['layout'][\"font\"][\"size\"]=22\n", + "# figsuper['layout'][\"xaxis\"][\"range\"] = [20,2022.5]\n", "for a in figsuper_ppt['layout'][\"annotations\"]:\n", " a[\"font\"][\"size\"] = 22\n", "\n", "s=16\n", "figsuper_ppt.update_yaxes(tickfont=dict(size=s))\n", "figsuper_ppt.update_xaxes(tickfont=dict(size=s),tickangle=45)\n", - "figsuper_ppt.show()" + "figsuper_ppt.show(height=800,width=1600,scale = 4)\n", + "figsuper_ppt.write_image(f\"{fromdir}/plots/yearly_outputs.png\",height=800,width=1600,scale = 4)" ], "metadata": { "collapsed": false @@ -4382,7 +4211,16 @@ }, { "cell_type": "code", - "execution_count": 68, + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 442, "outputs": [ { "data": { @@ -4428,21 +4266,21 @@ 2020, 2021 ], - "xaxis": "x13", + "xaxis": "x11", "y": [ -1.0, 0.0, - 3.0, + -1.0, -1.0, 0.0, -1.0, -1.0, -1.0, 1.0, - 2.0, + 1.0, -1.0 ], - "yaxis": "y13", + "yaxis": "y11", "type": "scatter" }, { @@ -4485,7 +4323,7 @@ 2020, 2021 ], - "xaxis": "x14", + "xaxis": "x12", "y": [ -1.0, -1.0, @@ -4499,64 +4337,7 @@ 0.0, 0.0 ], - "yaxis": "y14", - "type": "scatter" - }, - { - "hovertemplate": "%{hovertext}
%{x}
Co-publications: %{y}", - "hovertext": [ - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China", - "China" - ], - "legendgroup": "", - "line": { - "color": "#636efa", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "markers+lines", - "name": "", - "orientation": "v", - "showlegend": false, - "x": [ - 2011, - 2012, - 2013, - 2014, - 2015, - 2016, - 2017, - 2018, - 2019, - 2020, - 2021 - ], - "xaxis": "x15", - "y": [ - -1.0, - -1.0, - 0.0, - 1.0, - -1.0, - -1.0, - -1.0, - -1.0, - -1.0, - -1.0, - -1.0 - ], - "yaxis": "y15", + "yaxis": "y12", "type": "scatter" }, { @@ -4599,7 +4380,7 @@ 2020, 2021 ], - "xaxis": "x16", + "xaxis": "x13", "y": [ -1.0, -1.0, @@ -4613,7 +4394,7 @@ 0.0, -1.0 ], - "yaxis": "y16", + "yaxis": "y13", "type": "scatter" }, { @@ -4656,21 +4437,21 @@ 2020, 2021 ], - "xaxis": "x17", + "xaxis": "x14", "y": [ -1.0, -1.0, -1.0, -1.0, - 0.0, - -0.5, + -1.0, + -1.0, -1.0, -1.0, 0.0, -1.0, -1.0 ], - "yaxis": "y17", + "yaxis": "y14", "type": "scatter" }, { @@ -4713,21 +4494,21 @@ 2020, 2021 ], - "xaxis": "x18", + "xaxis": "x15", "y": [ 0.0, -0.11764705882352941, -0.058823529411764705, - 0.23529411764705882, + 0.11764705882352941, 0.6470588235294118, 1.0, 2.2941176470588234, - 5.117647058823529, - 5.764705882352941, - 4.117647058823529, + 5.0, + 5.411764705882353, + 4.0588235294117645, 0.9411764705882353 ], - "yaxis": "y18", + "yaxis": "y15", "type": "scatter" }, { @@ -4770,11 +4551,11 @@ 2020, 2021 ], - "xaxis": "x7", + "xaxis": "x6", "y": [ 0.0, - 0.3333333333333333, - 0.0, + -0.3333333333333333, + -0.6666666666666666, -0.6666666666666666, 0.0, -0.6666666666666666, @@ -4784,7 +4565,7 @@ -1.0, -1.0 ], - "yaxis": "y7", + "yaxis": "y6", "type": "scatter" }, { @@ -4827,7 +4608,7 @@ 2020, 2021 ], - "xaxis": "x8", + "xaxis": "x7", "y": [ 0.0, -0.1, @@ -4838,10 +4619,10 @@ 0.3, -0.4, 0.1, - 0.5, + 0.4, -0.4 ], - "yaxis": "y8", + "yaxis": "y7", "type": "scatter" }, { @@ -4884,21 +4665,21 @@ 2020, 2021 ], - "xaxis": "x9", + "xaxis": "x8", "y": [ 0.0, 0.0, - 1.1333333333333333, - 1.0666666666666667, - 0.6, - 0.26666666666666666, + 1.2142857142857142, + 1.0714285714285714, + 0.7142857142857143, + 0.2857142857142857, + 1.1428571428571428, 1.0, - 0.8666666666666667, - 0.3333333333333333, - 0.4, - 0.0 + 0.35714285714285715, + 0.35714285714285715, + 0.07142857142857142 ], - "yaxis": "y9", + "yaxis": "y8", "type": "scatter" }, { @@ -4941,7 +4722,7 @@ 2020, 2021 ], - "xaxis": "x10", + "xaxis": "x9", "y": [ -1.0, -1.0, @@ -4955,7 +4736,7 @@ 1.0, 1.0 ], - "yaxis": "y10", + "yaxis": "y9", "type": "scatter" }, { @@ -4998,7 +4779,7 @@ 2020, 2021 ], - "xaxis": "x11", + "xaxis": "x10", "y": [ -1.0, -1.0, @@ -5012,7 +4793,7 @@ 7.0, 0.0 ], - "yaxis": "y11", + "yaxis": "y10", "type": "scatter" }, { @@ -5055,7 +4836,7 @@ 2020, 2021 ], - "xaxis": "x12", + "xaxis": "x", "y": [ -1.0, -1.0, @@ -5069,7 +4850,7 @@ -1.0, -1.0 ], - "yaxis": "y12", + "yaxis": "y", "type": "scatter" }, { @@ -5112,10 +4893,10 @@ 2020, 2021 ], - "xaxis": "x", + "xaxis": "x2", "y": [ 0.0, - -0.5, + -0.75, -1.0, -0.75, -0.25, @@ -5126,7 +4907,7 @@ -1.0, -1.0 ], - "yaxis": "y", + "yaxis": "y2", "type": "scatter" }, { @@ -5169,7 +4950,7 @@ 2020, 2021 ], - "xaxis": "x2", + "xaxis": "x3", "y": [ -1.0, -1.0, @@ -5183,7 +4964,7 @@ 0.0, -1.0 ], - "yaxis": "y2", + "yaxis": "y3", "type": "scatter" }, { @@ -5226,21 +5007,21 @@ 2020, 2021 ], - "xaxis": "x3", + "xaxis": "x4", "y": [ + -1.0, + -1.0, 0.0, - -0.3333333333333333, - -0.3333333333333333, - -0.6666666666666666, - 2.6666666666666665, - 7.333333333333333, - 11.0, - 9.666666666666666, + 0.0, + 9.0, + 23.0, + 35.0, + 28.0, 3.0, - 1.0, + 0.0, -1.0 ], - "yaxis": "y3", + "yaxis": "y4", "type": "scatter" } ], @@ -5248,8 +5029,8 @@ "annotations": [ { "showarrow": false, - "text": "Spain", - "x": 0.075, + "text": "Portugal", + "x": 0.09200000000000001, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, @@ -5261,8 +5042,8 @@ }, { "showarrow": false, - "text": "Sweden", - "x": 0.24499999999999997, + "text": "Spain", + "x": 0.29600000000000004, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, @@ -5274,8 +5055,8 @@ }, { "showarrow": false, - "text": "United Kingdom", - "x": 0.415, + "text": "Sweden", + "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.2866666666666666, @@ -5287,11 +5068,11 @@ }, { "showarrow": false, - "text": "Finland", - "x": 0.075, + "text": "United Kingdom", + "x": 0.7040000000000002, "xanchor": "center", "xref": "paper", - "y": 0.6433333333333333, + "y": 0.2866666666666666, "yanchor": "bottom", "yref": "paper", "font": { @@ -5300,8 +5081,8 @@ }, { "showarrow": false, - "text": "France", - "x": 0.24499999999999997, + "text": "Finland", + "x": 0.09200000000000001, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -5313,8 +5094,8 @@ }, { "showarrow": false, - "text": "Germany", - "x": 0.415, + "text": "France", + "x": 0.29600000000000004, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -5326,8 +5107,8 @@ }, { "showarrow": false, - "text": "Luxembourg", - "x": 0.585, + "text": "Germany", + "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -5339,8 +5120,8 @@ }, { "showarrow": false, - "text": "Netherlands", - "x": 0.7549999999999999, + "text": "Luxembourg", + "x": 0.7040000000000002, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -5352,8 +5133,8 @@ }, { "showarrow": false, - "text": "Portugal", - "x": 0.925, + "text": "Netherlands", + "x": 0.908, "xanchor": "center", "xref": "paper", "y": 0.6433333333333333, @@ -5366,7 +5147,7 @@ { "showarrow": false, "text": "Austria", - "x": 0.075, + "x": 0.09200000000000001, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -5379,20 +5160,7 @@ { "showarrow": false, "text": "Belgium", - "x": 0.24499999999999997, - "xanchor": "center", - "xref": "paper", - "y": 0.9999999999999999, - "yanchor": "bottom", - "yref": "paper", - "font": { - "size": 22 - } - }, - { - "showarrow": false, - "text": "China", - "x": 0.415, + "x": 0.29600000000000004, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -5405,7 +5173,7 @@ { "showarrow": false, "text": "Czech Republic", - "x": 0.585, + "x": 0.5, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -5418,7 +5186,7 @@ { "showarrow": false, "text": "Denmark", - "x": 0.7549999999999999, + "x": 0.7040000000000002, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -5431,7 +5199,7 @@ { "showarrow": false, "text": "European Patent Office", - "x": 0.925, + "x": 0.908, "xanchor": "center", "xref": "paper", "y": 0.9999999999999999, @@ -5442,6 +5210,10 @@ } } ], + "font": { + "family": "Montserrat", + "size": 22 + }, "legend": { "tracegroupgap": 0 }, @@ -6262,13 +6034,13 @@ } }, "title": { - "text": "Yearly output of co-patents by patent authority" + "text": "Yearly rel. output of co-patents by patent authority" }, "xaxis": { "anchor": "y", "domain": [ 0.0, - 0.15 + 0.18400000000000002 ], "linecolor": "black", "linewidth": 1, @@ -6310,8 +6082,8 @@ "xaxis2": { "anchor": "y2", "domain": [ - 0.16999999999999998, - 0.31999999999999995 + 0.20400000000000001, + 0.388 ], "linecolor": "black", "linewidth": 1, @@ -6356,8 +6128,8 @@ "xaxis3": { "anchor": "y3", "domain": [ - 0.33999999999999997, - 0.49 + 0.40800000000000003, + 0.5920000000000001 ], "linecolor": "black", "linewidth": 1, @@ -6402,8 +6174,8 @@ "xaxis4": { "anchor": "y4", "domain": [ - 0.51, - 0.66 + 0.6120000000000001, + 0.7960000000000002 ], "linecolor": "black", "linewidth": 1, @@ -6448,8 +6220,8 @@ "xaxis5": { "anchor": "y5", "domain": [ - 0.6799999999999999, - 0.83 + 0.8160000000000001, + 1.0 ], "linecolor": "black", "linewidth": 1, @@ -6494,8 +6266,8 @@ "xaxis6": { "anchor": "y6", "domain": [ - 0.85, - 1.0 + 0.0, + 0.18400000000000002 ], "linecolor": "black", "linewidth": 1, @@ -6503,6 +6275,7 @@ "mirror": true, "showgrid": true, "showline": true, + "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -6515,8 +6288,8 @@ "yaxis6": { "anchor": "x6", "domain": [ - 0.0, - 0.2866666666666666 + 0.35666666666666663, + 0.6433333333333333 ], "linecolor": "black", "linewidth": 1, @@ -6524,7 +6297,6 @@ "mirror": true, "showgrid": true, "showline": true, - "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -6540,8 +6312,8 @@ "xaxis7": { "anchor": "y7", "domain": [ - 0.0, - 0.15 + 0.20400000000000001, + 0.388 ], "linecolor": "black", "linewidth": 1, @@ -6571,6 +6343,7 @@ "mirror": true, "showgrid": true, "showline": true, + "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -6586,8 +6359,8 @@ "xaxis8": { "anchor": "y8", "domain": [ - 0.16999999999999998, - 0.31999999999999995 + 0.40800000000000003, + 0.5920000000000001 ], "linecolor": "black", "linewidth": 1, @@ -6633,8 +6406,8 @@ "xaxis9": { "anchor": "y9", "domain": [ - 0.33999999999999997, - 0.49 + 0.6120000000000001, + 0.7960000000000002 ], "linecolor": "black", "linewidth": 1, @@ -6680,8 +6453,8 @@ "xaxis10": { "anchor": "y10", "domain": [ - 0.51, - 0.66 + 0.8160000000000001, + 1.0 ], "linecolor": "black", "linewidth": 1, @@ -6727,8 +6500,8 @@ "xaxis11": { "anchor": "y11", "domain": [ - 0.6799999999999999, - 0.83 + 0.0, + 0.18400000000000002 ], "linecolor": "black", "linewidth": 1, @@ -6749,8 +6522,8 @@ "yaxis11": { "anchor": "x11", "domain": [ - 0.35666666666666663, - 0.6433333333333333 + 0.7133333333333333, + 0.9999999999999999 ], "linecolor": "black", "linewidth": 1, @@ -6758,7 +6531,6 @@ "mirror": true, "showgrid": true, "showline": true, - "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -6774,8 +6546,8 @@ "xaxis12": { "anchor": "y12", "domain": [ - 0.85, - 1.0 + 0.20400000000000001, + 0.388 ], "linecolor": "black", "linewidth": 1, @@ -6796,8 +6568,8 @@ "yaxis12": { "anchor": "x12", "domain": [ - 0.35666666666666663, - 0.6433333333333333 + 0.7133333333333333, + 0.9999999999999999 ], "linecolor": "black", "linewidth": 1, @@ -6821,8 +6593,8 @@ "xaxis13": { "anchor": "y13", "domain": [ - 0.0, - 0.15 + 0.40800000000000003, + 0.5920000000000001 ], "linecolor": "black", "linewidth": 1, @@ -6852,6 +6624,7 @@ "mirror": true, "showgrid": true, "showline": true, + "showticklabels": false, "ticks": "outside", "title": { "text": "" @@ -6867,8 +6640,8 @@ "xaxis14": { "anchor": "y14", "domain": [ - 0.16999999999999998, - 0.31999999999999995 + 0.6120000000000001, + 0.7960000000000002 ], "linecolor": "black", "linewidth": 1, @@ -6914,8 +6687,8 @@ "xaxis15": { "anchor": "y15", "domain": [ - 0.33999999999999997, - 0.49 + 0.8160000000000001, + 1.0 ], "linecolor": "black", "linewidth": 1, @@ -6957,157 +6730,13 @@ "tickfont": { "size": 16 } - }, - "xaxis16": { - "anchor": "y16", - "domain": [ - 0.51, - 0.66 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "x", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - }, - "tickangle": 45 - }, - "yaxis16": { - "anchor": "x16", - "domain": [ - 0.7133333333333333, - 0.9999999999999999 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "y", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "zeroline": true, - "zerolinewidth": 2, - "zerolinecolor": "grey", - "tickformat": ".0%", - "tickfont": { - "size": 16 - } - }, - "xaxis17": { - "anchor": "y17", - "domain": [ - 0.6799999999999999, - 0.83 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "x", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - }, - "tickangle": 45 - }, - "yaxis17": { - "anchor": "x17", - "domain": [ - 0.7133333333333333, - 0.9999999999999999 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "y", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "zeroline": true, - "zerolinewidth": 2, - "zerolinecolor": "grey", - "tickformat": ".0%", - "tickfont": { - "size": 16 - } - }, - "xaxis18": { - "anchor": "y18", - "domain": [ - 0.85, - 1.0 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "x", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "tickfont": { - "size": 16 - }, - "tickangle": 45 - }, - "yaxis18": { - "anchor": "x18", - "domain": [ - 0.7133333333333333, - 0.9999999999999999 - ], - "linecolor": "black", - "linewidth": 1, - "matches": "y", - "mirror": true, - "showgrid": true, - "showline": true, - "showticklabels": false, - "ticks": "outside", - "title": { - "text": "" - }, - "zeroline": true, - "zerolinewidth": 2, - "zerolinecolor": "grey", - "tickformat": ".0%", - "tickfont": { - "size": 16 - } - }, - "font": { - "size": 22 } }, "config": { "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -7117,12 +6746,12 @@ "fig = px.line(data.sort_values(ascending=True, by='filing_year'),\n", " y=record_col+\"_relative_growth\",\n", " x='filing_year'\n", - " ,facet_col=\"Country\",facet_col_wrap=6,category_orders={\"Country\": sorted(data[\"Country\"].unique())},\n", + " ,facet_col=\"Country\",facet_col_wrap=5,category_orders={\"Country\": sorted(data[\"Country\"].unique())},\n", " markers=True,\n", " labels={\n", " record_col+\"_relative_growth\": 'Relative growth of co-patents (%)',\n", " },\n", - " title=\"Yearly output of co-patents by patent authority\",hover_name= \"Country\")\n", + " title=\"Yearly rel. output of co-patents by patent authority\",hover_name= \"Country\")\n", "fig.update_traces(hovertemplate='%{hovertext}
%{x}
Co-publications: %{y}')\n", "fig.update_yaxes(\n", " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", @@ -7130,7 +6759,7 @@ "fig.update_xaxes(\n", " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", " ticks=\"outside\")\n", - "fig.update_layout({'template':\"plotly\"})\n", + "fig.update_layout({'template':\"plotly\"},font_family=\"Montserrat\")\n", "fig.update_yaxes(title='')\n", "fig.update_xaxes(title='')\n", "fig.for_each_annotation(lambda a: a.update(text=a.text.split(\"=\")[-1]))\n", @@ -7146,7 +6775,8 @@ "figsuper_ppt.update_yaxes(title='',zeroline=True, zerolinewidth=2, zerolinecolor='grey',tickformat=\".0%\")\n", "figsuper_ppt.update_yaxes(tickfont=dict(size=s))\n", "figsuper_ppt.update_xaxes(tickfont=dict(size=s),tickangle=45)\n", - "figsuper_ppt.show()" + "figsuper_ppt.show(height=800,width=1600,scale = 4)\n", + "figsuper_ppt.write_image(f\"{fromdir}/plots/yearly_rel_outputs.png\",height=800,width=1600,scale = 4)" ], "metadata": { "collapsed": false @@ -7154,7 +6784,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 405, "outputs": [], "source": [], "metadata": { @@ -7163,7 +6793,7 @@ }, { "cell_type": "code", - "execution_count": 131, + "execution_count": 446, "outputs": [ { "name": "stderr", @@ -7173,75 +6803,6 @@ "European Patent Office not found in regex\n" ] }, - { - "data": { - "text/plain": " appln_id appln_auth person_id invt_seq_nr applt_seq_nr \n136092 512548123 GB 55086687 0 1 \\\n140959 523940692 EP 69747486 0 1 \n145846 517778054 EP 77709457 3 0 \n111339 352908327 FR 46503468 4 0 \n102245 336208056 EP 5019334 1 0 \n... ... ... ... ... ... \n140952 513966940 EP 69747486 0 1 \n143598 546020617 DE 81337072 1 0 \n141356 512140061 NL 71325506 1 0 \n141273 488981411 EP 69749947 2 0 \n124034 407239903 EP 47903112 4 0 \n\n person_name person_ctry_code \n136092 TCL Communication Limited CN \\\n140959 Ningbo Geely Automobile Research & Development... CN \n145846 FORSBERG, Christian SE \n111339 GILIS, FABRICE CN \n102245 Carcone, Luca IT \n... ... ... \n140952 Ningbo Geely Automobile Research & Development... CN \n143598 Zhou, Hulian CN \n141356 JAN VAN DER HORST NL \n141273 Zuo, Fei CN \n124034 Wichmann, Daniel, Dr. DE \n\n psn_sector han_id han_name \n136092 COMPANY 3635036 TCL COMM LTD \\\n140959 COMPANY 3697072 NINGBO GEELY AUTOMOBILE R&D CO LTD \n145846 NaN 177709457 FORSBERG, Christian \n111339 NaN 146503468 GILIS, FABRICE \n102245 NaN 105019334 Carcone, Luca \n... ... ... ... \n140952 COMPANY 3697072 NINGBO GEELY AUTOMOBILE R&D CO LTD \n143598 NaN 181337072 Zhou, Hulian \n141356 NaN 171325506 JAN VAN DER HORST \n141273 NaN 169749947 Zuo, Fei \n124034 NaN 147903112 Wichmann, Daniel, Dr. \n\n person_ctry_code_fullname appln_auth_fullname person_ctry_ISO3 \n136092 China United Kingdom CHN \\\n140959 China European Patent Office CHN \n145846 Sweden European Patent Office SWE \n111339 China France CHN \n102245 Italy European Patent Office ITA \n... ... ... ... \n140952 China European Patent Office CHN \n143598 China Germany CHN \n141356 Netherlands Netherlands NLD \n141273 China European Patent Office CHN \n124034 Germany European Patent Office DEU \n\n person_ctry_type ISO3 auth_ISO3 auth_ctry_type \n136092 China CHN GBR Non-EU associate \n140959 China CHN not found EPO \n145846 EU SWE not found EPO \n111339 China CHN FRA EU \n102245 EU ITA not found EPO \n... ... ... ... ... \n140952 China CHN not found EPO \n143598 China CHN DEU EU \n141356 EU NLD NLD EU \n141273 China CHN not found EPO \n124034 EU DEU not found EPO \n\n[100 rows x 17 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_idappln_authperson_idinvt_seq_nrapplt_seq_nrperson_nameperson_ctry_codepsn_sectorhan_idhan_nameperson_ctry_code_fullnameappln_auth_fullnameperson_ctry_ISO3person_ctry_typeISO3auth_ISO3auth_ctry_type
136092512548123GB5508668701TCL Communication LimitedCNCOMPANY3635036TCL COMM LTDChinaUnited KingdomCHNChinaCHNGBRNon-EU associate
140959523940692EP6974748601Ningbo Geely Automobile Research & Development...CNCOMPANY3697072NINGBO GEELY AUTOMOBILE R&D CO LTDChinaEuropean Patent OfficeCHNChinaCHNnot foundEPO
145846517778054EP7770945730FORSBERG, ChristianSENaN177709457FORSBERG, ChristianSwedenEuropean Patent OfficeSWEEUSWEnot foundEPO
111339352908327FR4650346840GILIS, FABRICECNNaN146503468GILIS, FABRICEChinaFranceCHNChinaCHNFRAEU
102245336208056EP501933410Carcone, LucaITNaN105019334Carcone, LucaItalyEuropean Patent OfficeITAEUITAnot foundEPO
......................................................
140952513966940EP6974748601Ningbo Geely Automobile Research & Development...CNCOMPANY3697072NINGBO GEELY AUTOMOBILE R&D CO LTDChinaEuropean Patent OfficeCHNChinaCHNnot foundEPO
143598546020617DE8133707210Zhou, HulianCNNaN181337072Zhou, HulianChinaGermanyCHNChinaCHNDEUEU
141356512140061NL7132550610JAN VAN DER HORSTNLNaN171325506JAN VAN DER HORSTNetherlandsNetherlandsNLDEUNLDNLDEU
141273488981411EP6974994720Zuo, FeiCNNaN169749947Zuo, FeiChinaEuropean Patent OfficeCHNChinaCHNnot foundEPO
124034407239903EP4790311240Wichmann, Daniel, Dr.DENaN147903112Wichmann, Daniel, Dr.GermanyEuropean Patent OfficeDEUEUDEUnot foundEPO
\n

100 rows × 17 columns

\n
" - }, - "execution_count": 131, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# appln_pers_f = pd.read_csv(f\"{outdir}/first-filings-with-persons-raw.csv\", header=None,\n", - "# names=[\"appln_id\",\"appln_auth\",\"person_id\",\"invt_seq_nr\",\"applt_seq_nr\",'person_name',\"person_ctry_code\"])\n", - "\n", - "# appln_pers_haninfo = pd.read_csv(f\"{outdir}/tls_206_scope.csv\", usecols=[\"person_id\",\"han_id\",\"han_name\",\"psn_sector\"])\n", - "#\n", - "# appln_pers_f = appln_pers_f.merge(appln_pers_haninfo, on=\"person_id\")\n", - "#\n", - "# tls_801 = pd.read_csv(r\"./EU_CH_scope/table_tls801.csv\", low_memory=False)\n", - "# # tls_801.head()\n", - "# scope_df = tls_801[((tls_801.eu_member==\"Y\")|\n", - "# (tls_801.ctry_code == 'CN')|\n", - "# (tls_801.ctry_code == 'NO')|\n", - "# (tls_801.ctry_code == 'CH')|\n", - "# (tls_801.ctry_code == 'UK'))]\n", - "# scope_countries = scope_df[\"ctry_code\"].unique()\n", - "#\n", - "# appln_pers_f = appln_pers_f[appln_pers_f[\"person_ctry_code\"].isin(scope_countries)]\n", - "\n", - "for c in [\"person_ctry_code\",\"appln_auth\"]:\n", - " appln_pers_f[c+\"_fullname\"] = cc.pandas_convert(series=appln_pers_f[c], to='name_short')\n", - "\n", - "appln_pers_f[\"appln_auth_fullname\"] = appln_pers_f[\"appln_auth_fullname\"].str.replace(\"not found\",\"European Patent Office\")\n", - "appln_pers_f[\"ISO3\"] = cc.pandas_convert(series=appln_pers_f[\"person_ctry_code_fullname\"], to='ISO3')\n", - "appln_pers_f[\"person_ctry_type\"] = appln_pers_f[\"ISO3\"].apply(lambda x: \"China\" if x == \"CHN\" else \"Non-EU associate\" if x in [\"GBR\",\"CHE\",\"NOR\"] else \"EU\")\n", - "\n", - "appln_pers_f[\"auth_ISO3\"] = cc.pandas_convert(series=appln_pers_f[\"appln_auth_fullname\"], to='ISO3')\n", - "appln_pers_f[\"auth_ctry_type\"] = appln_pers_f[\"auth_ISO3\"].apply(lambda x: \"China\" if x == \"CHN\" else \"Non-EU associate\" if x in [\"GBR\",\"CHE\",\"NOR\"] else \"EU\" if x!='not found' else \"EPO\")\n", - "\n", - "appln_pers_f.sample(100)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 93, - "outputs": [ - { - "data": { - "text/plain": "array(['DEU', 'FRA', 'SWE', 'ESP', 'BEL', 'CHN', 'CHE', 'AUT', 'FIN',\n 'NLD', 'GRC', 'ITA', 'CZE', 'HUN', 'DNK', 'IRL', 'POL', 'LUX',\n 'CYP', 'PRT', 'NOR', 'ROU'], dtype=object)" - }, - "execution_count": 93, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_pers_f[\"person_ctry_ISO3\"].unique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 137, - "outputs": [ { "data": { "application/vnd.plotly.v1+json": { @@ -7263,39 +6824,39 @@ "textposition": "auto", "texttemplate": "%{x}", "x": [ - 12, + 252, + 89, + 83, + 62, + 13, + 10, 9, + 8, + 8, + 7, + 7, 6, 5, - 5, - 5, - 5, - 4, - 4, - 3, - 3, - 3, - 3, 3, 3 ], "xaxis": "x", "y": [ - "REN, CONG (CHN)", - "WU, ZILI (CHN)", - "VINCENT, GUILLAUME (CHN)", - "KOULECHOV, KIRILL (CHN)", - "TOM VAN POYER (CHN)", - "MA, CHAO (CHN)", - "LV, HUA (CHN)", - "GAYE ANDRE (CHN)", - "SVEN BOON (CHN)", - "MENG, YANG QIAO (CHN)", - "ANTHONY DREVET (CHN)", - "RANTALA, JUHA (CHN)", - "DERENTHAL, MARC-JEAN (CHN)", - "ZHANG, XIONGFEI (CHN)", - "ZHONG, CHONGCHENG (CHN)" + "NINGBO GEELY AUTOMOBILE R
D CO LTD (CHN)", + "TCL COMM LTD (CHN)", + "ZHEJIANG GEELY HOLDINGGROUP CO LTD (CHN)", + "HUAWEI TECH CO LTD (CHN)", + "CRRC QINGDAO SIFANG CO LTD (CHN)", + "BEIJING XIAOMI MOBILE SOFTWARE CO LTD (CHN)", + "ZF DRIVETECH SUZHOU CO LTD (CHN)", + "VENUS MEDTECH HANGZHOU INC (CHN)", + "ZHANGJIAGANG KANGDE XIN OPTRONICS MATERIAL CO LTD (CHN)", + "CNBM BENGBU DESIGN
RESEARCH INSTITUTE FOR GLASS IND CO LTD (CHN)", + "SHENZHEN GOODIX TECH CO LTD (CHN)", + "NOKIA SHANGHAI BELL CO LTD (CHN)", + "KEIPER SEATING MECHANISMS CO LTD (CHN)", + "HANERGY HOLDINGGROUP LTD (CHN)", + "SHANGHAI HENGXU MATERIALS CO LTD (CHN)" ], "yaxis": "y", "type": "bar" @@ -8151,7 +7712,7 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 12 } }, "legend": { @@ -8196,7 +7757,7 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -8207,54 +7768,54 @@ "data": [ { "alignmentgroup": "True", - "hovertemplate": "Country type=China
Number of co-patents=%{x}
Name=%{y}", - "legendgroup": "China", + "hovertemplate": "Country type=EU
Number of co-patents=%{x}
Name=%{y}", + "legendgroup": "EU", "marker": { - "color": "#EF553B", + "color": "#636EFA", "pattern": { "shape": "" } }, - "name": "China", - "offsetgroup": "China", + "name": "EU", + "offsetgroup": "EU", "orientation": "h", "showlegend": true, "textposition": "auto", "texttemplate": "%{x}", "x": [ + 39, + 24, + 23, + 14, + 13, + 13, 12, + 11, + 9, 9, + 9, + 8, 6, - 5, - 5, - 5, - 5, - 4, - 4, - 3, - 3, - 3, - 3, - 3, - 3 + 6, + 5 ], "xaxis": "x", "y": [ - "REN, CONG (CHN)", - "WU, ZILI (CHN)", - "VINCENT, GUILLAUME (CHN)", - "KOULECHOV, KIRILL (CHN)", - "TOM VAN POYER (CHN)", - "MA, CHAO (CHN)", - "LV, HUA (CHN)", - "GAYE ANDRE (CHN)", - "SVEN BOON (CHN)", - "MENG, YANG QIAO (CHN)", - "ANTHONY DREVET (CHN)", - "RANTALA, JUHA (CHN)", - "DERENTHAL, MARC-JEAN (CHN)", - "ZHANG, XIONGFEI (CHN)", - "ZHONG, CHONGCHENG (CHN)" + "ROBERT BOSCH GMBH (DEU)", + "ARKEMA FR (FRA)", + "CNRS (FRA)", + "ZF FRIEDRICHSHAFEN AG (DEU)", + "CG RAIL CHINESISCH DEUTSCHES FORSCHUNGS
ENTWICKLUNGSZENTRUM FUR BAHN
VERKEHRSTECHNIK DRESDEN GMBH (DEU)", + "SIEMENS AG (DEU)", + "BAYERISCHE MOTOREN WERKE AG (DEU)", + "L OREAL (FRA)", + "SEB SA (FRA)", + "SEW EURODRIVE GMBH
CO KG (DEU)", + "SCHAEFFLER TECH AG
CO KG (DEU)", + "BOSTIK SA (FRA)", + "BASF SE (DEU)", + "BSH HAUSGERATE GMBH (DEU)", + "TELEFONICA SA (ESP)" ], "yaxis": "y", "type": "bar" @@ -9110,7 +8671,7 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 12 } }, "legend": { @@ -9150,10 +8711,12 @@ } }, "config": { + "displayModeBar": false, + "responsive": true, "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -9164,54 +8727,78 @@ "data": [ { "alignmentgroup": "True", - "hovertemplate": "Country type=China
Number of co-patents=%{x}
Name=%{y}", - "legendgroup": "China", + "hovertemplate": "Sector=COMPANY
Number of co-patents=%{x}
Name=%{y}", + "legendgroup": "COMPANY", "marker": { - "color": "#EF553B", + "color": "#FFA15A", "pattern": { "shape": "" } }, - "name": "China", - "offsetgroup": "China", + "name": "COMPANY", + "offsetgroup": "COMPANY", "orientation": "h", "showlegend": true, "textposition": "auto", "texttemplate": "%{x}", "x": [ 252, - 90, - 80, - 68, - 15, + 89, + 83, + 62, 13, 10, - 10, 9, 8, 8, 7, 7, - 5, - 4 + 6, + 3, + 3 ], "xaxis": "x", "y": [ - "NINGBO GEELY AUTOMOBILE R&D CO LTD (CHN)", + "NINGBO GEELY AUTOMOBILE R
D CO LTD (CHN)", "TCL COMM LTD (CHN)", - "HUAWEI TECH CO LTD (CHN)", "ZHEJIANG GEELY HOLDINGGROUP CO LTD (CHN)", - "ZHEJIANG GEELY HOLDING GROUP CO., LTD (CHN)", + "HUAWEI TECH CO LTD (CHN)", "CRRC QINGDAO SIFANG CO LTD (CHN)", - "CNBM BENGBU DESIGN & RESEARCH INSTITUTE FOR GLASS IND CO LTD (CHN)", "BEIJING XIAOMI MOBILE SOFTWARE CO LTD (CHN)", "ZF DRIVETECH SUZHOU CO LTD (CHN)", "VENUS MEDTECH HANGZHOU INC (CHN)", "ZHANGJIAGANG KANGDE XIN OPTRONICS MATERIAL CO LTD (CHN)", + "CNBM BENGBU DESIGN
RESEARCH INSTITUTE FOR GLASS IND CO LTD (CHN)", "SHENZHEN GOODIX TECH CO LTD (CHN)", "NOKIA SHANGHAI BELL CO LTD (CHN)", - "KEIPER SEATING MECHANISMS CO LTD (CHN)", - "GOODIX TECH HK CO LTD (CHN)" + "HANERGY HOLDINGGROUP LTD (CHN)", + "SHANGHAI HENGXU MATERIALS CO LTD (CHN)" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Sector=UNKNOWN
Number of co-patents=%{x}
Name=%{y}", + "legendgroup": "UNKNOWN", + "marker": { + "color": "#19d3f3", + "pattern": { + "shape": "" + } + }, + "name": "UNKNOWN", + "offsetgroup": "UNKNOWN", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 5 + ], + "xaxis": "x", + "y": [ + "KEIPER SEATING MECHANISMS CO LTD (CHN)" ], "yaxis": "y", "type": "bar" @@ -10067,12 +9654,12 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 12 } }, "legend": { "title": { - "text": "Country type" + "text": "Sector" }, "tracegroupgap": 0 }, @@ -10112,7 +9699,7 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -10123,54 +9710,78 @@ "data": [ { "alignmentgroup": "True", - "hovertemplate": "Country type=China
Number of co-patents=%{x}
Name=%{y}", - "legendgroup": "China", + "hovertemplate": "Sector=COMPANY
Number of co-patents=%{x}
Name=%{y}", + "legendgroup": "COMPANY", "marker": { - "color": "#EF553B", + "color": "#FFA15A", "pattern": { "shape": "" } }, - "name": "China", - "offsetgroup": "China", + "name": "COMPANY", + "offsetgroup": "COMPANY", "orientation": "h", "showlegend": true, "textposition": "auto", "texttemplate": "%{x}", "x": [ - 252, - 90, - 80, - 68, - 15, + 39, + 24, + 14, 13, - 10, - 10, + 13, + 12, + 11, + 9, + 9, 9, 8, - 8, - 7, - 7, - 5, - 4 + 6, + 6, + 5 ], "xaxis": "x", "y": [ - "NINGBO GEELY AUTOMOBILE R&D CO LTD (CHN)", - "TCL COMM LTD (CHN)", - "HUAWEI TECH CO LTD (CHN)", - "ZHEJIANG GEELY HOLDINGGROUP CO LTD (CHN)", - "ZHEJIANG GEELY HOLDING GROUP CO., LTD (CHN)", - "CRRC QINGDAO SIFANG CO LTD (CHN)", - "CNBM BENGBU DESIGN & RESEARCH INSTITUTE FOR GLASS IND CO LTD (CHN)", - "BEIJING XIAOMI MOBILE SOFTWARE CO LTD (CHN)", - "ZF DRIVETECH SUZHOU CO LTD (CHN)", - "VENUS MEDTECH HANGZHOU INC (CHN)", - "ZHANGJIAGANG KANGDE XIN OPTRONICS MATERIAL CO LTD (CHN)", - "SHENZHEN GOODIX TECH CO LTD (CHN)", - "NOKIA SHANGHAI BELL CO LTD (CHN)", - "KEIPER SEATING MECHANISMS CO LTD (CHN)", - "GOODIX TECH HK CO LTD (CHN)" + "ROBERT BOSCH GMBH (DEU)", + "ARKEMA FR (FRA)", + "ZF FRIEDRICHSHAFEN AG (DEU)", + "CG RAIL CHINESISCH DEUTSCHES FORSCHUNGS
ENTWICKLUNGSZENTRUM FUR BAHN
VERKEHRSTECHNIK DRESDEN GMBH (DEU)", + "SIEMENS AG (DEU)", + "BAYERISCHE MOTOREN WERKE AG (DEU)", + "L OREAL (FRA)", + "SEB SA (FRA)", + "SEW EURODRIVE GMBH
CO KG (DEU)", + "SCHAEFFLER TECH AG
CO KG (DEU)", + "BOSTIK SA (FRA)", + "BASF SE (DEU)", + "BSH HAUSGERATE GMBH (DEU)", + "TELEFONICA SA (ESP)" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Sector=GOV NON-PROFIT
Number of co-patents=%{x}
Name=%{y}", + "legendgroup": "GOV NON-PROFIT", + "marker": { + "color": "#19d3f3", + "pattern": { + "shape": "" + } + }, + "name": "GOV NON-PROFIT", + "offsetgroup": "GOV NON-PROFIT", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 23 + ], + "xaxis": "x", + "y": [ + "CNRS (FRA)" ], "yaxis": "y", "type": "bar" @@ -11026,12 +10637,12 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 12 } }, "legend": { "title": { - "text": "Country type" + "text": "Sector" }, "tracegroupgap": 0 }, @@ -11066,81 +10677,623 @@ } }, "config": { + "displayModeBar": false, + "responsive": true, "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" - }, - { - "data": { - "application/vnd.plotly.v1+json": { - "data": [ - { - "alignmentgroup": "True", - "hovertemplate": "Country type=EU
Number of co-patents=%{x}
Name=%{y}", - "legendgroup": "EU", - "marker": { - "color": "#636EFA", - "pattern": { - "shape": "" - } - }, - "name": "EU", - "offsetgroup": "EU", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 38, - 26, - 22, - 20, - 18, - 18, - 16, - 16, - 15, - 13, - 13, - 13, - 12, - 12, - 12 - ], - "xaxis": "x", - "y": [ - "NILSSON, MAGNUS (SWE)", - "JOHANSSON, JONATHAN (SWE)", - "UMER SALIM (FRA)", - "GUANG LIU (FRA)", - "BENNY ASSOULINE (FRA)", - "OLIVIER MARCO (FRA)", - "LINDBERG NILSSON, ERIK (SWE)", - "EFSTATHIOS KATRANARAS (FRA)", - "BRUNO JECHOUX (FRA)", - "HUFENBACH, WERNER (DEU)", - "ULBRICHT ANDREAS (DEU)", - "ROY RON (FRA)", - "SETTERBERG, JOHAN (SWE)", - "SEEMANN, FRANK (DEU)", - "BORNTRÄGER, KAI (DEU)" - ], - "yaxis": "y", - "type": "bar" - } - ], - "layout": { - "template": { - "data": { - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", + } + ], + "source": [ + "# appln_pers_f = pd.read_csv(f\"{outdir}/first-filings-with-persons-raw.csv\", header=None,\n", + "# names=[\"appln_id\",\"appln_auth\",\"person_id\",\"invt_seq_nr\",\"applt_seq_nr\",'person_name',\"person_ctry_code\"])\n", + "\n", + "# appln_pers_haninfo = pd.read_csv(f\"{outdir}/tls_206_scope.csv\", usecols=[\"person_id\",\"han_id\",\"han_name\",\"psn_sector\"])\n", + "#\n", + "# appln_pers_f = appln_pers_f.merge(appln_pers_haninfo, on=\"person_id\")\n", + "#\n", + "# tls_801 = pd.read_csv(r\"./EU_CH_scope/table_tls801.csv\", low_memory=False)\n", + "# # tls_801.head()\n", + "# scope_df = tls_801[((tls_801.eu_member==\"Y\")|\n", + "# (tls_801.ctry_code == 'CN')|\n", + "# (tls_801.ctry_code == 'NO')|\n", + "# (tls_801.ctry_code == 'CH')|\n", + "# (tls_801.ctry_code == 'UK'))]\n", + "# scope_countries = scope_df[\"ctry_code\"].unique()\n", + "#\n", + "# appln_pers_f = appln_pers_f[appln_pers_f[\"person_ctry_code\"].isin(scope_countries)]\n", + "\n", + "for c in [\"person_ctry_code\",\"appln_auth\"]:\n", + " appln_pers_f[c+\"_fullname\"] = cc.pandas_convert(series=appln_pers_f[c], to='name_short')\n", + "\n", + "appln_pers_f[\"appln_auth_fullname\"] = appln_pers_f[\"appln_auth_fullname\"].str.replace(\"not found\",\"European Patent Office\")\n", + "appln_pers_f[\"person_ctry_ISO3\"] = cc.pandas_convert(series=appln_pers_f[\"person_ctry_code_fullname\"], to='ISO3')\n", + "appln_pers_f[\"person_ctry_type\"] = appln_pers_f[\"person_ctry_ISO3\"].apply(lambda x: \"China\" if x == \"CHN\" else \"Non-EU associate\" if x in [\"GBR\",\"CHE\",\"NOR\"] else \"EU\")\n", + "\n", + "appln_pers_f[\"auth_ISO3\"] = cc.pandas_convert(series=appln_pers_f[\"appln_auth_fullname\"], to='ISO3')\n", + "appln_pers_f[\"auth_ctry_type\"] = appln_pers_f[\"auth_ISO3\"].apply(lambda x: \"China\" if x == \"CHN\" else \"Non-EU associate\" if x in [\"GBR\",\"CHE\",\"NOR\"] else \"EU\" if x!='not found' else \"EPO\")\n", + "\n", + "# top 25\n", + "# - inventor\n", + "# - applicant\n", + "# in china, EU, EUextended\n", + "color_discrete_map= {'China': '#EF553B',\n", + " 'EU': '#636EFA',\n", + " 'Non-EU associate': '#00CC96',\n", + " 'EPO':'#9F2B68'}\n", + "\n", + "labeld_dict = dict({\n", + " record_col: 'Number of co-patents',\n", + " \"person_ctry_type\": \"Country type\",\n", + " \"psn_sector_primary\":\"Sector\",\n", + " \"han_label\": \"Name\",\n", + " \"Country_Type\":\"Country type\",\n", + " \"Eurovoc_Class\":\"Region\"\n", + " })\n", + "for trait in [\"person_ctry_type\",\"psn_sector_primary\"]:\n", + " for ctry in [\"China\",'EU']:\n", + " ctry_subset = appln_pers_f[appln_pers_f[\"person_ctry_type\"].str.contains(ctry)]\n", + " # for role in [\"invt\",\"applt\"]:\n", + " if True:\n", + " role = \"applt\"\n", + " pers_sub = ctry_subset[ctry_subset[role+\"_seq_nr\"]!=0]\n", + " data = (pers_sub\n", + " .groupby([\"han_id\",'han_name'],as_index=False)\n", + " .agg({'appln_id': 'nunique', 'person_ctry_ISO3': 'first',trait:\"first\"})\n", + " .sort_values(by=\"appln_id\", ascending=False)\n", + " .head(15))\n", + " data[\"han_label\"] = (data[\"han_name\"]\n", + " .str.upper()\n", + " .str.strip(\".\")\n", + " .str.replace(\"&\",\"
\")\n", + " + \" (\"+data[\"person_ctry_ISO3\"]+\")\")\n", + "\n", + " fig = px.bar(data, x=record_col, y=\"han_label\", color=trait,\n", + " color_discrete_map=color_discrete_map,text_auto=True,labels=labeld_dict)\n", + " fig.update_layout(font_family=\"Montserrat\",\n", + " yaxis={'categoryorder':'total ascending'})\n", + "\n", + " figsuper = fig\n", + " figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative',yaxis2={'categoryorder':'total ascending'},yaxis3={'categoryorder':'total ascending'})\n", + " figsuper.update_yaxes(\n", + " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", + " ticks=\"outside\")\n", + " figsuper.update_xaxes(\n", + " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", + " ticks=\"outside\")\n", + " figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", + "\n", + " figsuper['layout'][\"font\"][\"size\"]=12\n", + " for a in figsuper['layout'][\"annotations\"]:\n", + " a[\"font\"][\"size\"] = 14\n", + " figsuper[\"layout\"][\"yaxis\"][\"tickfont\"][\"size\"] = 12\n", + "\n", + " figsuper.update_layout(uniformtext_minsize=10)\n", + "\n", + " figsuper.show(config= dict(displayModeBar = False, responsive = True),height=800,width=1600,scale = 4)\n", + " figsuper.write_image(f\"{fromdir}/plots/top15_applt_{trait}_{ctry}.png\",height=900,width=1200,scale = 4)" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 452, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\radvanyi\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\core\\internals\\blocks.py:329: RuntimeWarning:\n", + "\n", + "divide by zero encountered in log10\n", + "\n" + ] + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "coloraxis": "coloraxis", + "name": "0", + "texttemplate": "%{text}", + "x": [ + "Sweden", + "Germany", + "France", + "Austria", + "Netherlands", + "Finland", + "Spain", + "Belgium", + "Italy" + ], + "y": [ + "NINGBO GEELY AUTOMOBILE R&D CO LTD", + "TCL COMM LTD", + "ZHEJIANG GEELY HOLDINGGROUP CO LTD", + "HUAWEI TECH CO LTD", + "ZF DRIVETECH SUZHOU CO LTD", + "CRRC QINGDAO SIFANG CO LTD", + "BEIJING XIAOMI MOBILE SOFTWARE CO LTD", + "ZHANGJIAGANG KANGDE XIN OPTRONICS MATERIAL CO LTD", + "VENUS MEDTECH HANGZHOU INC", + "CNBM BENGBU DESIGN & RESEARCH INSTITUTE FOR GLASS IND CO LTD", + "SHENZHEN GOODIX TECH CO LTD", + "NOKIA SHANGHAI BELL CO LTD", + "KEIPER SEATING MECHANISMS CO LTD", + "HANERGY HOLDINGGROUP LTD", + "INKRON LTD", + "FOCUSLIGHT TECH INC", + "CHINA TRIUMPH INT ENGINEERING CO LTD", + "MICRO TECH NANJING CO LTD", + "ANHUI MEIZHI COMPRESSOR CO LTD", + "SHANGHAI HENGXU MATERIALS CO LTD" + ], + "z": [ + [ + 3.399673721481038, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0 + ], + [ + 0.0, + 0.0, + 2.949390006644913, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 2.9190780923760737, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 1.9542425094393248, + 2.681241237375587, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 1.6989700043360187, + 0.0 + ], + [ + 0.0, + 1.9542425094393248, + 0.0, + 1.9542425094393248, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 2.113943352306837, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 2.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 1.9030899869919435, + 0.0, + 1.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.9030899869919435, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.845098040014257, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.845098040014257, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.0, + 1.6989700043360187, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.6989700043360187, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 1.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 0.0, + 0.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + [ + 0.0, + 1.4771212547196624, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + ], + "type": "heatmap", + "xaxis": "x", + "yaxis": "y", + "hovertemplate": "Inventor (EU): %{x}
Applicant (CN): %{y}
color: %{z}", + "text": [ + [ + 251, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1 + ], + [ + 0, + 0, + 89, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 83, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 9, + 48, + 0, + 0, + 0, + 1, + 0, + 5, + 0 + ], + [ + 0, + 9, + 0, + 9, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 13, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 10, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 8, + 0, + 1, + 0, + 0 + ], + [ + 0, + 8, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 7, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 1, + 5, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 0, + 0, + 3, + 0, + 0, + 0 + ], + [ + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0 + ], + [ + 0, + 3, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + } + ], + "layout": { + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "white", "width": 0.5 }, "pattern": { @@ -11162,7 +11315,7 @@ }, "marker": { "line": { - "color": "#E5ECF6", + "color": "white", "width": 0.5 }, "pattern": { @@ -11178,16 +11331,16 @@ { "aaxis": { "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f" }, "type": "carpet" @@ -11844,10 +11997,10 @@ "geo": { "bgcolor": "white", "lakecolor": "white", - "landcolor": "#E5ECF6", + "landcolor": "white", "showlakes": true, "showland": true, - "subunitcolor": "white" + "subunitcolor": "#C8D4E3" }, "hoverlabel": { "align": "left" @@ -11857,47 +12010,47 @@ "style": "light" }, "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", + "plot_bgcolor": "white", "polar": { "angularaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "white", "radialaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", "ticks": "" } }, "scene": { "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#EBF0F8" }, "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#EBF0F8" }, "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", "gridwidth": 2, - "linecolor": "white", + "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", - "zerolinecolor": "white" + "zerolinecolor": "#EBF0F8" } }, "shapedefaults": { @@ -11907,19 +12060,19 @@ }, "ternary": { "aaxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", "ticks": "" }, "baxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", "ticks": "" }, - "bgcolor": "#E5ECF6", + "bgcolor": "white", "caxis": { - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", "ticks": "" } }, @@ -11928,24 +12081,24 @@ }, "xaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#EBF0F8", "zerolinewidth": 2 }, "yaxis": { "automargin": true, - "gridcolor": "white", - "linecolor": "white", + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", "ticks": "", "title": { "standoff": 15 }, - "zerolinecolor": "white", + "zerolinecolor": "#EBF0F8", "zerolinewidth": 2 } } @@ -11956,15 +12109,17 @@ 0.0, 1.0 ], + "scaleanchor": "y", + "constrain": "domain", "title": { - "text": "Number of co-patents" + "text": "Inventor (EU)" }, - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" + "showgrid": false, + "tickangle": 45, + "ticks": "outside", + "tickfont": { + "size": 16 + } }, "yaxis": { "anchor": "x", @@ -11972,55 +12127,82 @@ 0.0, 1.0 ], + "autorange": "reversed", + "constrain": "domain", "title": { - "text": "Name" + "text": "Applicant (CN)" }, - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, + "showgrid": false, "ticks": "outside", "tickfont": { - "size": 10 + "size": 16 } }, - "legend": { - "title": { - "text": "Country type" + "coloraxis": { + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "colorbar": { + "thicknessmode": "pixels", + "thickness": 25, + "ticks": "outside", + "ticksuffix": " ", + "dtick": 20, + "outlinewidth": 1 }, - "tracegroupgap": 0 + "showscale": false }, "margin": { "t": 60 }, - "barmode": "relative", + "title": { + "x": 0.5 + }, "font": { "family": "Montserrat", - "size": 12 - }, - "yaxis2": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis3": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" + "size": 16 }, - "uniformtext": { - "minsize": 10 - } + "width": 1000, + "height": 1000 }, "config": { "displayModeBar": false, @@ -12028,18 +12210,142 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" - }, + } + ], + "source": [ + "applt_sub = appln_pers_f[((appln_pers_f[\"applt_seq_nr\"]!=0)&\n", + " (appln_pers_f[\"psn_sector_primary\"]!=\"INDIVIDUAL\"))]\n", + "invt_sub = appln_pers_f[appln_pers_f[\"invt_seq_nr\"]!=0]\n", + "\n", + "eu_applt_subset = applt_sub[~applt_sub[\"person_ctry_type\"].str.contains(\"China\")]\n", + "ch_applt_subset = applt_sub[applt_sub[\"person_ctry_type\"].str.contains(\"China\")]\n", + "\n", + "eu_invt_subset = invt_sub[~invt_sub[\"person_ctry_type\"].str.contains(\"China\")]\n", + "ch_invt_subset = invt_sub[invt_sub[\"person_ctry_type\"].str.contains(\"China\")]\n", + "\n", + "#\n", + "# patstat_applt_dipol = eu_invt_subset.merge(ch_applt_subset, on=record_col, suffixes=('_eu', '_ch'))\n", + "# patstat_applt_dipol.sample(100)\n", + "\n", + "patstat_applt_dipol = eu_applt_subset.merge(ch_applt_subset, on=record_col, suffixes=('_eu', '_ch'))\n", + "patstat_applt_inv_dipol = eu_invt_subset.merge(ch_applt_subset, on=record_col, suffixes=('_eu', '_ch'))\n", + "\n", + "# co_occur = pd.crosstab(patstat_applt_dipol['han_name_eu'], patstat_applt_dipol['han_name_ch'],\n", + "# values=patstat_applt_dipol[record_col], aggfunc='nunique').fillna(0).astype(int)\n", + "co_occur = pd.crosstab(patstat_applt_inv_dipol['person_ctry_code_fullname_eu'], patstat_applt_inv_dipol['han_name_ch'],\n", + " values=patstat_applt_inv_dipol[record_col], aggfunc='nunique').fillna(0).astype(int)\n", + "\n", + "\n", + "co_occur = co_occur.T\n", + "co_occur[\"sum\"] = co_occur.sum(axis=1)\n", + "co_occur = co_occur[co_occur.sum(0).sort_values(ascending=False).index]\n", + "\n", + "co_occur = (co_occur\n", + " .sort_values(by=\"sum\", ascending=False)\n", + " .head(20)\n", + " .drop(columns=\"sum\")\n", + " .replace(0,np.nan)\n", + " .dropna(axis=1,how=\"all\")\n", + " .replace(np.nan,0)\n", + " .astype(int))\n", + "\n", + "fig = px.imshow(np.nan_to_num(np.log10(co_occur)+1,neginf=0),#co_occur,\n", + " labels=dict(x=\"Inventor (EU)\", y=\"Applicant (CN)\", z=co_occur.values.astype(str)),# color=\"Co-patent\"),\n", + " x=list(co_occur.columns),\n", + " text_auto=True,\n", + " y=list(co_occur.index))\n", + "\n", + "\n", + "fig.update_layout(title_x=0.5,\n", + " width=1000, height=1000,\n", + " xaxis_showgrid=False,\n", + " yaxis_showgrid=False,\n", + " yaxis_autorange='reversed',\n", + " font_family=\"Montserrat\",\n", + " template='plotly_white',\n", + " coloraxis_colorbar=dict(\n", + " thicknessmode=\"pixels\", thickness=25,\n", + " ticks=\"outside\", ticksuffix=\" \",\n", + " dtick=20,outlinewidth=1,\n", + " ))\n", + "\n", + "# fig.update_traces(texttemplate='%{z}')\n", + "# fig.update_traces(z=co_occur.values)\n", + "# fig.update(data=[{'customdata': co_occur}])\n", + "# fig.update(data=[{'customdata': co_occur,\n", + "# 'hovertemplate': \"(x) %{x} product: %{customdata[0]}
(y) %{y} product: %{customdata[1]}
%{z}\"}])\n", + "# fig.update_traces(texttemplate='%{customdata}')\n", + "fig.update_traces(text=co_occur, texttemplate=\"%{text}\")\n", + "fig.update(layout_coloraxis_showscale=False)\n", + "fig.update_xaxes(tickangle= -45)\n", + "fig.update_yaxes(\n", + " ticks=\"outside\")\n", + "fig.update_xaxes(\n", + " ticks=\"outside\")\n", + "\n", + "figsuper_ppt = fig\n", + "figsuper_ppt['layout'][\"font\"][\"size\"]=16\n", + "for a in figsuper_ppt['layout'][\"annotations\"]:\n", + " a[\"font\"][\"size\"] = 16\n", + "\n", + "s=16\n", + "figsuper_ppt.update_yaxes(tickfont=dict(size=s))\n", + "figsuper_ppt.update_xaxes(tickfont=dict(size=s),tickangle=45)\n", + "\n", + "figsuper_ppt.show(config= dict(displayModeBar = False, responsive = True))\n", + "\n", + "figsuper_ppt.write_image(rf\"{fromdir}/plots/CN_applt_ctry.png\",height=900,width=1200,scale = 4)" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 453, + "outputs": [], + "source": [ + "patstat_applt_dipol_2 = (patstat_applt_dipol\n", + " .groupby([\"han_name_ch\",\"han_name_eu\"], as_index=False)\n", + " .agg({\"psn_sector_primary_ch\":\"first\",\n", + " \"psn_sector_primary_eu\":\"first\",\n", + " \"person_ctry_ISO3_eu\":\"first\",\n", + " record_col:\"nunique\"})\n", + " .sort_values(by=record_col, ascending=False)\n", + " .head(-1))\n", + "patstat_applt_dipol_2[\"applt_eu_label\"] = (patstat_applt_dipol_2[\"han_name_eu\"]\n", + " +\" (\"\n", + " +patstat_applt_dipol_2[\"person_ctry_ISO3_eu\"]\n", + " +\"; \"\n", + " +patstat_applt_dipol_2[\"psn_sector_primary_eu\"]\n", + " +\")\")\n", + "\n", + "patstat_applt_dipol_2[\"applt_ch_label\"] = (patstat_applt_dipol_2[\"han_name_ch\"]\n", + " +\" (\"\n", + " +patstat_applt_dipol_2[\"psn_sector_primary_ch\"]\n", + " +\")\")\n", + "\n", + "patstat_applt_dipol_2[[\"applt_ch_label\",\"applt_eu_label\",\"appln_id\"]].to_excel(rf\"{fromdir}/plots/applt_table.xlsx\", index=False)" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 456, + "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "data": [ { "alignmentgroup": "True", - "hovertemplate": "Country type=EU
Number of co-patents=%{x}
Name=%{y}", + "hovertemplate": "Country type=EU
Percent of related co-patents=%{x}
Inventor's country=%{y}", "legendgroup": "EU", "marker": { "color": "#636EFA", @@ -12054,40 +12360,100 @@ "textposition": "auto", "texttemplate": "%{x}", "x": [ - 38, - 26, - 22, - 20, - 18, - 18, - 16, - 16, - 15, - 13, - 13, - 13, - 12, - 12, - 12 + 0.026590693257359924, + 0.027540360873694207, + 0.005698005698005698, + 0.003798670465337132, + 0.012345679012345678, + 0.2222222222222222, + 0.3380816714150047, + 0.001899335232668566, + 0.002849002849002849, + 9.49667616334283E-4, + 0.020892687559354226, + 9.49667616334283E-4, + 0.023741690408357077, + 0.003798670465337132, + 9.49667616334283E-4, + 9.49667616334283E-4, + 0.02564102564102564, + 0.26020892687559355 ], "xaxis": "x", "y": [ - "NILSSON, MAGNUS (SWE)", - "JOHANSSON, JONATHAN (SWE)", - "UMER SALIM (FRA)", - "GUANG LIU (FRA)", - "BENNY ASSOULINE (FRA)", - "OLIVIER MARCO (FRA)", - "LINDBERG NILSSON, ERIK (SWE)", - "EFSTATHIOS KATRANARAS (FRA)", - "BRUNO JECHOUX (FRA)", - "HUFENBACH, WERNER (DEU)", - "ULBRICHT ANDREAS (DEU)", - "ROY RON (FRA)", - "SETTERBERG, JOHAN (SWE)", - "SEEMANN, FRANK (DEU)", - "BORNTRÄGER, KAI (DEU)" - ], + "Austria", + "Belgium", + "Czech Republic", + "Denmark", + "Finland", + "France", + "Germany", + "Greece", + "Hungary", + "Ireland", + "Italy", + "Luxembourg", + "Netherlands", + "Poland", + "Portugal", + "Romania", + "Spain", + "Sweden" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Country type=China
Percent of related co-patents=%{x}
Inventor's country=%{y}", + "legendgroup": "China", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "China", + "offsetgroup": "China", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 0.5042735042735043 + ], + "xaxis": "x", + "y": [ + "China" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Country type=Non-EU associate
Percent of related co-patents=%{x}
Inventor's country=%{y}", + "legendgroup": "Non-EU associate", + "marker": { + "color": "#00CC96", + "pattern": { + "shape": "" + } + }, + "name": "Non-EU associate", + "offsetgroup": "Non-EU associate", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 9.49667616334283E-4, + 0.010446343779677113 + ], + "xaxis": "x", + "y": [ + "Norway", + "Switzerland" + ], "yaxis": "y", "type": "bar" } @@ -12916,8 +13282,9 @@ 1.0 ], "title": { - "text": "Number of co-patents" + "text": "Percent of related co-patents" }, + "tickformat": ".1%", "showgrid": true, "showline": true, "linewidth": 1, @@ -12932,7 +13299,7 @@ 1.0 ], "title": { - "text": "Name" + "text": "Inventor's country" }, "categoryorder": "total ascending", "showgrid": true, @@ -12942,7 +13309,7 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 14 } }, "legend": { @@ -12957,7 +13324,7 @@ "barmode": "relative", "font": { "family": "Montserrat", - "size": 12 + "size": 14 }, "yaxis2": { "categoryorder": "total ascending", @@ -12985,7 +13352,7 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -12996,7 +13363,7 @@ "data": [ { "alignmentgroup": "True", - "hovertemplate": "Country type=EU
Number of co-patents=%{x}
Name=%{y}", + "hovertemplate": "Country type=EU
Percent of related co-patents=%{x}
Applicant's country=%{y}", "legendgroup": "EU", "marker": { "color": "#636EFA", @@ -13011,39 +13378,93 @@ "textposition": "auto", "texttemplate": "%{x}", "x": [ - 39, - 24, - 23, - 14, - 13, - 13, - 12, - 11, - 9, - 9, - 9, - 8, - 6, - 6, - 5 + 0.003872216844143272, + 0.007744433688286544, + 9.68054211035818E-4, + 0.002904162633107454, + 0.001936108422071636, + 0.013552758954501452, + 0.14908034849951599, + 0.2575024201355276, + 0.00484027105517909, + 0.00484027105517909, + 0.003872216844143272, + 0.011616650532429816, + 9.68054211035818E-4, + 0.021297192642787996, + 0.00968054211035818 ], "xaxis": "x", "y": [ - "ROBERT BOSCH GMBH (DEU)", - "ARKEMA FR (FRA)", - "CNRS (FRA)", - "ZF FRIEDRICHSHAFEN AG (DEU)", - "CG RAIL CHINESISCH DEUTSCHES FORSCHUNGS & ENTWICKLUNGSZENTRUM FUR BAHN & VERKEHRSTECHNIK DRESDEN GMBH (DEU)", - "SIEMENS AG (DEU)", - "BAYERISCHE MOTOREN WERKE AG (DEU)", - "L OREAL (FRA)", - "SEB SA (FRA)", - "SEW EURODRIVE GMBH & CO KG (DEU)", - "SCHAEFFLER TECH AG&CO KG (DEU)", - "BOSTIK SA (FRA)", - "BASF SE (DEU)", - "BSH HAUSGERATE GMBH (DEU)", - "TELEFONICA SA (ESP)" + "Austria", + "Belgium", + "Cyprus", + "Czech Republic", + "Denmark", + "Finland", + "France", + "Germany", + "Ireland", + "Italy", + "Luxembourg", + "Netherlands", + "Portugal", + "Spain", + "Sweden" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Country type=China
Percent of related co-patents=%{x}
Applicant's country=%{y}", + "legendgroup": "China", + "marker": { + "color": "#EF553B", + "pattern": { + "shape": "" + } + }, + "name": "China", + "offsetgroup": "China", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 0.5575992255566312 + ], + "xaxis": "x", + "y": [ + "China" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Country type=Non-EU associate
Percent of related co-patents=%{x}
Applicant's country=%{y}", + "legendgroup": "Non-EU associate", + "marker": { + "color": "#00CC96", + "pattern": { + "shape": "" + } + }, + "name": "Non-EU associate", + "offsetgroup": "Non-EU associate", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 9.68054211035818E-4, + 0.018393030009680542 + ], + "xaxis": "x", + "y": [ + "Norway", + "Switzerland" ], "yaxis": "y", "type": "bar" @@ -13873,8 +14294,9 @@ 1.0 ], "title": { - "text": "Number of co-patents" + "text": "Percent of related co-patents" }, + "tickformat": ".1%", "showgrid": true, "showline": true, "linewidth": 1, @@ -13889,7 +14311,7 @@ 1.0 ], "title": { - "text": "Name" + "text": "Applicant's country" }, "categoryorder": "total ascending", "showgrid": true, @@ -13899,7 +14321,7 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 14 } }, "legend": { @@ -13914,7 +14336,7 @@ "barmode": "relative", "font": { "family": "Montserrat", - "size": 12 + "size": 14 }, "yaxis2": { "categoryorder": "total ascending", @@ -13939,12 +14361,10 @@ } }, "config": { - "displayModeBar": false, - "responsive": true, "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" @@ -13955,7 +14375,7 @@ "data": [ { "alignmentgroup": "True", - "hovertemplate": "Country type=EU
Number of co-patents=%{x}
Name=%{y}", + "hovertemplate": "Authority type=EU
Percent of related co-patents=%{x}
Application authority=%{y}", "legendgroup": "EU", "marker": { "color": "#636EFA", @@ -13970,86 +14390,132 @@ "textposition": "auto", "texttemplate": "%{x}", "x": [ - 39, - 24, - 23, - 14, - 13, - 13, - 12, - 11, - 9, - 9, - 9, - 8, - 6, - 6, - 5 + 0.005687203791469194, + 0.0018957345971563982, + 0.0037914691943127963, + 0.0018957345971563982, + 0.01042654028436019, + 0.10710900473933649, + 0.22843601895734597, + 0.004739336492890996, + 0.025592417061611375, + 9.478672985781991E-4, + 0.014218009478672985, + 0.006635071090047393 ], "xaxis": "x", "y": [ - "ROBERT BOSCH GMBH (DEU)", - "ARKEMA FR (FRA)", - "CNRS (FRA)", - "ZF FRIEDRICHSHAFEN AG (DEU)", - "CG RAIL CHINESISCH DEUTSCHES FORSCHUNGS & ENTWICKLUNGSZENTRUM FUR BAHN & VERKEHRSTECHNIK DRESDEN GMBH (DEU)", - "SIEMENS AG (DEU)", - "BAYERISCHE MOTOREN WERKE AG (DEU)", - "L OREAL (FRA)", - "SEB SA (FRA)", - "SEW EURODRIVE GMBH & CO KG (DEU)", - "SCHAEFFLER TECH AG&CO KG (DEU)", - "BOSTIK SA (FRA)", - "BASF SE (DEU)", - "BSH HAUSGERATE GMBH (DEU)", - "TELEFONICA SA (ESP)" + "Austria", + "Belgium", + "Czech Republic", + "Denmark", + "Finland", + "France", + "Germany", + "Luxembourg", + "Netherlands", + "Portugal", + "Spain", + "Sweden" ], "yaxis": "y", "type": "bar" - } - ], - "layout": { - "template": { - "data": { - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "carpet": [ + }, + { + "alignmentgroup": "True", + "hovertemplate": "Authority type=EPO
Percent of related co-patents=%{x}
Application authority=%{y}", + "legendgroup": "EPO", + "marker": { + "color": "#7F00FF", + "pattern": { + "shape": "" + } + }, + "name": "EPO", + "offsetgroup": "EPO", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 0.4881516587677725 + ], + "xaxis": "x", + "y": [ + "European Patent Office" + ], + "yaxis": "y", + "type": "bar" + }, + { + "alignmentgroup": "True", + "hovertemplate": "Authority type=Non-EU associate
Percent of related co-patents=%{x}
Application authority=%{y}", + "legendgroup": "Non-EU associate", + "marker": { + "color": "#00CC96", + "pattern": { + "shape": "" + } + }, + "name": "Non-EU associate", + "offsetgroup": "Non-EU associate", + "orientation": "h", + "showlegend": true, + "textposition": "auto", + "texttemplate": "%{x}", + "x": [ + 0.1004739336492891 + ], + "xaxis": "x", + "y": [ + "United Kingdom" + ], + "yaxis": "y", + "type": "bar" + } + ], + "layout": { + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "#E5ECF6", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", @@ -14832,8 +15298,9 @@ 1.0 ], "title": { - "text": "Number of co-patents" + "text": "Percent of related co-patents" }, + "tickformat": ".1%", "showgrid": true, "showline": true, "linewidth": 1, @@ -14848,7 +15315,7 @@ 1.0 ], "title": { - "text": "Name" + "text": "Application authority" }, "categoryorder": "total ascending", "showgrid": true, @@ -14858,12 +15325,12 @@ "mirror": true, "ticks": "outside", "tickfont": { - "size": 10 + "size": 14 } }, "legend": { "title": { - "text": "Country type" + "text": "Authority type" }, "tracegroupgap": 0 }, @@ -14873,7 +15340,7 @@ "barmode": "relative", "font": { "family": "Montserrat", - "size": 12 + "size": 14 }, "yaxis2": { "categoryorder": "total ascending", @@ -14901,42 +15368,74 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" } ], "source": [ + "# percent of publications related to\n", + "# -authority country\n", + "# -inventor country\n", + "# -applicant country\n", + "\n", "color_discrete_map= {'China': '#EF553B',\n", " 'EU': '#636EFA',\n", " 'Non-EU associate': '#00CC96',\n", - " 'EPO':'#9F2B68'}\n", + " 'EPO':'#7F00FF'}#CC8899\n", + "\n", "\n", "labeld_dict = dict({\n", - " record_col: 'Number of co-patents',\n", - " \"person_ctry_type\": \"Country type\",\n", - " \"han_label\": \"Name\",\n", - " \"Country_Type\":\"Country type\",\n", - " \"Eurovoc_Class\":\"Region\"\n", - " },**c_dict)\n", + " record_col+\"_percent\": 'Percent of related co-patents',\n", + " \"person_ctry_code_fullname\": \"Country\",\n", + " \"person_ctry_type\": \"Country type\",\n", + " \"appln_auth_fullname\": \"Application authority\",\n", + " \"auth_ctry_type\": \"Authority type\",\n", + " \"Country_Type\":\"Country type\",\n", + " \"Eurovoc_Class\":\"Region\"\n", + " })\n", + "\n", + "for c in [\"person_ctry_code\",\"appln_auth\"]:\n", + " pers_sub = appln_pers_f\n", + " if c == \"person_ctry_code\":\n", + " for role in [\"invt\",\"applt\"]:\n", + " pers_sub = appln_pers_f[appln_pers_f[role+\"_seq_nr\"]!=0]\n", + " role_name = {\"invt\":\"Inventor's\", \"applt\":\"Applicant's\"}.get(role)\n", + " labeld_dict[\"person_ctry_code_fullname\"] = role_name+\" country\"\n", + "\n", "\n", - "for ctry in [\"China\",'EU']:\n", - " ctry_subset = appln_pers_f[appln_pers_f[\"person_ctry_type\"].str.contains(ctry)]\n", - " for role in [\"invt\",\"applt\"]:\n", - " pers_sub = ctry_subset[ctry_subset[role+\"_seq_nr\"]!=0]\n", - " data = (pers_sub\n", - " .groupby([\"han_id\",'han_name'],as_index=False)\n", - " .agg({'appln_id': 'nunique', 'person_ctry_ISO3': 'first',\"person_ctry_type\":\"first\"})\n", - " .sort_values(by=\"appln_id\", ascending=False)\n", - " .head(15))\n", - " data[\"han_label\"] = data[\"han_name\"].str.upper().str.strip(\".\")+ \" (\"+data[\"person_ctry_ISO3\"]+\")\"\n", + " data = (pers_sub.groupby(c+\"_fullname\",as_index=False).agg({'appln_id': 'nunique', 'person_ctry_ISO3': 'first',\"person_ctry_type\":\"first\"}))\n", + " data[record_col+\"_percent\"] = data[record_col]/pers_sub[record_col].nunique()\n", + " fig = px.bar(data, x=record_col+\"_percent\", y=c+\"_fullname\",color_discrete_map=color_discrete_map,text_auto=True,color=\"person_ctry_type\",\n", + " labels = labeld_dict)\n", + " fig.update_layout(xaxis_tickformat='.1%',font_family=\"Montserrat\",\n", + " yaxis={'categoryorder':'total ascending'},)\n", + " figsuper = fig\n", + " figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative',yaxis2={'categoryorder':'total ascending'},yaxis3={'categoryorder':'total ascending'})\n", + " figsuper.update_yaxes(\n", + " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", + " ticks=\"outside\")\n", + " figsuper.update_xaxes(\n", + " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", + " ticks=\"outside\")\n", + " figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", "\n", - " fig = px.bar(data, x=record_col, y=\"han_label\", color=\"person_ctry_type\",\n", - " color_discrete_map=color_discrete_map,text_auto=True,labels=labeld_dict)\n", - " fig.update_layout(font_family=\"Montserrat\",\n", - " yaxis={'categoryorder':'total ascending'})\n", + " figsuper['layout'][\"font\"][\"size\"]=14\n", + " for a in figsuper['layout'][\"annotations\"]:\n", + " a[\"font\"][\"size\"] = 14\n", + " figsuper[\"layout\"][\"yaxis\"][\"tickfont\"][\"size\"] = 14\n", "\n", + " figsuper.update_layout(uniformtext_minsize=10)\n", + " figsuper.write_image(rf\"{fromdir}/plots/{role}_loc_ctry.png\",height=900,width=1200,scale = 4)\n", + " figsuper.show()\n", + " else:\n", + " data = pers_sub.groupby(c+\"_fullname\",as_index=False).agg({'appln_id': 'nunique', 'auth_ISO3': 'first',\"auth_ctry_type\":\"first\"})\n", + " data[record_col+\"_percent\"] = data[record_col]/pers_sub[record_col].nunique()\n", + " fig = px.bar(data, x=record_col+\"_percent\", y=c+\"_fullname\",color_discrete_map=color_discrete_map,text_auto=True,color=\"auth_ctry_type\",\n", + " labels = labeld_dict)\n", + " fig.update_layout(xaxis_tickformat='.1%',font_family=\"Montserrat\",\n", + " yaxis={'categoryorder':'total ascending'},)\n", " figsuper = fig\n", " figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative',yaxis2={'categoryorder':'total ascending'},yaxis3={'categoryorder':'total ascending'})\n", " figsuper.update_yaxes(\n", @@ -14947,16 +15446,72 @@ " ticks=\"outside\")\n", " figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", "\n", - " figsuper['layout'][\"font\"][\"size\"]=12\n", + " figsuper['layout'][\"font\"][\"size\"]=14\n", " for a in figsuper['layout'][\"annotations\"]:\n", " a[\"font\"][\"size\"] = 14\n", - " figsuper[\"layout\"][\"yaxis\"][\"tickfont\"][\"size\"] = 10\n", + " figsuper[\"layout\"][\"yaxis\"][\"tickfont\"][\"size\"] = 14\n", "\n", " figsuper.update_layout(uniformtext_minsize=10)\n", + " figsuper.write_image(rf\"{fromdir}/plots/auth_loc_ctry.png\",height=900,width=1200,scale = 4)\n", + " figsuper.show()" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 420, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 420, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 420, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 457, + "outputs": [], + "source": [ + "appln_ipc_f = pd.read_csv(f\"{fromdir}/first-filings-with-IPC-raw.csv\", header=None,\n", + " names=[\"appln_id\",\"appln_auth\",\"appln_kind\",\"filing_year\",\"nb_applicants\",'nb_inventors',\n", + " 'ipc_class_symbol','ipc_class_level'])\n", "\n", - " figsuper.show(config= dict(displayModeBar = False, responsive = True))\n", + "appln_ipc_f = appln_ipc_f[appln_ipc_f[\"filing_year\"]>2010]\n", + "appln_ipc_f = appln_ipc_f[appln_ipc_f[\"appln_id\"].isin(appln_f[\"appln_id\"])]\n", "\n", - " figsuper.show()" + "appln_ipc_f[\"cpc_id\"] = appln_ipc_f[\"ipc_class_symbol\"].str.replace(\" \",\"\")\n", + "appln_ipc_f[\"ipc_class\"] = appln_ipc_f[\"ipc_class_symbol\"].str.replace(\" \",\"\").str[0]\n", + "appln_ipc_f[\"ipc_classname\"] = appln_ipc_f[\"ipc_class\"].replace({\"A\":\"Human necessities\",\n", + " \"B\":\"Performing operations; transporting\",\n", + " \"B\":\"Operations; transporting\",\n", + " \"C\":\"Chemistry; metallurgy\",\n", + " \"D\":\"Textiles; paper\",\n", + " \"E\":\"Fixed constructions\",\n", + " \"F\":\"Mechanical engineering; lightning; heating; weapons; blasting\",\n", + " \"F\":\"Engineering\",\n", + " \"G\":\"Physics\",\n", + " \"H\":\"Electricity\"})\n", + "\n", + "appln_ipc_f[\"ipc_class\"] = appln_ipc_f[\"ipc_class\"]+\"-\"+appln_ipc_f[\"ipc_classname\"]" ], "metadata": { "collapsed": false @@ -14964,3514 +15519,238 @@ }, { "cell_type": "code", - "execution_count": 140, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "data": [ - { - "alignmentgroup": "True", - "hovertemplate": "Country type=EU
Percent of related co-patents=%{x}
Country=%{y}", - "legendgroup": "EU", - "marker": { - "color": "#636EFA", - "pattern": { - "shape": "" - } - }, - "name": "EU", - "offsetgroup": "EU", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.026192703461178673, - 0.027128157156220765, - 0.005612722170252572, - 0.0037418147801683817, - 0.01216089803554724, - 0.21889616463985032, - 0.333021515434986, - 0.0018709073900841909, - 0.002806361085126286, - 9.354536950420954E-4, - 0.0205799812909261, - 9.354536950420954E-4, - 0.023386342376052385, - 0.0037418147801683817, - 9.354536950420954E-4, - 9.354536950420954E-4, - 0.025257249766136577, - 0.25631431244153413 - ], - "xaxis": "x", - "y": [ - "Austria", - "Belgium", - "Czech Republic", - "Denmark", - "Finland", - "France", - "Germany", - "Greece", - "Hungary", - "Ireland", - "Italy", - "Luxembourg", - "Netherlands", - "Poland", - "Portugal", - "Romania", - "Spain", - "Sweden" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Country type=China
Percent of related co-patents=%{x}
Country=%{y}", - "legendgroup": "China", - "marker": { - "color": "#EF553B", - "pattern": { - "shape": "" - } - }, - "name": "China", - "offsetgroup": "China", + "execution_count": 458, + "outputs": [], + "source": [ + "group = 'ipc_class'\n", + "data = appln_ipc_f.groupby(group, as_index=False)[record_col].nunique().sort_values(ascending=False, by=record_col)\n", + "\n", + "fig = px.bar(data.sort_values(by=group), x=record_col, y=group, color=group,barmode='relative',text_auto=True,\n", + " labels={\n", + " record_col: 'Number of co-publications',\n", + " group: \"\",\n", + " },\n", + " title=\"Distribution of Domains\", template='plotly')\n", + "fig.update_layout(showlegend=False, xaxis_tickformat='d',font_family=\"Montserrat\")\n", + "fig.update_traces(hovertemplate='%{x:d}')\n", + "fig.update_traces(textfont_size=12, textangle=0, textposition=\"outside\", cliponaxis=True)\n", + "fig.add_shape(\n", + " # Rectangle with reference to the plot\n", + " type=\"rect\",\n", + " xref=\"paper\",\n", + " yref=\"paper\",\n", + " x0=0,\n", + " y0=0,\n", + " x1=1.0,\n", + " y1=1.0,\n", + " line=dict(\n", + " color=\"black\",\n", + " width=0.5,\n", + " )\n", + " )\n", + "fig.update_layout(yaxis={'categoryorder':'total ascending'})\n", + "fig.update_yaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "fig.update_xaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "dom_distr = go.Figure(fig)" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 459, + "outputs": [], + "source": [ + "data = (appln_ipc_f.groupby(['filing_year','ipc_class'])[record_col].nunique(dropna=False).unstack()\n", + " .fillna(0)\n", + " .stack()\n", + " .reset_index()\n", + " .rename(columns={0:record_col}))\n", + "data = data.merge(data[data[record_col]>0].sort_values(by=[\"filing_year\"], ascending=True).drop_duplicates(subset='ipc_class'),\n", + " on='ipc_class', suffixes=[None,\"_relative_growth\"])\n", + "data[record_col+\"_relative_growth\"] = (data[record_col]-data[record_col+\"_relative_growth\"])/data[record_col+\"_relative_growth\"]\n", + "\n", + "data = data.sort_values(by =[\"ipc_class\",\"filing_year\"], ascending=[True,True])\n", + "data[record_col+\"_cumsum\"] = (data.groupby('ipc_class',as_index=False)[record_col].cumsum())\n" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 460, + "outputs": [], + "source": [ + "group = ['filing_year','ipc_class']\n", + "fig = px.line(data.sort_values(ascending=[True,True], by=[group[0],group[-1]]),y=record_col,x=group[0], color=group[-1], markers=True, labels={\n", + " record_col: 'Number of co-publications',\n", + " group[-1]: \"Domain\",\n", + " },\n", + " title=\"Yearly output of co-publications\", template='plotly')\n", + "fig.update_traces(hovertemplate='%{y:d}')\n", + "fig.update_layout(hovermode='x unified')\n", + "fig.add_shape(\n", + " # Rectangle with reference to the plot\n", + " type=\"rect\",\n", + " xref=\"paper\",\n", + " yref=\"paper\",\n", + " x0=0,\n", + " y0=0,\n", + " x1=1.0,\n", + " y1=1.0,\n", + " line=dict(\n", + " color=\"black\",\n", + " width=0.5,\n", + " )\n", + " )\n", + "fig.update_yaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "fig.update_xaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "\n", + "year_output_by_domain = go.Figure(fig)\n", + "\n", + "fig = px.line(data.sort_values(ascending=[True,True], by=[group[0],group[-1]]),y=record_col+\"_relative_growth\",x=group[0], color=group[-1], markers=True, labels={\n", + " record_col+\"_relative_growth\": 'Rel. growth
in co-publications (%)',\n", + " group[-1]: \"Domain\",\n", + " },\n", + " title=\"Relative growth in the output of co-publications\", template='plotly')\n", + "\n", + "fig.update_layout(hovermode='x unified',yaxis_tickformat='.0f%',font_family=\"Montserrat\")\n", + "fig.update_traces(hovertemplate='%{y:.0f}00%')\n", + "fig.add_shape(\n", + " # Rectangle with reference to the plot\n", + " type=\"rect\",\n", + " xref=\"paper\",\n", + " yref=\"paper\",\n", + " x0=0,\n", + " y0=0,\n", + " x1=1.0,\n", + " y1=1.0,\n", + " line=dict(\n", + " color=\"black\",\n", + " width=0.5,\n", + " )\n", + " )\n", + "fig.update_yaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "fig.update_xaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "\n", + "rel_output_by_domain = go.Figure(fig)\n", + "\n", + "\n", + "fig = px.area(data.sort_values(ascending=[True,True], by=[group[0],group[-1]]),y=record_col+\"_cumsum\",x=group[0], color=group[-1],line_group=group[-1],\n", + " labels={\n", + " record_col+\"_cumsum\": 'Cumulative number of co-publications',\n", + " group[-1]: \"Domain\",\n", + " },\n", + " title=\"Cumulative number of co-publications\", template='plotly')\n", + "fig.update_traces(hovertemplate='%{y:d}')\n", + "fig.update_layout(hovermode='x unified')\n", + "fig.add_shape(\n", + " # Rectangle with reference to the plot\n", + " type=\"rect\",\n", + " xref=\"paper\",\n", + " yref=\"paper\",\n", + " x0=0,\n", + " y0=0,\n", + " x1=1.0,\n", + " y1=1.0,\n", + " line=dict(\n", + " color=\"black\",\n", + " width=0.5,\n", + " )\n", + " )\n", + "fig.update_yaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "fig.update_xaxes(\n", + " showgrid=True,\n", + " ticks=\"outside\")\n", + "\n", + "cumsum_by_domain = go.Figure(fig)" + ], + "metadata": { + "collapsed": false + } + }, + { + "cell_type": "code", + "execution_count": 463, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "alignmentgroup": "True", + "cliponaxis": true, + "hovertemplate": "%{x:d}", + "legendgroup": "A-Human necessities", + "marker": { + "color": "#636efa", + "pattern": { + "shape": "" + } + }, + "name": "A-Human necessities", + "offsetgroup": "A-Human necessities", "orientation": "h", - "showlegend": true, - "textposition": "auto", + "showlegend": false, + "textangle": 0, + "textfont": { + "size": 12 + }, + "textposition": "outside", "texttemplate": "%{x}", "x": [ - 0.5116931711880262 + 99 ], "xaxis": "x", "y": [ - "China" + "A-Human necessities" ], "yaxis": "y", "type": "bar" }, { "alignmentgroup": "True", - "hovertemplate": "Country type=Non-EU associate
Percent of related co-patents=%{x}
Country=%{y}", - "legendgroup": "Non-EU associate", + "cliponaxis": true, + "hovertemplate": "%{x:d}", + "legendgroup": "B-Operations; transporting", "marker": { - "color": "#00CC96", + "color": "#EF553B", "pattern": { "shape": "" } }, - "name": "Non-EU associate", - "offsetgroup": "Non-EU associate", + "name": "B-Operations; transporting", + "offsetgroup": "B-Operations; transporting", "orientation": "h", - "showlegend": true, - "textposition": "auto", + "showlegend": false, + "textangle": 0, + "textfont": { + "size": 12 + }, + "textposition": "outside", "texttemplate": "%{x}", "x": [ - 9.354536950420954E-4, - 0.01028999064546305 + 341 ], "xaxis": "x", "y": [ - "Norway", - "Switzerland" - ], - "yaxis": "y", - "type": "bar" - } - ], - "layout": { - "template": { - "data": { - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - }, - "xaxis": { - "anchor": "y", - "domain": [ - 0.0, - 1.0 - ], - "title": { - "text": "Percent of related co-patents" - }, - "tickformat": ".1%", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis": { - "anchor": "x", - "domain": [ - 0.0, - 1.0 - ], - "title": { - "text": "Country" - }, - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside", - "tickfont": { - "size": 10 - } - }, - "legend": { - "title": { - "text": "Country type" - }, - "tracegroupgap": 0 - }, - "margin": { - "t": 60 - }, - "barmode": "relative", - "font": { - "family": "Montserrat", - "size": 12 - }, - "yaxis2": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis3": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "uniformtext": { - "minsize": 10 - } - }, - "config": { - "plotlyServerURL": "https://plotly.com" - } - }, - "text/html": "
" - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.plotly.v1+json": { - "data": [ - { - "alignmentgroup": "True", - "hovertemplate": "Country type=EU
Percent of related co-patents=%{x}
Country=%{y}", - "legendgroup": "EU", - "marker": { - "color": "#636EFA", - "pattern": { - "shape": "" - } - }, - "name": "EU", - "offsetgroup": "EU", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.0036900369003690036, - 0.007380073800738007, - 9.225092250922509E-4, - 0.0027675276752767526, - 0.0018450184501845018, - 0.012915129151291513, - 0.14206642066420663, - 0.24538745387453875, - 0.004612546125461255, - 0.004612546125461255, - 0.0036900369003690036, - 0.01107011070110701, - 9.225092250922509E-4, - 0.02029520295202952, - 0.00922509225092251 - ], - "xaxis": "x", - "y": [ - "Austria", - "Belgium", - "Cyprus", - "Czech Republic", - "Denmark", - "Finland", - "France", - "Germany", - "Ireland", - "Italy", - "Luxembourg", - "Netherlands", - "Portugal", - "Spain", - "Sweden" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Country type=China
Percent of related co-patents=%{x}
Country=%{y}", - "legendgroup": "China", - "marker": { - "color": "#EF553B", - "pattern": { - "shape": "" - } - }, - "name": "China", - "offsetgroup": "China", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.5784132841328413 - ], - "xaxis": "x", - "y": [ - "China" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Country type=Non-EU associate
Percent of related co-patents=%{x}
Country=%{y}", - "legendgroup": "Non-EU associate", - "marker": { - "color": "#00CC96", - "pattern": { - "shape": "" - } - }, - "name": "Non-EU associate", - "offsetgroup": "Non-EU associate", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 9.225092250922509E-4, - 0.017527675276752766 - ], - "xaxis": "x", - "y": [ - "Norway", - "Switzerland" - ], - "yaxis": "y", - "type": "bar" - } - ], - "layout": { - "template": { - "data": { - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - }, - "xaxis": { - "anchor": "y", - "domain": [ - 0.0, - 1.0 - ], - "title": { - "text": "Percent of related co-patents" - }, - "tickformat": ".1%", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis": { - "anchor": "x", - "domain": [ - 0.0, - 1.0 - ], - "title": { - "text": "Country" - }, - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside", - "tickfont": { - "size": 10 - } - }, - "legend": { - "title": { - "text": "Country type" - }, - "tracegroupgap": 0 - }, - "margin": { - "t": 60 - }, - "barmode": "relative", - "font": { - "family": "Montserrat", - "size": 12 - }, - "yaxis2": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis3": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "uniformtext": { - "minsize": 10 - } - }, - "config": { - "plotlyServerURL": "https://plotly.com" - } - }, - "text/html": "
" - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "application/vnd.plotly.v1+json": { - "data": [ - { - "alignmentgroup": "True", - "hovertemplate": "Authority type=EU
Percent of related co-patents=%{x}
Authority=%{y}", - "legendgroup": "EU", - "marker": { - "color": "#636EFA", - "pattern": { - "shape": "" - } - }, - "name": "EU", - "offsetgroup": "EU", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.00985663082437276, - 0.0017921146953405018, - 0.0035842293906810036, - 0.004480286738351254, - 0.013440860215053764, - 0.10215053763440861, - 0.22401433691756273, - 0.004480286738351254, - 0.024193548387096774, - 8.960573476702509E-4, - 0.014336917562724014, - 0.0062724014336917565 - ], - "xaxis": "x", - "y": [ - "Austria", - "Belgium", - "Czech Republic", - "Denmark", - "Finland", - "France", - "Germany", - "Luxembourg", - "Netherlands", - "Portugal", - "Spain", - "Sweden" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Authority type=China
Percent of related co-patents=%{x}
Authority=%{y}", - "legendgroup": "China", - "marker": { - "color": "#EF553B", - "pattern": { - "shape": "" - } - }, - "name": "China", - "offsetgroup": "China", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.002688172043010753 - ], - "xaxis": "x", - "y": [ - "China" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Authority type=EPO
Percent of related co-patents=%{x}
Authority=%{y}", - "legendgroup": "EPO", - "marker": { - "color": "#7F00FF", - "pattern": { - "shape": "" - } - }, - "name": "EPO", - "offsetgroup": "EPO", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.471326164874552 - ], - "xaxis": "x", - "y": [ - "European Patent Office" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "hovertemplate": "Authority type=Non-EU associate
Percent of related co-patents=%{x}
Authority=%{y}", - "legendgroup": "Non-EU associate", - "marker": { - "color": "#00CC96", - "pattern": { - "shape": "" - } - }, - "name": "Non-EU associate", - "offsetgroup": "Non-EU associate", - "orientation": "h", - "showlegend": true, - "textposition": "auto", - "texttemplate": "%{x}", - "x": [ - 0.11648745519713262 - ], - "xaxis": "x", - "y": [ - "United Kingdom" - ], - "yaxis": "y", - "type": "bar" - } - ], - "layout": { - "template": { - "data": { - "barpolar": [ - { - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "#E5ECF6", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "white", - "linecolor": "white", - "minorgridcolor": "white", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0.0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1.0, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "#E5ECF6", - "showlakes": true, - "showland": true, - "subunitcolor": "white" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "#E5ECF6", - "polar": { - "angularaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "radialaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "yaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - }, - "zaxis": { - "backgroundcolor": "#E5ECF6", - "gridcolor": "white", - "gridwidth": 2, - "linecolor": "white", - "showbackground": true, - "ticks": "", - "zerolinecolor": "white" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "baxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - }, - "bgcolor": "#E5ECF6", - "caxis": { - "gridcolor": "white", - "linecolor": "white", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "white", - "linecolor": "white", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "white", - "zerolinewidth": 2 - } - } - }, - "xaxis": { - "anchor": "y", - "domain": [ - 0.0, - 1.0 - ], - "title": { - "text": "Percent of related co-patents" - }, - "tickformat": ".1%", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis": { - "anchor": "x", - "domain": [ - 0.0, - 1.0 - ], - "title": { - "text": "Authority" - }, - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside", - "tickfont": { - "size": 10 - } - }, - "legend": { - "title": { - "text": "Authority type" - }, - "tracegroupgap": 0 - }, - "margin": { - "t": 60 - }, - "barmode": "relative", - "font": { - "family": "Montserrat", - "size": 12 - }, - "yaxis2": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "yaxis3": { - "categoryorder": "total ascending", - "showgrid": true, - "showline": true, - "linewidth": 1, - "linecolor": "black", - "mirror": true, - "ticks": "outside" - }, - "uniformtext": { - "minsize": 10 - } - }, - "config": { - "plotlyServerURL": "https://plotly.com" - } - }, - "text/html": "
" - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "# percent of publications related to\n", - "# -authority country\n", - "# -inventor country\n", - "# -applicant country\n", - "\n", - "color_discrete_map= {'China': '#EF553B',\n", - " 'EU': '#636EFA',\n", - " 'Non-EU associate': '#00CC96',\n", - " 'EPO':'#7F00FF'}#CC8899\n", - "\n", - "c_dict = {\"count\":\"Number of co-publications\",\n", - " \"percent_of_copubs\":\"Percent of co-publications\",\n", - " \"percent_contrib_in_copubs\":\"Contribution to co-publications\"}\n", - "\n", - "labeld_dict = dict({\n", - " record_col+\"_percent\": 'Percent of related co-patents',\n", - " \"person_ctry_code_fullname\": \"Country\",\n", - " \"person_ctry_type\": \"Country type\",\n", - " \"appln_auth_fullname\": \"Authority\",\n", - " \"auth_ctry_type\": \"Authority type\",\n", - " \"Country_Type\":\"Country type\",\n", - " \"Eurovoc_Class\":\"Region\"\n", - " },**c_dict)\n", - "\n", - "for c in [\"person_ctry_code\",\"appln_auth\"]:\n", - " pers_sub = appln_pers_f\n", - " if c == \"person_ctry_code\":\n", - " for role in [\"invt\",\"applt\"]:\n", - " pers_sub = appln_pers_f[appln_pers_f[role+\"_seq_nr\"]!=0]\n", - "\n", - " data = (pers_sub.groupby(c+\"_fullname\",as_index=False).agg({'appln_id': 'nunique', 'person_ctry_ISO3': 'first',\"person_ctry_type\":\"first\"}))\n", - " data[record_col+\"_percent\"] = data[record_col]/pers_sub[record_col].nunique()\n", - " fig = px.bar(data, x=record_col+\"_percent\", y=c+\"_fullname\",color_discrete_map=color_discrete_map,text_auto=True,color=\"person_ctry_type\",\n", - " labels = labeld_dict)\n", - " fig.update_layout(xaxis_tickformat='.1%',font_family=\"Montserrat\",\n", - " yaxis={'categoryorder':'total ascending'},)\n", - " figsuper = fig\n", - " figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative',yaxis2={'categoryorder':'total ascending'},yaxis3={'categoryorder':'total ascending'})\n", - " figsuper.update_yaxes(\n", - " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", - " ticks=\"outside\")\n", - " figsuper.update_xaxes(\n", - " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", - " ticks=\"outside\")\n", - " figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", - "\n", - " figsuper['layout'][\"font\"][\"size\"]=12\n", - " for a in figsuper['layout'][\"annotations\"]:\n", - " a[\"font\"][\"size\"] = 14\n", - " figsuper[\"layout\"][\"yaxis\"][\"tickfont\"][\"size\"] = 10\n", - "\n", - " figsuper.update_layout(uniformtext_minsize=10)\n", - " figsuper.show()\n", - " else:\n", - " data = pers_sub.groupby(c+\"_fullname\",as_index=False).agg({'appln_id': 'nunique', 'auth_ISO3': 'first',\"auth_ctry_type\":\"first\"})\n", - " data[record_col+\"_percent\"] = data[record_col]/pers_sub[record_col].nunique()\n", - " fig = px.bar(data, x=record_col+\"_percent\", y=c+\"_fullname\",color_discrete_map=color_discrete_map,text_auto=True,color=\"auth_ctry_type\",\n", - " labels = labeld_dict)\n", - " fig.update_layout(xaxis_tickformat='.1%',font_family=\"Montserrat\",\n", - " yaxis={'categoryorder':'total ascending'},)\n", - " figsuper = fig\n", - " figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative',yaxis2={'categoryorder':'total ascending'},yaxis3={'categoryorder':'total ascending'})\n", - " figsuper.update_yaxes(\n", - " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", - " ticks=\"outside\")\n", - " figsuper.update_xaxes(\n", - " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", - " ticks=\"outside\")\n", - " figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", - "\n", - " figsuper['layout'][\"font\"][\"size\"]=12\n", - " for a in figsuper['layout'][\"annotations\"]:\n", - " a[\"font\"][\"size\"] = 14\n", - " figsuper[\"layout\"][\"yaxis\"][\"tickfont\"][\"size\"] = 10\n", - "\n", - " figsuper.update_layout(uniformtext_minsize=10)\n", - " figsuper.show()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 126, - "outputs": [ - { - "data": { - "text/plain": " appln_auth appln_id appln_id_percent\n0 AT 6016 0.009362\n1 BE 1772 0.002758\n2 BG 229 0.000356\n3 CH 1926 0.002997\n4 CN 304654 0.474115\n5 CZ 1373 0.002137\n6 DE 124035 0.193028\n7 DK 1480 0.002303\n8 EE 46 0.000072\n9 EP 54082 0.084165\n10 ES 8484 0.013203\n11 FI 4719 0.007344\n12 FR 57391 0.089314\n13 GB 51069 0.079476\n14 GR 515 0.000801\n15 HR 135 0.000210\n16 HU 807 0.001256\n17 IE 70 0.000109\n18 IT 5535 0.008614\n19 LT 58 0.000090\n20 LU 1054 0.001640\n21 LV 60 0.000093\n22 MA 363 0.000565\n23 NL 7377 0.011480\n24 PL 1854 0.002885\n25 PT 385 0.000599\n26 RO 235 0.000366\n27 SE 6207 0.009660\n28 SI 430 0.000669\n29 SK 213 0.000331", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_authappln_idappln_id_percent
0AT60160.009362
1BE17720.002758
2BG2290.000356
3CH19260.002997
4CN3046540.474115
5CZ13730.002137
6DE1240350.193028
7DK14800.002303
8EE460.000072
9EP540820.084165
10ES84840.013203
11FI47190.007344
12FR573910.089314
13GB510690.079476
14GR5150.000801
15HR1350.000210
16HU8070.001256
17IE700.000109
18IT55350.008614
19LT580.000090
20LU10540.001640
21LV600.000093
22MA3630.000565
23NL73770.011480
24PL18540.002885
25PT3850.000599
26RO2350.000366
27SE62070.009660
28SI4300.000669
29SK2130.000331
\n
" - }, - "execution_count": 126, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "# top 25\n", - "# - inventor\n", - "# - applicant\n", - "# in china, EU, EUextended" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 111, - "outputs": [ - { - "data": { - "text/plain": " person_id psn_sector han_id \n269495 48715290 COMPANY 148715290 \\\n225401 45096499 GOV NON-PROFIT 986555 \n426484 58455492 NaN 158455492 \n50805 15325724 INDIVIDUAL 115325724 \n112503 28064269 NaN 128064269 \n... ... ... ... \n464708 59491689 NaN 159491689 \n169950 42286280 INDIVIDUAL 4099527 \n485679 60214508 NaN 160214508 \n542210 62188978 NaN 162188978 \n752136 81407527 NaN 181407527 \n\n han_name \n269495 TECHFLOW MARINE LIMITED \n225401 FUNDACIO INSTITUT CATALA D INVESTIGACIO QUIMIC... \n426484 DING ZHIJIAO \n50805 FOURNIER, THIERRY \n112503 ADRIAN WALLER \n... ... \n464708 LIU YANZHI \n169950 RIEMANN STEFAN \n485679 WAN BO \n542210 CHU WEI \n752136 GARCIA MONSONIS, Javier \n\n[100 rows x 4 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
person_idpsn_sectorhan_idhan_name
26949548715290COMPANY148715290TECHFLOW MARINE LIMITED
22540145096499GOV NON-PROFIT986555FUNDACIO INSTITUT CATALA D INVESTIGACIO QUIMIC...
42648458455492NaN158455492DING ZHIJIAO
5080515325724INDIVIDUAL115325724FOURNIER, THIERRY
11250328064269NaN128064269ADRIAN WALLER
...............
46470859491689NaN159491689LIU YANZHI
16995042286280INDIVIDUAL4099527RIEMANN STEFAN
48567960214508NaN160214508WAN BO
54221062188978NaN162188978CHU WEI
75213681407527NaN181407527GARCIA MONSONIS, Javier
\n

100 rows × 4 columns

\n
" - }, - "execution_count": 111, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_pers_haninfo = pd.read_csv(f\"{outdir}/tls_206_scope.csv\", usecols=[\"person_id\",\"han_id\",\"han_name\",\"psn_sector\"])\n", - "appln_pers_haninfo.sample(100)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 80, - "outputs": [ - { - "data": { - "text/plain": " appln_id appln_auth appln_kind filing_year nb_applicants \n1322402 523940692 EP A 2019 2 \\\n765767 476494118 EP A 2017 1 \n34130 378211797 DE U 2011 1 \n789796 480385078 GB A 2017 1 \n701348 451567585 NL A 2016 1 \n... ... ... ... ... ... \n1361812 536054394 EP A 2020 1 \n242632 424885398 DE A 2013 1 \n1108772 503145148 EP A 2018 1 \n538788 447597102 EP A 2015 1 \n272481 412013115 EP A 2013 1 \n\n nb_inventors ipc_class_symbol ipc_class_level cpc_id \n1322402 2 B60W 50/14 A B60W50/14 \\\n765767 4 B60H 1/34 A B60H1/34 \n34130 0 F04B 17/04 A F04B17/04 \n789796 2 H04W 76/14 A H04W76/14 \n701348 3 E04F 13/077 A E04F13/077 \n... ... ... ... ... \n1361812 4 G05B 23/02 A G05B23/02 \n242632 1 F02M 51/06 A F02M51/06 \n1108772 2 G08G 1/01 A G08G1/01 \n538788 6 H01F 38/30 A H01F38/30 \n272481 3 C04B 28/04 A C04B28/04 \n\n ipc_class ipc_classname \n1322402 B-Operations; transporting Operations; transporting \n765767 B-Operations; transporting Operations; transporting \n34130 F-Engineering Engineering \n789796 H-Electricity Electricity \n701348 E-Fixed constructions Fixed constructions \n... ... ... \n1361812 G-Physics Physics \n242632 F-Engineering Engineering \n1108772 G-Physics Physics \n538788 H-Electricity Electricity \n272481 C-Chemistry; metallurgy Chemistry; metallurgy \n\n[100 rows x 11 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
appln_idappln_authappln_kindfiling_yearnb_applicantsnb_inventorsipc_class_symbolipc_class_levelcpc_idipc_classipc_classname
1322402523940692EPA201922B60W 50/14AB60W50/14B-Operations; transportingOperations; transporting
765767476494118EPA201714B60H 1/34AB60H1/34B-Operations; transportingOperations; transporting
34130378211797DEU201110F04B 17/04AF04B17/04F-EngineeringEngineering
789796480385078GBA201712H04W 76/14AH04W76/14H-ElectricityElectricity
701348451567585NLA201613E04F 13/077AE04F13/077E-Fixed constructionsFixed constructions
....................................
1361812536054394EPA202014G05B 23/02AG05B23/02G-PhysicsPhysics
242632424885398DEA201311F02M 51/06AF02M51/06F-EngineeringEngineering
1108772503145148EPA201812G08G 1/01AG08G1/01G-PhysicsPhysics
538788447597102EPA201516H01F 38/30AH01F38/30H-ElectricityElectricity
272481412013115EPA201313C04B 28/04AC04B28/04C-Chemistry; metallurgyChemistry; metallurgy
\n

100 rows × 11 columns

\n
" - }, - "execution_count": 80, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_ipc_f = pd.read_csv(f\"{fromdir}/first-filings-with-IPC-raw.csv\", header=None,\n", - " names=[\"appln_id\",\"appln_auth\",\"appln_kind\",\"filing_year\",\"nb_applicants\",'nb_inventors',\n", - " 'ipc_class_symbol','ipc_class_level'])\n", - "\n", - "appln_ipc_f = appln_ipc_f[appln_ipc_f[\"filing_year\"]>2010]\n", - "appln_ipc_f = appln_ipc_f[appln_ipc_f[\"appln_id\"].isin(appln_f[\"appln_id\"])]\n", - "\n", - "appln_ipc_f[\"cpc_id\"] = appln_ipc_f[\"ipc_class_symbol\"].str.replace(\" \",\"\")\n", - "appln_ipc_f[\"ipc_class\"] = appln_ipc_f[\"ipc_class_symbol\"].str.replace(\" \",\"\").str[0]\n", - "appln_ipc_f[\"ipc_classname\"] = appln_ipc_f[\"ipc_class\"].replace({\"A\":\"Human necessities\",\n", - " \"B\":\"Performing operations; transporting\",\n", - " \"B\":\"Operations; transporting\",\n", - " \"C\":\"Chemistry; metallurgy\",\n", - " \"D\":\"Textiles; paper\",\n", - " \"E\":\"Fixed constructions\",\n", - " \"F\":\"Mechanical engineering; lightning; heating; weapons; blasting\",\n", - " \"F\":\"Engineering\",\n", - " \"G\":\"Physics\",\n", - " \"H\":\"Electricity\"})\n", - "\n", - "appln_ipc_f[\"ipc_class\"] = appln_ipc_f[\"ipc_class\"]+\"-\"+appln_ipc_f[\"ipc_classname\"]\n", - "appln_ipc_f.sample(100)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 81, - "outputs": [], - "source": [ - "group = 'ipc_class'\n", - "data = appln_ipc_f.groupby(group, as_index=False)[record_col].nunique().sort_values(ascending=False, by=record_col)\n", - "\n", - "fig = px.bar(data.sort_values(by=group), x=record_col, y=group, color=group,barmode='relative',text_auto=True,\n", - " labels={\n", - " record_col: 'Number of co-publications',\n", - " group: \"\",\n", - " },\n", - " title=\"Distribution of Domains\", template='plotly')\n", - "fig.update_layout(showlegend=False, xaxis_tickformat='d',font_family=\"Montserrat\")\n", - "fig.update_traces(hovertemplate='%{x:d}')\n", - "fig.update_traces(textfont_size=12, textangle=0, textposition=\"outside\", cliponaxis=True)\n", - "fig.add_shape(\n", - " # Rectangle with reference to the plot\n", - " type=\"rect\",\n", - " xref=\"paper\",\n", - " yref=\"paper\",\n", - " x0=0,\n", - " y0=0,\n", - " x1=1.0,\n", - " y1=1.0,\n", - " line=dict(\n", - " color=\"black\",\n", - " width=0.5,\n", - " )\n", - " )\n", - "fig.update_layout(yaxis={'categoryorder':'total ascending'})\n", - "fig.update_yaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "fig.update_xaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "dom_distr = go.Figure(fig)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 82, - "outputs": [ - { - "data": { - "text/plain": " filing_year ipc_class appln_id filing_year_relative_growth \n0 2011 A-Human necessities 7.0 2011 \\\n1 2012 A-Human necessities 5.0 2011 \n2 2013 A-Human necessities 18.0 2011 \n3 2014 A-Human necessities 9.0 2011 \n4 2015 A-Human necessities 10.0 2011 \n.. ... ... ... ... \n83 2017 H-Electricity 71.0 2011 \n84 2018 H-Electricity 65.0 2011 \n85 2019 H-Electricity 27.0 2011 \n86 2020 H-Electricity 27.0 2011 \n87 2021 H-Electricity 11.0 2011 \n\n appln_id_relative_growth appln_id_cumsum \n0 0.000000 7.0 \n1 -0.285714 12.0 \n2 1.571429 30.0 \n3 0.285714 39.0 \n4 0.428571 49.0 \n.. ... ... \n83 3.437500 213.0 \n84 3.062500 278.0 \n85 0.687500 305.0 \n86 0.687500 332.0 \n87 -0.312500 343.0 \n\n[88 rows x 6 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
filing_yearipc_classappln_idfiling_year_relative_growthappln_id_relative_growthappln_id_cumsum
02011A-Human necessities7.020110.0000007.0
12012A-Human necessities5.02011-0.28571412.0
22013A-Human necessities18.020111.57142930.0
32014A-Human necessities9.020110.28571439.0
42015A-Human necessities10.020110.42857149.0
.....................
832017H-Electricity71.020113.437500213.0
842018H-Electricity65.020113.062500278.0
852019H-Electricity27.020110.687500305.0
862020H-Electricity27.020110.687500332.0
872021H-Electricity11.02011-0.312500343.0
\n

88 rows × 6 columns

\n
" - }, - "execution_count": 82, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data = (appln_ipc_f.groupby(['filing_year','ipc_class'])[record_col].nunique(dropna=False).unstack()\n", - " .fillna(0)\n", - " .stack()\n", - " .reset_index()\n", - " .rename(columns={0:record_col}))\n", - "data = data.merge(data[data[record_col]>0].sort_values(by=[\"filing_year\"], ascending=True).drop_duplicates(subset='ipc_class'),\n", - " on='ipc_class', suffixes=[None,\"_relative_growth\"])\n", - "data[record_col+\"_relative_growth\"] = (data[record_col]-data[record_col+\"_relative_growth\"])/data[record_col+\"_relative_growth\"]\n", - "\n", - "data = data.sort_values(by =[\"ipc_class\",\"filing_year\"], ascending=[True,True])\n", - "data[record_col+\"_cumsum\"] = (data.groupby('ipc_class',as_index=False)[record_col].cumsum())\n", - "data" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 83, - "outputs": [], - "source": [ - "group = ['filing_year','ipc_class']\n", - "fig = px.line(data.sort_values(ascending=[True,True], by=[group[0],group[-1]]),y=record_col,x=group[0], color=group[-1], markers=True, labels={\n", - " record_col: 'Number of co-publications',\n", - " group[-1]: \"Domain\",\n", - " },\n", - " title=\"Yearly output of co-publications\", template='plotly')\n", - "fig.update_traces(hovertemplate='%{y:d}')\n", - "fig.update_layout(hovermode='x unified')\n", - "fig.add_shape(\n", - " # Rectangle with reference to the plot\n", - " type=\"rect\",\n", - " xref=\"paper\",\n", - " yref=\"paper\",\n", - " x0=0,\n", - " y0=0,\n", - " x1=1.0,\n", - " y1=1.0,\n", - " line=dict(\n", - " color=\"black\",\n", - " width=0.5,\n", - " )\n", - " )\n", - "fig.update_yaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "fig.update_xaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "\n", - "year_output_by_domain = go.Figure(fig)\n", - "\n", - "fig = px.line(data.sort_values(ascending=[True,True], by=[group[0],group[-1]]),y=record_col+\"_relative_growth\",x=group[0], color=group[-1], markers=True, labels={\n", - " record_col+\"_relative_growth\": 'Rel. growth
in co-publications (%)',\n", - " group[-1]: \"Domain\",\n", - " },\n", - " title=\"Relative growth in the output of co-publications\", template='plotly')\n", - "\n", - "fig.update_layout(hovermode='x unified',yaxis_tickformat='.0f%',font_family=\"Montserrat\")\n", - "fig.update_traces(hovertemplate='%{y:.0f}00%')\n", - "fig.add_shape(\n", - " # Rectangle with reference to the plot\n", - " type=\"rect\",\n", - " xref=\"paper\",\n", - " yref=\"paper\",\n", - " x0=0,\n", - " y0=0,\n", - " x1=1.0,\n", - " y1=1.0,\n", - " line=dict(\n", - " color=\"black\",\n", - " width=0.5,\n", - " )\n", - " )\n", - "fig.update_yaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "fig.update_xaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "\n", - "rel_output_by_domain = go.Figure(fig)\n", - "\n", - "\n", - "fig = px.area(data.sort_values(ascending=[True,True], by=[group[0],group[-1]]),y=record_col+\"_cumsum\",x=group[0], color=group[-1],line_group=group[-1],\n", - " labels={\n", - " record_col+\"_cumsum\": 'Cumulative number of co-publications',\n", - " group[-1]: \"Domain\",\n", - " },\n", - " title=\"Cumulative number of co-publications\", template='plotly')\n", - "fig.update_traces(hovertemplate='%{y:d}')\n", - "fig.update_layout(hovermode='x unified')\n", - "fig.add_shape(\n", - " # Rectangle with reference to the plot\n", - " type=\"rect\",\n", - " xref=\"paper\",\n", - " yref=\"paper\",\n", - " x0=0,\n", - " y0=0,\n", - " x1=1.0,\n", - " y1=1.0,\n", - " line=dict(\n", - " color=\"black\",\n", - " width=0.5,\n", - " )\n", - " )\n", - "fig.update_yaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "fig.update_xaxes(\n", - " showgrid=True,\n", - " ticks=\"outside\")\n", - "\n", - "cumsum_by_domain = go.Figure(fig)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 87, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "data": [ - { - "alignmentgroup": "True", - "cliponaxis": true, - "hovertemplate": "%{x:d}", - "legendgroup": "A-Human necessities", - "marker": { - "color": "#636efa", - "pattern": { - "shape": "" - } - }, - "name": "A-Human necessities", - "offsetgroup": "A-Human necessities", - "orientation": "h", - "showlegend": false, - "textangle": 0, - "textfont": { - "size": 12 - }, - "textposition": "outside", - "texttemplate": "%{x}", - "x": [ - 108 - ], - "xaxis": "x", - "y": [ - "A-Human necessities" - ], - "yaxis": "y", - "type": "bar" - }, - { - "alignmentgroup": "True", - "cliponaxis": true, - "hovertemplate": "%{x:d}", - "legendgroup": "B-Operations; transporting", - "marker": { - "color": "#EF553B", - "pattern": { - "shape": "" - } - }, - "name": "B-Operations; transporting", - "offsetgroup": "B-Operations; transporting", - "orientation": "h", - "showlegend": false, - "textangle": 0, - "textfont": { - "size": 12 - }, - "textposition": "outside", - "texttemplate": "%{x}", - "x": [ - 357 - ], - "xaxis": "x", - "y": [ - "B-Operations; transporting" + "B-Operations; transporting" ], "yaxis": "y", "type": "bar" @@ -18498,7 +15777,7 @@ "textposition": "outside", "texttemplate": "%{x}", "x": [ - 150 + 145 ], "xaxis": "x", "y": [ @@ -18529,7 +15808,7 @@ "textposition": "outside", "texttemplate": "%{x}", "x": [ - 15 + 14 ], "xaxis": "x", "y": [ @@ -18560,7 +15839,7 @@ "textposition": "outside", "texttemplate": "%{x}", "x": [ - 50 + 49 ], "xaxis": "x", "y": [ @@ -18591,7 +15870,7 @@ "textposition": "outside", "texttemplate": "%{x}", "x": [ - 155 + 148 ], "xaxis": "x", "y": [ @@ -18622,7 +15901,7 @@ "textposition": "outside", "texttemplate": "%{x}", "x": [ - 248 + 231 ], "xaxis": "x", "y": [ @@ -18653,7 +15932,7 @@ "textposition": "outside", "texttemplate": "%{x}", "x": [ - 343 + 328 ], "xaxis": "x", "y": [ @@ -18677,7 +15956,7 @@ "mode": "lines", "name": "A-Human necessities", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18695,16 +15974,16 @@ "xaxis": "x2", "y": [ 7.0, - 12.0, - 30.0, - 39.0, - 49.0, - 60.0, - 73.0, - 83.0, - 98.0, - 103.0, - 108.0 + 10.0, + 25.0, + 33.0, + 43.0, + 53.0, + 66.0, + 75.0, + 90.0, + 94.0, + 99.0 ], "yaxis": "y2", "type": "scatter" @@ -18724,7 +16003,7 @@ "mode": "lines", "name": "B-Operations; transporting", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18741,17 +16020,17 @@ ], "xaxis": "x2", "y": [ - 17.0, - 26.0, - 47.0, - 64.0, - 77.0, - 97.0, - 138.0, - 199.0, - 272.0, - 333.0, - 357.0 + 15.0, + 23.0, + 38.0, + 52.0, + 65.0, + 85.0, + 126.0, + 186.0, + 258.0, + 317.0, + 341.0 ], "yaxis": "y2", "type": "scatter" @@ -18771,7 +16050,7 @@ "mode": "lines", "name": "C-Chemistry; metallurgy", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18790,15 +16069,15 @@ "y": [ 9.0, 20.0, - 34.0, - 43.0, - 53.0, - 63.0, - 79.0, - 88.0, - 114.0, - 141.0, - 150.0 + 33.0, + 42.0, + 52.0, + 62.0, + 78.0, + 87.0, + 111.0, + 136.0, + 145.0 ], "yaxis": "y2", "type": "scatter" @@ -18818,7 +16097,7 @@ "mode": "lines", "name": "D-Textiles; paper", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18844,8 +16123,8 @@ 9.0, 11.0, 13.0, - 15.0, - 15.0 + 14.0, + 14.0 ], "yaxis": "y2", "type": "scatter" @@ -18865,7 +16144,7 @@ "mode": "lines", "name": "E-Fixed constructions", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18887,12 +16166,12 @@ 4.0, 5.0, 6.0, - 10.0, - 14.0, - 24.0, - 31.0, - 45.0, - 50.0 + 9.0, + 13.0, + 23.0, + 30.0, + 44.0, + 49.0 ], "yaxis": "y2", "type": "scatter" @@ -18912,7 +16191,7 @@ "mode": "lines", "name": "F-Engineering", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18929,17 +16208,17 @@ ], "xaxis": "x2", "y": [ - 8.0, - 11.0, - 28.0, - 34.0, - 43.0, - 51.0, - 67.0, - 94.0, - 122.0, - 148.0, - 155.0 + 7.0, + 10.0, + 26.0, + 32.0, + 39.0, + 46.0, + 62.0, + 88.0, + 115.0, + 141.0, + 148.0 ], "yaxis": "y2", "type": "scatter" @@ -18959,7 +16238,7 @@ "mode": "lines", "name": "G-Physics", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -18976,17 +16255,17 @@ ], "xaxis": "x2", "y": [ - 6.0, - 18.0, - 30.0, - 46.0, - 71.0, - 89.0, - 112.0, - 151.0, - 198.0, - 232.0, - 248.0 + 5.0, + 17.0, + 29.0, + 44.0, + 69.0, + 87.0, + 110.0, + 147.0, + 185.0, + 215.0, + 231.0 ], "yaxis": "y2", "type": "scatter" @@ -19006,7 +16285,7 @@ "mode": "lines", "name": "H-Electricity", "orientation": "v", - "showlegend": true, + "showlegend": false, "stackgroup": "1", "x": [ 2011, @@ -19023,17 +16302,17 @@ ], "xaxis": "x2", "y": [ - 16.0, - 33.0, - 44.0, - 63.0, - 99.0, - 142.0, - 213.0, - 278.0, - 305.0, - 332.0, - 343.0 + 14.0, + 28.0, + 38.0, + 55.0, + 90.0, + 133.0, + 204.0, + 268.0, + 291.0, + 317.0, + 328.0 ], "yaxis": "y2", "type": "scatter" @@ -19068,15 +16347,15 @@ "xaxis": "x3", "y": [ 7.0, - 5.0, - 18.0, - 9.0, + 3.0, + 15.0, + 8.0, 10.0, - 11.0, - 13.0, 10.0, + 13.0, + 9.0, 15.0, - 5.0, + 4.0, 5.0 ], "yaxis": "y3", @@ -19111,16 +16390,16 @@ ], "xaxis": "x3", "y": [ - 17.0, - 9.0, - 21.0, - 17.0, + 15.0, + 8.0, + 15.0, + 14.0, 13.0, 20.0, 41.0, - 61.0, - 73.0, - 61.0, + 60.0, + 72.0, + 59.0, 24.0 ], "yaxis": "y3", @@ -19157,14 +16436,14 @@ "y": [ 9.0, 11.0, - 14.0, + 13.0, 9.0, 10.0, 10.0, 16.0, 9.0, - 26.0, - 27.0, + 24.0, + 25.0, 9.0 ], "yaxis": "y3", @@ -19208,7 +16487,7 @@ 3.0, 2.0, 2.0, - 2.0, + 1.0, 0.0 ], "yaxis": "y3", @@ -19248,7 +16527,7 @@ 0.0, 1.0, 1.0, - 4.0, + 3.0, 4.0, 10.0, 7.0, @@ -19287,15 +16566,15 @@ ], "xaxis": "x3", "y": [ - 8.0, + 7.0, 3.0, - 17.0, + 16.0, 6.0, - 9.0, - 8.0, + 7.0, + 7.0, 16.0, + 26.0, 27.0, - 28.0, 26.0, 7.0 ], @@ -19331,16 +16610,16 @@ ], "xaxis": "x3", "y": [ - 6.0, + 5.0, 12.0, 12.0, - 16.0, + 15.0, 25.0, 18.0, 23.0, - 39.0, - 47.0, - 34.0, + 37.0, + 38.0, + 30.0, 16.0 ], "yaxis": "y3", @@ -19375,16 +16654,16 @@ ], "xaxis": "x3", "y": [ - 16.0, + 14.0, + 14.0, + 10.0, 17.0, - 11.0, - 19.0, - 36.0, + 35.0, 43.0, 71.0, - 65.0, - 27.0, - 27.0, + 64.0, + 23.0, + 26.0, 11.0 ], "yaxis": "y3", @@ -19420,15 +16699,15 @@ "xaxis": "x4", "y": [ 0.0, - -0.2857142857142857, - 1.5714285714285714, - 0.2857142857142857, + -0.5714285714285714, + 1.1428571428571428, + 0.14285714285714285, 0.42857142857142855, - 0.5714285714285714, - 0.8571428571428571, 0.42857142857142855, + 0.8571428571428571, + 0.2857142857142857, 1.1428571428571428, - -0.2857142857142857, + -0.42857142857142855, -0.2857142857142857 ], "yaxis": "y4", @@ -19464,16 +16743,16 @@ "xaxis": "x4", "y": [ 0.0, - -0.47058823529411764, - 0.23529411764705882, + -0.4666666666666667, 0.0, - -0.23529411764705882, - 0.17647058823529413, - 1.411764705882353, - 2.588235294117647, - 3.2941176470588234, - 2.588235294117647, - 0.4117647058823529 + -0.06666666666666667, + -0.13333333333333333, + 0.3333333333333333, + 1.7333333333333334, + 3.0, + 3.8, + 2.933333333333333, + 0.6 ], "yaxis": "y4", "type": "scatter" @@ -19509,14 +16788,14 @@ "y": [ 0.0, 0.2222222222222222, - 0.5555555555555556, + 0.4444444444444444, 0.0, 0.1111111111111111, 0.1111111111111111, 0.7777777777777778, 0.0, - 1.8888888888888888, - 2.0, + 1.6666666666666667, + 1.7777777777777777, 0.0 ], "yaxis": "y4", @@ -19560,7 +16839,7 @@ 2.0, 1.0, 1.0, - 1.0, + 0.0, -1.0 ], "yaxis": "y4", @@ -19600,7 +16879,7 @@ -1.0, -0.5, -0.5, - 1.0, + 0.5, 1.0, 4.0, 2.5, @@ -19640,16 +16919,16 @@ "xaxis": "x4", "y": [ 0.0, - -0.625, - 1.125, - -0.25, - 0.125, + -0.5714285714285714, + 1.2857142857142858, + -0.14285714285714285, 0.0, - 1.0, - 2.375, - 2.5, - 2.25, - -0.125 + 0.0, + 1.2857142857142858, + 2.7142857142857144, + 2.857142857142857, + 2.7142857142857144, + 0.0 ], "yaxis": "y4", "type": "scatter" @@ -19684,16 +16963,16 @@ "xaxis": "x4", "y": [ 0.0, - 1.0, - 1.0, - 1.6666666666666667, - 3.1666666666666665, + 1.4, + 1.4, 2.0, - 2.8333333333333335, - 5.5, - 6.833333333333333, - 4.666666666666667, - 1.6666666666666667 + 4.0, + 2.6, + 3.6, + 6.4, + 6.6, + 5.0, + 2.2 ], "yaxis": "y4", "type": "scatter" @@ -19728,16 +17007,16 @@ "xaxis": "x4", "y": [ 0.0, - 0.0625, - -0.3125, - 0.1875, - 1.25, - 1.6875, - 3.4375, - 3.0625, - 0.6875, - 0.6875, - -0.3125 + 0.0, + -0.2857142857142857, + 0.21428571428571427, + 1.5, + 2.0714285714285716, + 4.071428571428571, + 3.5714285714285716, + 0.6428571428571429, + 0.8571428571428571, + -0.21428571428571427 ], "yaxis": "y4", "type": "scatter" @@ -20744,7 +18023,7 @@ "barmode": "relative", "font": { "family": "Montserrat", - "size": 12 + "size": 14 } }, "config": { @@ -20753,439 +18032,71 @@ "plotlyServerURL": "https://plotly.com" } }, - "text/html": "
" + "text/html": "
" }, "metadata": {}, "output_type": "display_data" } ], "source": [ - "from plotly.subplots import make_subplots\n", - "import plotly.graph_objects as go\n", - "\n", - "# dom_distr\n", - "# year_output_by_domain\n", - "# rel_output_by_domain\n", - "# cumsum_by_domain\n", - "\n", - "figsuper = make_subplots(rows=2, cols=2, subplot_titles=[\"Distribution of IPC classes\",\"Cumulative sum of related co-patents\",\n", - " \"Related co-patents per year\",\"Relative growth of co-patents\"])\n", - "\n", - "\n", - "for trace in list(dom_distr.select_traces()):\n", - " trace.showlegend=False\n", - " # trace.barmode\n", - " figsuper.add_trace(trace,\n", - " row=1, col=1\n", - " )\n", - "\n", - "for trace in list(cumsum_by_domain.select_traces()):\n", - " figsuper.add_trace(trace,\n", - " row=1, col=2\n", - " )\n", - "\n", - "for trace in list(year_output_by_domain.select_traces()):\n", - " trace.showlegend=False\n", - " figsuper.add_trace(trace,\n", - " row=2, col=1\n", - " )\n", - "\n", - "for trace in list(rel_output_by_domain.select_traces()):\n", - " trace.showlegend=False\n", - " figsuper.add_trace(trace,\n", - " row=2, col=2\n", - " )\n", - "\n", - "\n", - "figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative')\n", - "figsuper.update_yaxes(\n", - " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", - " ticks=\"outside\")\n", - "figsuper.update_xaxes(\n", - " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", - " ticks=\"outside\")\n", - "\n", - "figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", - "figsuper['layout']['xaxis1'].update(tickformat=\".0f\")\n", - "figsuper['layout']['yaxis2'].update(tickformat=\".0f\")\n", - "figsuper['layout']['yaxis4'].update(zeroline=True, zerolinewidth=0.5, zerolinecolor='grey',tickformat=\".0%\")\n", - "figsuper['layout'][f'xaxis'][\"range\"] = [0,400]\n", - "for i in range(2,5):\n", - " figsuper['layout'][f'xaxis{i}'][\"range\"] = [2010.8,2022.2]\n", - "figsuper['layout'][\"font\"][\"size\"]=12\n", - "for a in figsuper['layout'][\"annotations\"]:\n", - " a[\"font\"][\"size\"] = 14\n", - "figsuper.show(config= dict(displayModeBar = False, responsive = True))" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 37, - "outputs": [ - { - "data": { - "text/plain": "1964" - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_ipc_f[\"filing_year\"].min()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 34, - "outputs": [ - { - "data": { - "text/plain": "615464" - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_ipc_f[\"appln_id\"].nunique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 35, - "outputs": [ - { - "data": { - "text/plain": "591442" - }, - "execution_count": 35, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_ipc_f.merge(cpc_def, on=\"cpc_id\")[\"appln_id\"].nunique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 29, - "outputs": [ - { - "data": { - "text/plain": "array(['A', 'S', 'C'], dtype=object)" - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_ipc_f[\"ipc_class_level\"].unique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 133, - "outputs": [], - "source": [ - "tls_801 = pd.read_csv(r\"./EU_CH_scope/table_tls801.csv\", low_memory=False)\n", - "# tls_801.head()\n", - "scope_df = tls_801[((tls_801.eu_member==\"Y\")|\n", - " (tls_801.ctry_code == 'CN')|\n", - " (tls_801.ctry_code == 'NO')|\n", - " (tls_801.ctry_code == 'CH')|\n", - " (tls_801.ctry_code == 'UK'))]\n", - "scope_countries = scope_df[\"ctry_code\"].unique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 134, - "outputs": [ - { - "data": { - "text/plain": "array(['AT', 'BE', 'BG', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI',\n 'FR', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL',\n 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'], dtype=object)" - }, - "execution_count": 134, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "scope_countries" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 25, - "outputs": [ - { - "data": { - "text/plain": " person_id appln_id applt_seq_nr invt_seq_nr\n0 1 413601768 1 0\n1 21 332015605 1 0\n2 21 333490084 1 0\n3 21 335903805 1 0\n4 76 352908776 1 0\n.. ... ... ... ...\n95 220 417147567 1 0\n96 220 417932952 1 0\n97 220 420712526 1 0\n98 220 420927947 1 0\n99 220 420947631 1 0\n\n[100 rows x 4 columns]", - "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
person_idappln_idapplt_seq_nrinvt_seq_nr
0141360176810
12133201560510
22133349008410
32133590380510
47635290877610
...............
9522041714756710
9622041793295210
9722042071252610
9822042092794710
9922042094763110
\n

100 rows × 4 columns

\n
" - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "appln_pers.head(100)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": 26, - "outputs": [ - { - "ename": "KeyError", - "evalue": "'person_ctry_code'", - "output_type": "error", - "traceback": [ - "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", - "\u001B[1;31mKeyError\u001B[0m Traceback (most recent call last)", - "File \u001B[1;32m~\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\core\\indexes\\base.py:3649\u001B[0m, in \u001B[0;36mIndex.get_loc\u001B[1;34m(self, key)\u001B[0m\n\u001B[0;32m 3648\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m-> 3649\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_engine\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_loc\u001B[49m\u001B[43m(\u001B[49m\u001B[43mcasted_key\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 3650\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mKeyError\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m err:\n", - "File \u001B[1;32m~\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\_libs\\index.pyx:147\u001B[0m, in \u001B[0;36mpandas._libs.index.IndexEngine.get_loc\u001B[1;34m()\u001B[0m\n", - "File \u001B[1;32m~\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\_libs\\index.pyx:176\u001B[0m, in \u001B[0;36mpandas._libs.index.IndexEngine.get_loc\u001B[1;34m()\u001B[0m\n", - "File \u001B[1;32mpandas\\_libs\\hashtable_class_helper.pxi:7080\u001B[0m, in \u001B[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001B[1;34m()\u001B[0m\n", - "File \u001B[1;32mpandas\\_libs\\hashtable_class_helper.pxi:7088\u001B[0m, in \u001B[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001B[1;34m()\u001B[0m\n", - "\u001B[1;31mKeyError\u001B[0m: 'person_ctry_code'", - "\nThe above exception was the direct cause of the following exception:\n", - "\u001B[1;31mKeyError\u001B[0m Traceback (most recent call last)", - "Cell \u001B[1;32mIn[26], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m appln_ch \u001B[38;5;241m=\u001B[39m \u001B[43mappln_pers\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mgroupby\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mappln_id\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mfilter\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43;01mlambda\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mgr\u001B[49m\u001B[43m:\u001B[49m\u001B[43m \u001B[49m\u001B[43m(\u001B[49m\u001B[43m(\u001B[49m\u001B[43mgr\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mperson_ctry_code\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m\u001B[38;5;241;43m==\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mCN\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43many\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m|\u001B[39;49m\n\u001B[0;32m 2\u001B[0m \u001B[43m \u001B[49m\u001B[43m(\u001B[49m\u001B[43mgr\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mappln_auth\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m\u001B[38;5;241;43m==\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mCN\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43many\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 3\u001B[0m appln_scope \u001B[38;5;241m=\u001B[39m appln_ch\u001B[38;5;241m.\u001B[39mgroupby(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_id\u001B[39m\u001B[38;5;124m\"\u001B[39m)\u001B[38;5;241m.\u001B[39mfilter(\u001B[38;5;28;01mlambda\u001B[39;00m gr: ((gr[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mperson_ctry_code\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m.\u001B[39misin(eu_countries))\u001B[38;5;241m.\u001B[39many()\u001B[38;5;241m|\u001B[39m\n\u001B[0;32m 4\u001B[0m (gr[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_auth\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m.\u001B[39misin(eu_countries)))\u001B[38;5;241m.\u001B[39many())\n\u001B[0;32m 5\u001B[0m appln_scope[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_id\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m.\u001B[39mnunique()\n", - "File \u001B[1;32m~\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\core\\groupby\\generic.py:1741\u001B[0m, in \u001B[0;36mDataFrameGroupBy.filter\u001B[1;34m(self, func, dropna, *args, **kwargs)\u001B[0m\n\u001B[0;32m 1738\u001B[0m \u001B[38;5;28;01mfor\u001B[39;00m name, group \u001B[38;5;129;01min\u001B[39;00m gen:\n\u001B[0;32m 1739\u001B[0m \u001B[38;5;28mobject\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;21m__setattr__\u001B[39m(group, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mname\u001B[39m\u001B[38;5;124m\"\u001B[39m, name)\n\u001B[1;32m-> 1741\u001B[0m res \u001B[38;5;241m=\u001B[39m func(group, \u001B[38;5;241m*\u001B[39margs, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs)\n\u001B[0;32m 1743\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m 1744\u001B[0m res \u001B[38;5;241m=\u001B[39m res\u001B[38;5;241m.\u001B[39msqueeze()\n", - "Cell \u001B[1;32mIn[26], line 1\u001B[0m, in \u001B[0;36m\u001B[1;34m(gr)\u001B[0m\n\u001B[1;32m----> 1\u001B[0m appln_ch \u001B[38;5;241m=\u001B[39m appln_pers\u001B[38;5;241m.\u001B[39mgroupby(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_id\u001B[39m\u001B[38;5;124m\"\u001B[39m)\u001B[38;5;241m.\u001B[39mfilter(\u001B[38;5;28;01mlambda\u001B[39;00m gr: ((\u001B[43mgr\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mperson_ctry_code\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m]\u001B[49m\u001B[38;5;241m==\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mCN\u001B[39m\u001B[38;5;124m\"\u001B[39m)\u001B[38;5;241m.\u001B[39many()\u001B[38;5;241m|\u001B[39m\n\u001B[0;32m 2\u001B[0m (gr[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_auth\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m==\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mCN\u001B[39m\u001B[38;5;124m\"\u001B[39m))\u001B[38;5;241m.\u001B[39many())\n\u001B[0;32m 3\u001B[0m appln_scope \u001B[38;5;241m=\u001B[39m appln_ch\u001B[38;5;241m.\u001B[39mgroupby(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_id\u001B[39m\u001B[38;5;124m\"\u001B[39m)\u001B[38;5;241m.\u001B[39mfilter(\u001B[38;5;28;01mlambda\u001B[39;00m gr: ((gr[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mperson_ctry_code\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m.\u001B[39misin(eu_countries))\u001B[38;5;241m.\u001B[39many()\u001B[38;5;241m|\u001B[39m\n\u001B[0;32m 4\u001B[0m (gr[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_auth\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m.\u001B[39misin(eu_countries)))\u001B[38;5;241m.\u001B[39many())\n\u001B[0;32m 5\u001B[0m appln_scope[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mappln_id\u001B[39m\u001B[38;5;124m\"\u001B[39m]\u001B[38;5;241m.\u001B[39mnunique()\n", - "File \u001B[1;32m~\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\core\\frame.py:3745\u001B[0m, in \u001B[0;36mDataFrame.__getitem__\u001B[1;34m(self, key)\u001B[0m\n\u001B[0;32m 3743\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcolumns\u001B[38;5;241m.\u001B[39mnlevels \u001B[38;5;241m>\u001B[39m \u001B[38;5;241m1\u001B[39m:\n\u001B[0;32m 3744\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_getitem_multilevel(key)\n\u001B[1;32m-> 3745\u001B[0m indexer \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mcolumns\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_loc\u001B[49m\u001B[43m(\u001B[49m\u001B[43mkey\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 3746\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m is_integer(indexer):\n\u001B[0;32m 3747\u001B[0m indexer \u001B[38;5;241m=\u001B[39m [indexer]\n", - "File \u001B[1;32m~\\.conda\\envs\\MOME_BIGDATA\\lib\\site-packages\\pandas\\core\\indexes\\base.py:3651\u001B[0m, in \u001B[0;36mIndex.get_loc\u001B[1;34m(self, key)\u001B[0m\n\u001B[0;32m 3649\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_engine\u001B[38;5;241m.\u001B[39mget_loc(casted_key)\n\u001B[0;32m 3650\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mKeyError\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m err:\n\u001B[1;32m-> 3651\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mKeyError\u001B[39;00m(key) \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01merr\u001B[39;00m\n\u001B[0;32m 3652\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mTypeError\u001B[39;00m:\n\u001B[0;32m 3653\u001B[0m \u001B[38;5;66;03m# If we have a listlike key, _check_indexing_error will raise\u001B[39;00m\n\u001B[0;32m 3654\u001B[0m \u001B[38;5;66;03m# InvalidIndexError. Otherwise we fall through and re-raise\u001B[39;00m\n\u001B[0;32m 3655\u001B[0m \u001B[38;5;66;03m# the TypeError.\u001B[39;00m\n\u001B[0;32m 3656\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_check_indexing_error(key)\n", - "\u001B[1;31mKeyError\u001B[0m: 'person_ctry_code'" - ] - } - ], - "source": [ - "appln_ch = appln_pers.groupby(\"appln_id\").filter(lambda gr: ((gr[\"person_ctry_code\"]==\"CN\").any()|\n", - " (gr[\"appln_auth\"]==\"CN\")).any())\n", - "appln_scope = appln_ch.groupby(\"appln_id\").filter(lambda gr: ((gr[\"person_ctry_code\"].isin(scope_countries)).any()|\n", - " (gr[\"appln_auth\"].isin(scope_countries))).any())\n", - "appln_scope[\"appln_id\"].nunique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_scope" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_scope[appln_scope[\"appln_id\"].isin(appln[\"appln_id\"])]" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_scope[~appln_scope[\"appln_id\"].isin(appln[\"appln_id\"])]" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_cpc[\"cpc_id\"] = appln_cpc[\"cpc_class_symbol\"].str.replace(\" \",\"\")\n", + "from plotly.subplots import make_subplots\n", + "import plotly.graph_objects as go\n", "\n", - "appln_cpc_merge = appln_cpc.merge(cpc_def,on='cpc_id')\n", - "print (f\"CPC Merge loss: {(1-len(appln_cpc_merge)/len(appln_cpc))*100}%\")" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "len(appln_cpc_merge[appln_cpc_merge[\"data_scope\"]==True])" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_title.merge(appln_cpc_merge[appln_cpc_merge[\"data_scope\"]==True], on=\"appln_id\").merge(appln, on =\"appln_id\")[\"appln_nr\"].nunique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_title.merge(appln_cpc_merge[appln_cpc_merge[\"data_scope\"]==True], on=\"appln_id\").merge(appln, on =\"appln_id\")" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_title.merge(appln_cpc_merge[appln_cpc_merge[\"data_scope\"]==True], on=\"appln_id\")[\"appln_id\"].nunique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "cpc_def[cpc_def[\"data_scope\"]==True]" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln.sample(100)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_title.sample(100)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_data = appln.merge(appln_title, on=\"appln_id\")\n", - "appln_data.head()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_data[\"appln_auth\"].unique()" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_pers" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "pers_sector_primary = pers.groupby(\"han_id\", as_index=False)[\"psn_sector\"].agg(\n", - " lambda x: pd.Series.mode(x)[0]).rename(columns={\"psn_sector\":\"psn_sector_primary\"})\n", - "persn = pers.merge(pers_sector_primary, on='han_id')\n", - "persn" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "pers_sector_primary" + "# dom_distr\n", + "# year_output_by_domain\n", + "# rel_output_by_domain\n", + "# cumsum_by_domain\n", + "\n", + "figsuper = make_subplots(rows=2, cols=2, subplot_titles=[\"Distribution of IPC classes\",\"Cumulative sum of related co-patents\",\n", + " \"Related co-patents per year\",\"Relative growth of co-patents\"])\n", + "\n", + "\n", + "for trace in list(dom_distr.select_traces()):\n", + " trace.showlegend=False\n", + " # trace.barmode\n", + " figsuper.add_trace(trace,\n", + " row=1, col=1\n", + " )\n", + "\n", + "for trace in list(cumsum_by_domain.select_traces()):\n", + " trace.showlegend=False\n", + " figsuper.add_trace(trace,\n", + " row=1, col=2\n", + " )\n", + "\n", + "for trace in list(year_output_by_domain.select_traces()):\n", + " trace.showlegend=False\n", + " figsuper.add_trace(trace,\n", + " row=2, col=1\n", + " )\n", + "\n", + "for trace in list(rel_output_by_domain.select_traces()):\n", + " trace.showlegend=False\n", + " figsuper.add_trace(trace,\n", + " row=2, col=2\n", + " )\n", + "\n", + "\n", + "figsuper.update_layout(yaxis={'categoryorder':'total ascending'}, barmode='relative')\n", + "figsuper.update_yaxes(\n", + " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", + " ticks=\"outside\")\n", + "figsuper.update_xaxes(\n", + " showgrid=True,showline=True, linewidth=1, linecolor='black', mirror=True,\n", + " ticks=\"outside\")\n", + "\n", + "figsuper.update_layout({'template':\"plotly\",\"font_family\":\"Montserrat\"})\n", + "figsuper['layout']['xaxis1'].update(tickformat=\".0f\")\n", + "figsuper['layout']['yaxis2'].update(tickformat=\".0f\")\n", + "figsuper['layout']['yaxis4'].update(zeroline=True, zerolinewidth=0.5, zerolinecolor='grey',tickformat=\".0%\")\n", + "figsuper['layout'][f'xaxis'][\"range\"] = [0,400]\n", + "for i in range(2,5):\n", + " figsuper['layout'][f'xaxis{i}'][\"range\"] = [2010.8,2022.2]\n", + "figsuper['layout'][\"font\"][\"size\"]=14\n", + "for a in figsuper['layout'][\"annotations\"]:\n", + " a[\"font\"][\"size\"] = 14\n", + "figsuper.show(config= dict(displayModeBar = False, responsive = True),height=800,width=1600,scale = 4)\n", + "figsuper.write_image(rf\"{fromdir}/plots/ipc_classes.png\",height=900,width=1600,scale = 4)" ], "metadata": { "collapsed": false @@ -21193,47 +18104,12 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 425, "outputs": [], "source": [], "metadata": { "collapsed": false } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "appln_merge = appln.merge(appln_title, on=\"appln_id\")#.merge(appln_pers,on=\"appln_id\")\n", - "appln_merge.to_excel(\"appln_data.xlsx\", index=False)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "person_merge = appln_pers.merge(pers,on=\"person_id\")\n", - "person_merge.to_excel(\"person_data.xlsx\", index=False)" - ], - "metadata": { - "collapsed": false - } - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [ - "pers[\"person_ctry_code\"].unique()" - ], - "metadata": { - "collapsed": false - } } ], "metadata": {