{"id":880,"date":"2020-05-14T17:34:23","date_gmt":"2020-05-14T08:34:23","guid":{"rendered":"http:\/\/hirlab.net\/nblog\/?p=880"},"modified":"2020-05-16T22:58:10","modified_gmt":"2020-05-16T13:58:10","slug":"pytable-documentation","status":"publish","type":"post","link":"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/","title":{"rendered":"pyTable Documentation"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_11 counter-hierarchy counter-decimal ez-toc-light-blue\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u30b3\u30f3\u30c6\u30f3\u30c4<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#PyTable\" title=\"PyTable\">PyTable<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Installation\" title=\"Installation\">Installation<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Basically_usage\" title=\"Basically usage\">Basically usage<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Create_%22rows%22\" title=\"Create &quot;rows&quot;\">Create \"rows\"<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Change_background_colors\" title=\"Change background colors\">Change background colors<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Change_design_of_table_cells\" title=\"Change design of table cells\">Change design of table cells<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#striped\" title=\"striped\">striped<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#dark\" title=\"dark\">dark<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#light\" title=\"light\">light<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Change_design_of_a_table_header\" title=\"Change design of a table header\">Change design of a table header<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#dark-2\" title=\"dark\">dark<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#gray\" title=\"gray\">gray<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#light-2\" title=\"light\">light<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#sky\" title=\"sky\">sky<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Others\" title=\"Others\">Others<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Other_args_introduction\" title=\"Other args introduction\">Other args introduction<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#dataloc,_thloc,_tdloc\" title=\"data_loc, th_loc, td_loc\">data_loc, th_loc, td_loc<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#figsize\" title=\"figsize\">figsize<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#edge\" title=\"edge\">edge<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Tips_about_significant_digits\" title=\"Tips about significant digits\">Tips about significant digits<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#Before_modification\" title=\"Before modification\">Before modification<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_880\/#After_modification\" title=\"After modification\">After modification<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"PyTable\"><\/span>PyTable<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><em>\u00a0- last update\uff1a2020.05.14 ... pytab ver. 1.0.1 - \u00a0[<a href=\"https:\/\/hirlab.net\/nblog\/category\/programming\/art_845\/\">Japanese documentation<\/a>]<\/em><\/p>\n<p>PyTable is a tool to plot a table easily.<\/p>\n<p>In this article, the ways to use pyTable and what you can do are written.<\/p>\n<p>This is an official documentation of pyTable.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Installation\"><\/span>Installation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"lang:sh decode:true \" title=\"pytable\">$ pip install pytab<\/pre>\n<p>source (Github) : <a href=\"https:\/\/github.com\/HiroshiARAKI\/pytable\" target=\"_blank\" rel=\"noopener noreferrer\">HiroshiARAKI\/pytable: pytable is the library to plot table easily.<\/a><\/p>\n<p>PyPI : <a href=\"https:\/\/pypi.org\/project\/pytab\/\" target=\"_blank\" rel=\"noopener noreferrer\">pytab \u00b7 PyPI<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Basically_usage\"><\/span>Basically usage<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>PyTable is worked on matplotlib, and pyTable is just wrapped library to use that easily.<\/p>\n<p>As below, you can create a table by passing data as a dict variable.<\/p>\n<p>Now, the dict variable is used as a column data of a table.<\/p>\n<pre class=\"lang:python decode:true \" title=\"pyTable\u30b5\u30f3\u30d7\u30eb\">import pytab as pt\r\n\r\n\r\nif __name__ == '__main__':\r\n    data = {\r\n        'a': [1.0, 2.1, 3.5, '-', 2.0, 1.0, 2.1, 3.5, 4.0, 2.0, ],\r\n        'b': [5.7, 6.1, 7.2, 8.3, 1.2, 5.7, 6.1, 7.2, 8.3, '-', ],\r\n        }\r\n\r\n    # The simplest table\r\n    pt.table(data=data)\r\n\r\n    pt.show()<\/pre>\n<p><img loading=\"lazy\" class=\"size-full wp-image-847 aligncenter\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/table_0.png\" alt=\"pyTable1\" width=\"450\" height=\"450\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/table_0.png 450w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/table_0-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/table_0-300x300.png 300w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Create_%22rows%22\"><\/span>Create \"rows\"<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can add a header of row data in the left side of a table.<\/p>\n<pre class=\"lang:python decode:true \" title=\"PyTable\">import pytab as pt\r\n\r\n\r\nif __name__ == '__main__':\r\n    data = {\r\n        'Tokyo': [27, 23, 27, 24],\r\n        'Osaka': [26, 23, 27, 28],\r\n    }\r\n\r\n    rows = ['5\/15', '5\/16', '5\/17', '5\/18']\r\n\r\n    pt.table(\r\n        data=data,\r\n        rows=rows,\r\n    )\r\n\r\n    pt.show()<\/pre>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-849 aligncenter\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_1-1-300x237.png\" alt=\"pyTable\" width=\"300\" height=\"237\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_1-1-300x237.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_1-1.png 706w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Change_background_colors\"><\/span>Change background colors<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When you want to change background colors of a header of a table, you solve that by passing color names or color codes to <span class=\"lang:python decode:true crayon-inline \">th_c<\/span>\u00a0 or <span class=\"lang:python decode:true crayon-inline\">td_c<\/span>.<\/p>\n<pre class=\"lang:python decode:true\" title=\"pyTable\">import pytab as pt\r\n\r\n\r\nif __name__ == '__main__':\r\n    data = {\r\n        'Tokyo': [27, 23, 27, 24],\r\n        'Osaka': [26, 23, 27, 28],\r\n    }\r\n\r\n    rows = ['5\/15', '5\/16', '5\/17', '5\/18']\r\n\r\n    pt.table(\r\n        data=data,\r\n        rows=rows,\r\n        th_c='#aaddff',\r\n        td_c='lightgray',\r\n    )\r\n\r\n    pt.show()<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-852\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_2-1-300x210.png\" alt=\"pyTable\" width=\"300\" height=\"210\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_2-1-300x210.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_2-1-768x538.png 768w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_2-1.png 794w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Color names are same to matplotlib's\uff0e<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-854\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color0.png\" alt=\"pytable-color\" width=\"872\" height=\"118\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color0.png 872w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color0-300x41.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color0-768x104.png 768w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-853\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color.png\" alt=\"pytable-color\" width=\"872\" height=\"162\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color.png 872w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color-300x56.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color-768x143.png 768w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-855\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color1.png\" alt=\"pytable-color\" width=\"872\" height=\"866\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color1.png 872w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color1-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color1-300x298.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/color1-768x763.png 768w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/p>\n<p>(\u53c2\u7167\uff1a<a href=\"https:\/\/matplotlib.org\/3.1.0\/gallery\/color\/named_colors.html\" target=\"_blank\" rel=\"noopener noreferrer\">List of named colors \u2013 Matplotlib 3.1.0 documentation<\/a>)<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Change_design_of_table_cells\"><\/span>Change design of table cells<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Also, you can change table cells to simple and attractive design ones by using <span class=\"lang:python decode:true crayon-inline \">table_type<\/span>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"striped\"><\/span>striped<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:python decode:true \" title=\"pyTable\">pt.table(\r\n        data=data,\r\n        th_c='#aaddff',\r\n        table_type='striped',\r\n    )<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-857\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_3-1-300x300.png\" alt=\"pytable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_3-1-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_3-1-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_3-1.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"dark\"><\/span>dark<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:python decode:true \" title=\"pyTable \">pt.table(\r\n    data=data,\r\n    table_type='dark',\r\n)<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-861\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_4-1-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_4-1-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_4-1-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_4-1.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"light\"><\/span>light<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:python decode:true \" title=\"pyTable\">pt.table( \r\n    data=data, \r\n    table_type='light', \r\n)<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-862\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_5-1-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_5-1-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_5-1-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_5-1.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-7123758399787647\" data-ad-slot=\"1665651601\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Change_design_of_a_table_header\"><\/span>Change design of a table header<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To only change the colors of a table header attracts people.<\/p>\n<p>At this time, you need pass a design name to <span class=\"lang:python decode:true crayon-inline\">th_type<\/span>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"dark-2\"><\/span>dark<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:python decode:true \" title=\"pyTable\">pt.table(\r\n    data=data,\r\n    th_type='dark'\r\n)<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-863\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_6-1-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_6-1-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_6-1-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_6-1.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"gray\"><\/span>gray<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-864\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_7-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_7-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_7-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_7.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"light-2\"><\/span>light<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-865\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_8-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_8-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_8-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_8.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"sky\"><\/span>sky<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-866\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_9-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_9-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_9-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_9.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Others\"><\/span>Others<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In addition, \u00a0<span class=\"lang:python decode:true crayon-inline\">'blue'<\/span>\u00a0,<span class=\"lang:python decode:true crayon-inline\">'red'<\/span>\u00a0,<span class=\"lang:python decode:true crayon-inline\">'green'<\/span>\u00a0,<span class=\"lang:python decode:true crayon-inline\">'orange'<\/span>\u00a0 are available.<\/p>\n<p>And, you can assign the color names or color codes to the background color (<span class=\"lang:python decode:true crayon-inline\">th_face<\/span>) \u00a0and a text color (<span class=\"lang:python decode:true crayon-inline\">th_text<\/span>), respectively.<\/p>\n<pre class=\"lang:python decode:true \" title=\"pyTable\">pt.table(\r\n    data=data,\r\n    th_face='limegreen',\r\n    th_text='olive',\r\n)<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-867\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_14-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_14-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_14-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_14.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Other_args_introduction\"><\/span>Other args introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The function <span class=\"lang:python decode:true crayon-inline\">table()<\/span>\u00a0has some options you can use, besides that.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"dataloc,_thloc,_tdloc\"><\/span>data_loc, th_loc, td_loc<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The locations of cell data, a header (columns) and rows are adjustable.<\/p>\n<p>Normally, they are set to right align, center align and center align, respectively, and you can assign them to \u00a0<span class=\"lang:python decode:true crayon-inline\">'left'<\/span>\u00a0,<span class=\"lang:python decode:true crayon-inline \">'center'<\/span>\u00a0or\u00a0<span class=\"lang:python decode:true crayon-inline\">'right'<\/span>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"figsize\"><\/span>figsize<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You set the size of a figure by <span class=\"lang:python decode:true crayon-inline \">figsize<\/span>\u00a0,\u00a0and need assign that as <span class=\"lang:python decode:true crayon-inline\">Tuple[float, float]<\/span>.<\/p>\n<p>Normally, it is set to <span class=\"lang:python decode:true crayon-inline\">(3, 3)<\/span>, but this is for a small table.<\/p>\n<p>So, in the case that you create bigger table, you need adjust this argument to make it look good.<\/p>\n<p>It is fine to set to <span class=\"lang:python decode:true crayon-inline\">None<\/span>\u00a0and adjust it by <span class=\"lang:python decode:true crayon-inline\">show()<\/span>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"edge\"><\/span>edge<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This is an argument about the edges of a table.<\/p>\n<p>Normally, this is set to <span class=\"lang:python decode:true crayon-inline\">'closed'<\/span>, but you can also use <span class=\"lang:python decode:true crayon-inline\">['open', 'closed', 'horizontal', 'vertical']<\/span>.<\/p>\n<p>They mean All edges are invisible, All edges are visible, Only horizontal edges are visible and Only vertical edges \u00a0are visible, respectively.<\/p>\n<p>If you use options except \u00a0<span class=\"lang:python decode:true crayon-inline\">'closed'<\/span>, you cannot change a background colors.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tips_about_significant_digits\"><\/span>Tips about significant digits<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When you create a table using experimental results, you may be careful about significant digits.<\/p>\n<p>At such time, you translate data to <span class=\"lang:python decode:true crayon-inline\">str<\/span>\u00a0before creating a table.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Before_modification\"><\/span>Before modification<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:python decode:true\" title=\"pyTable\">import pytab as pt\r\n\r\n\r\nif __name__ == '__main__':\r\n    data = {\r\n        'Expt. 1': [0.023, 0.410, 0.001, 0.000, 0.325, 0.010, ],\r\n        'Expt. 2': [0.060, 0.112, 0.109, 0.030, 0.051, 0.000, ],\r\n    }\r\n\r\n    pt.table(\r\n        data=data,\r\n    )\r\n\r\n    pt.show()<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-874\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_15-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_15-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_15-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_15.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"After_modification\"><\/span>After modification<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"lang:python decode:true\" title=\"pyTable\">import pytab as pt\r\n\r\n\r\nif __name__ == '__main__':\r\n    data = {\r\n        'Expt. 1': [0.023, 0.410, 0.001, 0.000, 0.325, 0.010, ],\r\n        'Expt. 2': [0.060, 0.112, 0.109, 0.030, 0.051, 0.000, ],\r\n    }\r\n\r\n    # \u6709\u52b9\u6570\u5b57\u3067\u63c3\u3048\u3066\u5909\u63db\r\n    for k in data:\r\n        data[k] = ['{:.4f}'.format(d) for d in data[k]]\r\n\r\n    pt.table(\r\n        data=data,\r\n    )\r\n\r\n    pt.show()<\/pre>\n<p><img loading=\"lazy\" class=\"aligncenter size-medium wp-image-875\" src=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_16-300x300.png\" alt=\"pyTable\" width=\"300\" height=\"300\" srcset=\"https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_16-300x300.png 300w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_16-150x150.png 150w, https:\/\/hirlab.net\/nblog\/wp-content\/uploads\/2020\/05\/Figure_16.png 600w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PyTable is the tool to plot a table easily. In this article, the ways to use pyTable and what you can do are written. This is an official documentation of pyTable.<\/p>\n","protected":false},"author":1,"featured_media":859,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[71,70,50],"_links":{"self":[{"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/posts\/880"}],"collection":[{"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/comments?post=880"}],"version-history":[{"count":7,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/posts\/880\/revisions"}],"predecessor-version":[{"id":913,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/posts\/880\/revisions\/913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/media\/859"}],"wp:attachment":[{"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/media?parent=880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/categories?post=880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hirlab.net\/nblog\/wp-json\/wp\/v2\/tags?post=880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}