{"id":391,"date":"2023-06-15T11:29:17","date_gmt":"2023-06-15T11:29:17","guid":{"rendered":"https:\/\/www.jibsheet.net\/linux\/?p=391"},"modified":"2023-06-15T11:31:52","modified_gmt":"2023-06-15T11:31:52","slug":"how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter","status":"publish","type":"post","link":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/","title":{"rendered":"How to display Chinese characters in Matplotlib with Windows\/Jupyter"},"content":{"rendered":"<p>I asked ChatGPT to generate a sample list of Tang Dynasty Poets from the book of 300 poems.<\/p>\n<p>It gave me this &#8211; it had some duplicates and one Song Dynasty poet in it.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import pandas as pd\r\n\r\ndata = [\r\n    {\"English Name\": \"Li Bai\", \"Chinese Name\": \"\u674e\u767d\", \"Dates\": \"701-762\"},\r\n    {\"English Name\": \"Du Fu\", \"Chinese Name\": \"\u675c\u752b\", \"Dates\": \"712-770\"},\r\n    {\"English Name\": \"Wang Wei\", \"Chinese Name\": \"\u738b\u7ef4\", \"Dates\": \"699-759\"},\r\n    {\"English Name\": \"Li Shangyin\", \"Chinese Name\": \"\u674e\u5546\u9690\", \"Dates\": \"813-858\"},\r\n    {\"English Name\": \"Bai Juyi\", \"Chinese Name\": \"\u767d\u5c45\u6613\", \"Dates\": \"772-846\"},\r\n    {\"English Name\": \"Han Yu\", \"Chinese Name\": \"\u97e9\u6108\", \"Dates\": \"768-824\"},\r\n    {\"English Name\": \"Meng Haoran\", \"Chinese Name\": \"\u5b5f\u6d69\u7136\", \"Dates\": \"689-740\"},\r\n    {\"English Name\": \"Li He\", \"Chinese Name\": \"\u674e\u8d3a\", \"Dates\": \"790-816\"},\r\n    {\"English Name\": \"Li Yu\", \"Chinese Name\": \"\u674e\u715c\", \"Dates\": \"937-978\"},\r\n    {\"English Name\": \"Li Qingzhao\", \"Chinese Name\": \"\u674e\u6e05\u7167\", \"Dates\": \"1084-1151\"},\r\n    {\"English Name\": \"Liu Zongyuan\", \"Chinese Name\": \"\u67f3\u5b97\u5143\", \"Dates\": \"773-819\"},\r\n    {\"English Name\": \"Wei Yingwu\", \"Chinese Name\": \"\u97e6\u5e94\u7269\", \"Dates\": \"737-792\"},\r\n    {\"English Name\": \"Wang Changling\", \"Chinese Name\": \"\u738b\u660c\u9f84\", \"Dates\": \"698-757\"},\r\n    {\"English Name\": \"Cui Hao\", \"Chinese Name\": \"\u5d14\u98a2\", \"Dates\": \"704-754\"},\r\n    {\"English Name\": \"Du Mu\", \"Chinese Name\": \"\u675c\u7267\", \"Dates\": \"803-852\"},\r\n    {\"English Name\": \"Meng Jiao\", \"Chinese Name\": \"\u5b5f\u90ca\", \"Dates\": \"751-814\"},\r\n    {\"English Name\": \"Yuan Zhen\", \"Chinese Name\": \"\u5143\u7a39\", \"Dates\": \"779-831\"},\r\n    {\"English Name\": \"Zhang Jiuling\", \"Chinese Name\": \"\u5f20\u4e5d\u9f84\", \"Dates\": \"678-740\"},\r\n    {\"English Name\": \"Meng Haoran\", \"Chinese Name\": \"\u5b5f\u6d69\u7136\", \"Dates\": \"689-740\"},\r\n    {\"English Name\": \"Wei Yingwu\", \"Chinese Name\": \"\u97e6\u5e94\u7269\", \"Dates\": \"737-792\"}\r\n]\r\n\r\ndf = pd.DataFrame(data)\r\nprint(df)\r\n<\/pre>\n<p>I cleaned it up and ask it to give me plot of the ages &#8211; so I can see how lives overlapped<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import pandas as pd\r\nimport matplotlib.pyplot as plt\r\n\r\ndata = [\r\n    {\"English Name\": \"Li Bai\", \"Chinese Name\": \"\u674e\u767d\", \"Dates\": \"701-762\"},\r\n    {\"English Name\": \"Du Fu\", \"Chinese Name\": \"\u675c\u752b\", \"Dates\": \"712-770\"},\r\n    {\"English Name\": \"Wang Wei\", \"Chinese Name\": \"\u738b\u7ef4\", \"Dates\": \"699-759\"},\r\n    {\"English Name\": \"Li Shangyin\", \"Chinese Name\": \"\u674e\u5546\u9690\", \"Dates\": \"813-858\"},\r\n    {\"English Name\": \"Bai Juyi\", \"Chinese Name\": \"\u767d\u5c45\u6613\", \"Dates\": \"772-846\"},\r\n    {\"English Name\": \"Han Yu\", \"Chinese Name\": \"\u97e9\u6108\", \"Dates\": \"768-824\"},\r\n    {\"English Name\": \"Meng Haoran\", \"Chinese Name\": \"\u5b5f\u6d69\u7136\", \"Dates\": \"689-740\"},\r\n    {\"English Name\": \"Li He\", \"Chinese Name\": \"\u674e\u8d3a\", \"Dates\": \"790-816\"},\r\n    {\"English Name\": \"Li Yu\", \"Chinese Name\": \"\u674e\u715c\", \"Dates\": \"937-978\"},\r\n    {\"English Name\": \"Liu Zongyuan\", \"Chinese Name\": \"\u67f3\u5b97\u5143\", \"Dates\": \"773-819\"},\r\n    {\"English Name\": \"Wei Yingwu\", \"Chinese Name\": \"\u97e6\u5e94\u7269\", \"Dates\": \"737-792\"},\r\n    {\"English Name\": \"Wang Changling\", \"Chinese Name\": \"\u738b\u660c\u9f84\", \"Dates\": \"698-757\"},\r\n    {\"English Name\": \"Cui Hao\", \"Chinese Name\": \"\u5d14\u98a2\", \"Dates\": \"704-754\"},\r\n    {\"English Name\": \"Du Mu\", \"Chinese Name\": \"\u675c\u7267\", \"Dates\": \"803-852\"},\r\n    {\"English Name\": \"Meng Jiao\", \"Chinese Name\": \"\u5b5f\u90ca\", \"Dates\": \"751-814\"},\r\n    {\"English Name\": \"Yuan Zhen\", \"Chinese Name\": \"\u5143\u7a39\", \"Dates\": \"779-831\"},\r\n    {\"English Name\": \"Zhang Jiuling\", \"Chinese Name\": \"\u5f20\u4e5d\u9f84\", \"Dates\": \"678-740\"}\r\n]\r\n\r\ndf = pd.DataFrame(data)\r\ndf[['Start', 'End']] = df['Dates'].str.split('-', expand=True).astype(int)\r\n\r\n# Sorting by start date\r\ndf = df.sort_values(by='Start')\r\n\r\n# Creating the chart\r\nfig, ax = plt.subplots()\r\nfor i, row in df.iterrows():\r\n    ax.plot([row['Start'], row['End']], [i, i], linewidth=3, color='blue')\r\n    ax.scatter(row['Start'], i, color='red', marker='o', s=50)\r\n    ax.scatter(row['End'], i, color='green', marker='o', s=50)\r\n    ax.text(row['Start'], i-0.2, row['English Name'], ha='right')\r\n    ax.text(row['End'], i-0.2, row['Chinese Name'], ha='left')\r\n\r\n# Setting chart labels and title\r\nax.set_yticks(range(len(df)))\r\nax.set_yticklabels([])\r\nax.set_xlabel('Year')\r\nax.set_title('Tang Dynasty Poets - Lifespan Overlap')\r\n\r\nplt.show()\r\n<\/pre>\n<p>It gave me an error on the Chinese charters.\u00a0 \u00a0So, I searched and found that I can load a font<\/p>\n<p>And specify the fontproperties for the label you have issue with.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import pandas as pd\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.font_manager as fm\r\n\r\ndata = [\r\n    {\"English Name\": \"Li Bai\", \"Chinese Name\": \"\u674e\u767d\", \"Dates\": \"701-762\"},\r\n    {\"English Name\": \"Du Fu\", \"Chinese Name\": \"\u675c\u752b\", \"Dates\": \"712-770\"},\r\n    {\"English Name\": \"Wang Wei\", \"Chinese Name\": \"\u738b\u7ef4\", \"Dates\": \"699-759\"},\r\n    {\"English Name\": \"Li Shangyin\", \"Chinese Name\": \"\u674e\u5546\u9690\", \"Dates\": \"813-858\"},\r\n    {\"English Name\": \"Bai Juyi\", \"Chinese Name\": \"\u767d\u5c45\u6613\", \"Dates\": \"772-846\"},\r\n    {\"English Name\": \"Han Yu\", \"Chinese Name\": \"\u97e9\u6108\", \"Dates\": \"768-824\"},\r\n    {\"English Name\": \"Meng Haoran\", \"Chinese Name\": \"\u5b5f\u6d69\u7136\", \"Dates\": \"689-740\"},\r\n    {\"English Name\": \"Li He\", \"Chinese Name\": \"\u674e\u8d3a\", \"Dates\": \"790-816\"},\r\n    {\"English Name\": \"Li Yu\", \"Chinese Name\": \"\u674e\u715c\", \"Dates\": \"937-978\"},\r\n    {\"English Name\": \"Liu Zongyuan\", \"Chinese Name\": \"\u67f3\u5b97\u5143\", \"Dates\": \"773-819\"},\r\n    {\"English Name\": \"Wei Yingwu\", \"Chinese Name\": \"\u97e6\u5e94\u7269\", \"Dates\": \"737-792\"},\r\n    {\"English Name\": \"Wang Changling\", \"Chinese Name\": \"\u738b\u660c\u9f84\", \"Dates\": \"698-757\"},\r\n    {\"English Name\": \"Cui Hao\", \"Chinese Name\": \"\u5d14\u98a2\", \"Dates\": \"704-754\"},\r\n    {\"English Name\": \"Du Mu\", \"Chinese Name\": \"\u675c\u7267\", \"Dates\": \"803-852\"},\r\n    {\"English Name\": \"Meng Jiao\", \"Chinese Name\": \"\u5b5f\u90ca\", \"Dates\": \"751-814\"},\r\n    {\"English Name\": \"Yuan Zhen\", \"Chinese Name\": \"\u5143\u7a39\", \"Dates\": \"779-831\"},\r\n    {\"English Name\": \"Zhang Jiuling\", \"Chinese Name\": \"\u5f20\u4e5d\u9f84\", \"Dates\": \"678-740\"}\r\n]\r\n\r\ndf = pd.DataFrame(data)\r\n\r\nfont = fm.FontProperties(fname=r\"C:\\windows\\fonts\\simsun.ttc\")\r\n\r\n\r\ndf[['Start', 'End']] = df['Dates'].str.split('-', expand=True).astype(int)\r\n\r\n# Sorting by start date\r\ndf = df.sort_values(by='Start')\r\n\r\n# Creating the chart\r\nfig, ax = plt.subplots(figsize=(12, 8))\r\nfor i, row in df.iterrows():\r\n    ax.plot([row['Start'], row['End']], [i, i], linewidth=3, color='blue')\r\n    ax.scatter(row['Start'], i, color='red', marker='o', s=50)\r\n    ax.scatter(row['End'], i, color='green', marker='o', s=50)\r\n    ax.text(row['Start'], i-0.2, row['English Name'], ha='right')\r\n    ax.text(row['End'], i-0.2, row['Chinese Name'], ha='left', fontproperties=font)\r\n\r\n# Setting chart labels and title\r\nax.set_yticks(range(len(df)))\r\nax.set_yticklabels([])\r\nax.set_xlabel('Year')\r\nax.set_title('Tang Dynasty Poets - Lifespan Overlap')\r\n\r\nplt.show()<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-393\" src=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png\" alt=\"\" width=\"300\" height=\"207\" srcset=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png 300w, https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph.png 719w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I asked ChatGPT to generate a sample list of Tang Dynasty Poets from the book of 300 poems. It gave me this &#8211; it had some duplicates and one Song Dynasty poet in it. import pandas as pd data = [ {&#8220;English Name&#8221;: &#8220;Li Bai&#8221;, &#8220;Chinese Name&#8221;: &#8220;\u674e\u767d&#8221;, &#8220;Dates&#8221;: &#8220;701-762&#8221;}, {&#8220;English Name&#8221;: &#8220;Du Fu&#8221;, &#8220;Chinese Name&#8221;: &#8220;\u675c\u752b&#8221;, &#8220;Dates&#8221;: &#8220;712-770&#8221;}, {&#8220;English [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30,13,14],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to display Chinese characters in Matplotlib with Windows\/Jupyter - Jon Allen&#039;s Linux Stuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to display Chinese characters in Matplotlib with Windows\/Jupyter - Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"og:description\" content=\"I asked ChatGPT to generate a sample list of Tang Dynasty Poets from the book of 300 poems. It gave me this &#8211; it had some duplicates and one Song Dynasty poet in it. import pandas as pd data = [ {&quot;English Name&quot;: &quot;Li Bai&quot;, &quot;Chinese Name&quot;: &quot;\u674e\u767d&quot;, &quot;Dates&quot;: &quot;701-762&quot;}, {&quot;English Name&quot;: &quot;Du Fu&quot;, &quot;Chinese Name&quot;: &quot;\u675c\u752b&quot;, &quot;Dates&quot;: &quot;712-770&quot;}, {&quot;English [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\" \/>\n<meta property=\"og:site_name\" content=\"Jon Allen&#039;s Linux Stuff\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-15T11:29:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-15T11:31:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png\" \/>\n<meta name=\"author\" content=\"jonallen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jonallen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\"},\"author\":{\"name\":\"jonallen\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"headline\":\"How to display Chinese characters in Matplotlib with Windows\/Jupyter\",\"datePublished\":\"2023-06-15T11:29:17+00:00\",\"dateModified\":\"2023-06-15T11:31:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\"},\"wordCount\":97,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"image\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png\",\"articleSection\":[\"ChatGPT\",\"Jupyter Notebooks\",\"Pandas\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\",\"name\":\"How to display Chinese characters in Matplotlib with Windows\/Jupyter - Jon Allen&#039;s Linux Stuff\",\"isPartOf\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png\",\"datePublished\":\"2023-06-15T11:29:17+00:00\",\"dateModified\":\"2023-06-15T11:31:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph.png\",\"contentUrl\":\"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph.png\",\"width\":719,\"height\":496},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.jibsheet.net\/linux\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to display Chinese characters in Matplotlib with Windows\/Jupyter\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#website\",\"url\":\"https:\/\/www.jibsheet.net\/linux\/\",\"name\":\"Jon Allen's Linux Stuff\",\"description\":\"Howto&#039;s, Observations, and stuff\",\"publisher\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993\",\"name\":\"jonallen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g\",\"caption\":\"jonallen\"},\"logo\":{\"@id\":\"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.jibsheet.net\/linux\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to display Chinese characters in Matplotlib with Windows\/Jupyter - Jon Allen&#039;s Linux Stuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/","og_locale":"en_US","og_type":"article","og_title":"How to display Chinese characters in Matplotlib with Windows\/Jupyter - Jon Allen&#039;s Linux Stuff","og_description":"I asked ChatGPT to generate a sample list of Tang Dynasty Poets from the book of 300 poems. It gave me this &#8211; it had some duplicates and one Song Dynasty poet in it. import pandas as pd data = [ {\"English Name\": \"Li Bai\", \"Chinese Name\": \"\u674e\u767d\", \"Dates\": \"701-762\"}, {\"English Name\": \"Du Fu\", \"Chinese Name\": \"\u675c\u752b\", \"Dates\": \"712-770\"}, {\"English [&hellip;]","og_url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/","og_site_name":"Jon Allen&#039;s Linux Stuff","article_published_time":"2023-06-15T11:29:17+00:00","article_modified_time":"2023-06-15T11:31:52+00:00","og_image":[{"url":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png"}],"author":"jonallen","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jonallen","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#article","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/"},"author":{"name":"jonallen","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"headline":"How to display Chinese characters in Matplotlib with Windows\/Jupyter","datePublished":"2023-06-15T11:29:17+00:00","dateModified":"2023-06-15T11:31:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/"},"wordCount":97,"commentCount":0,"publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"image":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage"},"thumbnailUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png","articleSection":["ChatGPT","Jupyter Notebooks","Pandas"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/","url":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/","name":"How to display Chinese characters in Matplotlib with Windows\/Jupyter - Jon Allen&#039;s Linux Stuff","isPartOf":{"@id":"https:\/\/www.jibsheet.net\/linux\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage"},"image":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage"},"thumbnailUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph-300x207.png","datePublished":"2023-06-15T11:29:17+00:00","dateModified":"2023-06-15T11:31:52+00:00","breadcrumb":{"@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#primaryimage","url":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph.png","contentUrl":"https:\/\/www.jibsheet.net\/linux\/wp-content\/uploads\/2023\/06\/tang_dynasty_poets_graph.png","width":719,"height":496},{"@type":"BreadcrumbList","@id":"https:\/\/www.jibsheet.net\/linux\/index.php\/2023\/06\/15\/how-to-display-chinese-characters-in-matplotlib-with-windows-jupyter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.jibsheet.net\/linux\/"},{"@type":"ListItem","position":2,"name":"How to display Chinese characters in Matplotlib with Windows\/Jupyter"}]},{"@type":"WebSite","@id":"https:\/\/www.jibsheet.net\/linux\/#website","url":"https:\/\/www.jibsheet.net\/linux\/","name":"Jon Allen's Linux Stuff","description":"Howto&#039;s, Observations, and stuff","publisher":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.jibsheet.net\/linux\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/295a80d0b2aa929b648c4fdddee83993","name":"jonallen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d7c061ce9db8f5e4710555585475882?s=96&d=mm&r=g","caption":"jonallen"},"logo":{"@id":"https:\/\/www.jibsheet.net\/linux\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.jibsheet.net\/linux"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/391"}],"collection":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/comments?post=391"}],"version-history":[{"count":2,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/391\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/posts\/391\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/media?parent=391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/categories?post=391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jibsheet.net\/linux\/index.php\/wp-json\/wp\/v2\/tags?post=391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}