{"id":74778,"date":"2026-09-23T03:01:00","date_gmt":"2026-09-22T17:01:00","guid":{"rendered":"https:\/\/www.rjmprogramming.com.au\/ITblog\/?p=74778"},"modified":"2026-09-22T17:28:10","modified_gmt":"2026-09-22T07:28:10","slug":"python-matplotlib-more-charts-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-more-charts-tutorial\/","title":{"rendered":"Python Matplotlib More Charts Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Python Matplotlib More Charts Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python_more_charts.gif\" title=\"Python Matplotlib More Charts Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Python Matplotlib More Charts Tutorial<\/p><\/div>\n<p>We doubt you&#8217;ll meet many programmers not interested in &#8220;peer to peer&#8221; software suite arrangements.  Thinking about Python <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module, of course, &#8220;peer to peer&#8221; becomes interesting in that the difference between the presentation of various chart types amounts to a couple of lines of Python code, in essence.<\/p>\n<p>With that in mind, we think to rewrite wholly fleshed out new code file pairs consisting of &#8230;<\/p>\n<ul>\n<li>a Python code file specializing in creation of a display of a particular <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module chart type &#8230; supervised by a &#8230;<\/li>\n<li>a PHP supervising code file specializing in helping Python code file creation of a display of a particular <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module chart type<\/li>\n<\/ul>\n<p> &#8230; for any one newly considered <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module chart type sounds like &#8220;too much hard work&#8221;.  Why not add intelligence to that original Pie Chart code file pairing Python and PHP set and work off that?  We came up with this idea, and it came to fruition.<\/p>\n<p>And so, that is the long answer to yesterday&#8217;s question as to whether our &#8230;<\/p>\n<blockquote><p>\nstrange idea\n<\/p><\/blockquote>\n<p> &#8230; would work?!  The short answer &#8230;<\/p>\n<blockquote><p>\nYes <font size=1 color=brown>&#8230; the strange idea worked<\/font>\n<\/p><\/blockquote>\n<p> &#8230; in the new workflow to getting up a new <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module chart type into the mix of our &#8220;peer to peer&#8221; web application software suite &#8230;<\/p>\n<ol>\n<li>clone <font color=purple>these two<\/font> <a target=\"_blank\" title='crontab information from computerhope ... thanks' href='http:\/\/www.computerhope.com\/jargon\/c\/cron.htm' rel=\"noopener\">crontab<\/a> records &#8230;<br \/>\n<code><br \/>\n<font color=purple>ksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"piechartpython_*.py\"`; do \/usr\/bin\/python3 $i ${i##*\/} \/home\/rjmprogr\/public_html\/Python\/ ; done'<br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"piechartpython_*.py\"`; do rm -f \"$i\"; done'<br \/>\n<\/font><br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"plot_*.png\" -mmin +122`; do rm -f \"$i\"; done'<br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"output_image_*.png\" -mmin +122`; do rm -f \"$i\"; done'<br \/>\n<\/code><br \/>\n &#8230; to <font color=green>new ones<\/font>, for the example of a Column Chart &#8230;<br \/>\n<code><br \/>\n<font color=green>ksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"columnchartpython_*.py\"`; do \/usr\/bin\/python3 $i ${i##*\/} \/home\/rjmprogr\/public_html\/Python\/ ; done'<br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"columnchartpython_*.py\"`; do rm -f \"$i\"; done'<br \/>\n<\/font><br \/>\n<\/code>\n<\/li>\n<li>make the coding changes &#8230; as per &#8230;<br \/>\n<a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py----GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py----GETME\" rel=\"noopener\">pie_chart_python.py<\/a> Python &#8230; brought in a new Bar Chart &#8230;<br \/>\n<a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php-------GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php-------GETME\" rel=\"noopener\">pie_chart_python.php<\/a> PHP &#8230; helped bring in a new Bar Chart<br \/>\n &#8230; but then, thinking on it &#8230; <br \/>\n<a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py-----GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py-----GETME\" rel=\"noopener\">pie_chart_python.py<\/a> Python &#8230; brought in new Column and Bar Charts (in their traditional guises) &#8230;<br \/>\n<a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php--------GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php--------GETME\" rel=\"noopener\">pie_chart_python.php<\/a> PHP &#8230; helped bring in new Column and Bar Charts (in their traditional guises)\n<\/li>\n<li>and then &#8230; yay!!!! &#8230; the time saver &#8230; Linux <a target=\"_blank\" href='http:\/\/en.wikipedia.org\/wiki\/Symbolic_link' title='Symbolic link information from Wikipedia ... thanks' rel=\"noopener\">soft links<\/a> to the rescue <a target=\"_blank\" href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/soft-link\/' rel=\"noopener\">again<\/a> &#8230;<br \/>\n<code><br \/>\ncd \/home\/rjmprogr\/public_html\/Python<br \/>\n<font color=brown>ln -s pie_chart_python.py bar_chart_python.py<br \/>\nln -s pie_chart_python.php bar_chart_python.php<br \/>\nln -s pie_chart_python.py column_chart_python.py<br \/>\nln -s pie_chart_python.php column_chart_python.php<\/font><br \/>\n<\/code><\/p>\n<p> &#8230; to add onto the existant <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module Pie Chart coding, as of yesterday&#8217;s <a title='Python Matplotlib Pie Chart Labels Tutorial' href='#pmpclt'>Python Matplotlib Pie Chart Labels Tutorial<\/a>, interfacing now for <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module Bar Charts and Column Charts, where the logic for the new <i><select onchange=\"if (this.value.trim().length != 0) { window.open('\/\/www.rjmprogramming.com.au\/Python\/' + this.value + '.php?rand=' + Math.floor(Math.random() * 1989786), '_blank', 'top=' + eval(-800 + screen.height) + ',left=' + eval(-800 + screen.width) + ',width=800,height=800');  }\"><option value=\"\">++<\/option><option value=\"bar_chart_python\">Bar Chart<\/option><option value=\"column_chart_python\">Column Chart<\/option><option value=\"pie_chart_python\">Pie Chart<\/option><\/select><\/i> dropdown &#8220;peer to peer&#8221; links all happening via &#8230;<\/p>\n<blockquote><p>\nfile naming conventions\n<\/p><\/blockquote>\n<p> &#8230; getting both Python and PHP to code differentiate chart types via what appears as the action URL\/file name on the address bar\/command line.<\/p>\n<p>Feel free, as such, to try the <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\" rel=\"noopener\">Pie Chart<sup>++<\/sup><\/a> (now public) web application you can also <a href='#myifpcp'>try below<\/a>.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-more-charts-tutorial\/' rel=\"noopener\">Python Matplotlib More Charts Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pmpclt'>Previous relevant <a target=\"_blank\" title='Python Matplotlib Pie Chart Labels Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-pie-chart-labels-tutorial\/' rel=\"noopener\">Python Matplotlib Pie Chart Labels Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Python Matplotlib Pie Chart Labels Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python_labels.jpg\" title=\"Python Matplotlib Pie Chart Labels Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Python Matplotlib Pie Chart Labels Tutorial<\/p><\/div>\n<p>Today, further to yesterday&#8217;s <a title='Python Matplotlib Pie Chart PHP Crontab Tutorial' href='#pmpcphpct'>Python Matplotlib Pie Chart PHP Crontab Tutorial<\/a>&#8216;s <i>Pie Chart via Python Matplotlib<\/i> &#8220;guinea pig&#8221; phase, fleshing out Pie Chart labelling &#8230;<\/p>\n<p> &#8230; begging the question &#8230;<\/p>\n<blockquote><p>\nGuinea pig to what?\n<\/p><\/blockquote>\n<p>Do you cav<strike><sup>y<\/sup><\/strike>e in?!  <font size=1>Chortle, chortle.<\/font>  Well, our answer is &#8230;<\/p>\n<blockquote><p>\nCater for lots of other chart types Python Matplotlib can help interface to.\n<\/p><\/blockquote>\n<p> &#8230; and we have a bit of a strange idea we want to try regarding this, while today&#8217;s second &#8220;not so strange&#8221; task preparatory work was to <a target=\"_blank\" title='Abstraction information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Abstraction_(computer_science)' rel=\"noopener\">&#8220;abstract&#8221;<\/a> the term &#8220;Pie Chart&#8221; and associated phrases out of being hardcodings to be a derivative of what URL is showing in the web browser address bar.  Even if our &#8220;strange idea&#8221; disappoints, and we&#8217;ll let you know tomorrow, we think, we&#8217;d want to embark on this genericization anyway, the Earth being the distance away from Mars and Venus the way it is.  As such &#8230;<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py---GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py---GETME\" rel=\"noopener\">pie_chart_python.py<\/a> Python &#8230; called via HTML form of &#8230;<\/li>\n<li><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php-----GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php-----GETME\" rel=\"noopener\">pie_chart_python.php<\/a> PHP <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\" rel=\"noopener\">Pie Chart<\/a> (now public) web application you can also <a href='#myifpcp'>try below<\/a><\/li>\n<\/ul>\n<p> &#8230; are definitely worth a peruse.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-pie-chart-labels-tutorial\/' rel=\"noopener\">Python Matplotlib Pie Chart Labels Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pmpcphpct'>Previous relevant <a target=\"_blank\" title='Python Matplotlib Pie Chart PHP Crontab Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-pie-chart-php-crontab-tutorial\/' rel=\"noopener\">Python Matplotlib Pie Chart PHP Crontab Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Python Matplotlib Pie Chart PHP Crontab Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python_more.gif\" title=\"Python Matplotlib Pie Chart PHP Crontab Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Python Matplotlib Pie Chart PHP Crontab Tutorial<\/p><\/div>\n<p>Onto yesterday&#8217;s <a title='Python Matplotlib Pie Chart Primer Tutorial' href='#pmpcpt'>Python Matplotlib Pie Chart Primer Tutorial<\/a>&#8216;s work &#8230;<\/p>\n<ul>\n<li>further to local Apache\/PHP web server, like <a target=\"_blank\" title='MAMP' href='http:\/\/www.mamp.info' rel=\"noopener\">MAMP<\/a>, PHP understanding and supervising a Python <a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a> module based Pie Chart web application &#8230; today &#8230;<\/li>\n<li>extending that PHP meets Python theme on the public RJM Programming we involve &#8230;\n<ol>\n<li>updated PHP &#8230; to suit the use of &#8230;<\/li>\n<li><a target=\"_blank\" title='crontab information from computerhope ... thanks' href='http:\/\/www.computerhope.com\/jargon\/c\/cron.htm' rel=\"noopener\">crontab<\/a> &#8230;<br \/>\n<code><br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"piechartpython_*.py\"`; do \/usr\/bin\/python3 $i ${i##*\/} \/home\/rjmprogr\/public_html\/Python\/ ; done'<br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"piechartpython_*.py\"`; do rm -f \"$i\"; done'<br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"plot_*.png\" -mmin +122`; do rm -f \"$i\"; done'<br \/>\nksh -c 'for i in `find \/home\/rjmprogr\/public_html\/Python -name \"output_image_*.png\" -mmin +122`; do rm -f \"$i\"; done'<br \/>\n<\/code><br \/>\n &#8230; means to run Python code where new arguments add image file folder and IP address personalization parts so that users do not stumble on other user Pie Chart specifications\n<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p> &#8230; all still dealing with a minimalist Pie Chart we&#8217;ll add complexity to into the future with &#8230;<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py--GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py--GETME\" rel=\"noopener\">pie_chart_python.py<\/a> Python &#8230; called via HTML form of &#8230;<\/li>\n<li><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php-GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php-GETME\" rel=\"noopener\">pie_chart_python.php<\/a> PHP <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\" rel=\"noopener\">Pie Chart<\/a> (now public) web application you can also <a href='#myifpcp'>try below<\/a><\/li>\n<\/ul>\n<p><iframe style=width:100%;height:1200px; id=myifpcp src=\"\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php\"><\/iframe><\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-pie-chart-php-crontab-tutorial\/' rel=\"noopener\">Python Matplotlib Pie Chart PHP Crontab Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pmpcpt'>Previous relevant <a target=\"_blank\" title='Python Matplotlib Pie Chart Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-pie-chart-primer-tutorial\/' rel=\"noopener\">Python Matplotlib Pie Chart Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.jpg\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Python Matplotlib Pie Chart Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.gif\" title=\"Python Matplotlib Pie Chart Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Python Matplotlib Pie Chart Primer Tutorial<\/p><\/div>\n<p>We&#8217;re off on a new discovery tour regarding &#8230;<\/p>\n<ul>\n<li>Python &#8230; as a programming language, and it&#8217;s module &#8230;<\/li>\n<li><a target=\"_blank\" title='Matplotlib: Visualization with Python' href='https:\/\/matplotlib.org\/' rel=\"noopener\">Matplotlib<\/a><\/li>\n<p> &#8230; starting down this road with a simple &#8230;<\/p>\n<ul>\n<li>command line Pie Chart application &#8230; Python <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py-GETME\" rel=\"noopener\">pie_chart_python.py<\/a> <font size=1>(superceeding <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.py_GETME\" rel=\"noopener\">this<\/a>)<\/font> &#8230;<br \/>\n<code><br \/>\n# pie_chart_python.py<br \/>\n# September - 2026<br \/>\n# RJM Programming<br \/>\n# Thanks to https:\/\/www.w3schools.com\/python\/default.asp<br \/>\n<br \/>\nimport os<br \/>\nimport matplotlib<br \/>\n<br \/>\n# Set backend to Agg before importing pyplot<br \/>\nmatplotlib.use('Agg')<br \/>\n<br \/>\nimport matplotlib.pyplot as plt<br \/>\nimport matplotlib.image as mpimg<br \/>\n<br \/>\nimport numpy as np<br \/>\n#import plotly.express as px<br \/>\nfrom PIL import Image<br \/>\n<br \/>\nnums = []<br \/>\nsofar = 0<br \/>\n<br \/>\nif len(nums) &lt;= 0:<br \/>\n  while sofar &lt; 100:<br \/>\n     print(f\"Enter your percentage value regarding a pie chart where so far {sofar} has already been allocated.\")<br \/>\n     anum = input()<br \/>\n     nums.append(int(anum))<br \/>\n     sofar += int(anum)<br \/>\n<br \/>\ny = np.array(nums)<br \/>\n<br \/>\nfig, ax = plt.subplots()<br \/>\n<br \/>\nax.pie(y)<br \/>\n<br \/>\nfig.savefig(\"plot.png\")<br \/>\n<br \/>\n# 1. Load the image<br \/>\nimg = mpimg.imread('plot.png')<br \/>\n<br \/>\n# 2. Process or manipulate the image (Optional)<br \/>\n# For example, let's look at the shape or apply changes<br \/>\n#print(f\"Image shape: {img.shape}\")<br \/>\n<br \/>\n# 3. Create the plot without displaying it<br \/>\nplt.imshow(img)<br \/>\nplt.axis('off')  # Hide axis lines and labels<br \/>\n<br \/>\n# 4. Save the result to a file instead of showing it<br \/>\nplt.savefig('output_image.png', bbox_inches='tight', pad_inches=0)<br \/>\nplt.close()<br \/>\n<br \/>\n# Open the PNG image file<br \/>\n#with Image.open(\"plot.png\") as img:<br \/>\n    # Display the image using your system's default viewer<br \/>\n    #img.show()<br \/>\n    <br \/>\n    # Optional: Load the data into memory so you can safely close the file<br \/>\n    #img.load()<br \/>\n<br \/>\nexit()<br \/>\n<\/code><br \/>\n &#8230; and &#8230;\n<\/li>\n<li>working on our local Apache\/PHP <a target=\"_blank\" title='MAMP' href='http:\/\/www.mamp.info' rel=\"noopener\">MAMP<\/a> web server (only, so far, the reason being our public web server has no graphical $DISPLAY existant, and so the <i>plt.show()<\/i> Python codeline cannot be used, so we need to think more on integrations there) &#8230; PHP <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.php_GETME\" rel=\"noopener\">pie_chart_python.php<\/a> &#8230;<br \/>\n<code><br \/>\n&lt;?php<br \/>\n\/\/ pie_chart_python.php<br \/>\n\/\/ RJM Programming - September, 2026<br \/>\nif (php_sapi_name() === 'cli') {<br \/>\n$command = '\/usr\/local\/bin\/python3 ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'piechartpython.py'; \/\/ Your command<br \/>\nif (1 == 1) {<br \/>\nexec($command);<br \/>\n} else {<br \/>\n\/\/ Open the process pointer for reading<br \/>\n$handle = popen($command, 'r');<br \/>\n<br \/>\nif ($handle) {<br \/>\n    \/\/ Read and output the buffer until the end of the file<br \/>\n    while (!feof($handle)) {<br \/>\n        echo fread($handle, 2048);<br \/>\n        flush(); \/\/ Send it to the browser immediately<br \/>\n    }<br \/>\n    pclose($handle);<br \/>\n}<br \/>\n}<br \/>\nexit;<br \/>\n} else if (strpos(str_replace('?','',$_SERVER['QUERY_STRING']), '&') === false) {<br \/>\n$waspy=file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pie_chart_python.py');<br \/>\nif (strpos($waspy, \"nums = []\") !== false) {<br \/>\n    if (isset($_GET['array'])) {<br \/>\n      file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'piechartpython.py', str_replace(\"nums = []\",\"nums = [\" . str_replace('+',' ',urldecode($_GET['array'])) . \"]\",$waspy));<br \/>\n    }<br \/>\n}<br \/>\n\/\/exec('php ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pie_chart_python.php &gt; \/dev\/null 2&gt; \/dev\/null');<br \/>\nexec('cd ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ; \/Applications\/MAMP\/bin\/php\/php7.4.33\/bin\/php -n .\/pie_chart_python.php &gt; \/dev\/null 2&gt; \/dev\/null ; open .\/plot.png');<br \/>\nsleep(3);<br \/>\n}<br \/>\necho \"&lt;html&gt;&lt;body style=\\\"background:url(.\/plot.png);background-repeat:no-repeat;background-size:contain;\\\"&gt;&lt;\/body&gt;&lt;\/html&gt;\";<br \/>\n?&gt;<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p> &#8230; allowing a web browser address bar URL such as &#8230;<\/p>\n<p><code><br \/>\nht<font color=black>tp<\/font>:\/\/localhost:8888\/pie_chart_python.php?array=12,5,1,68<br \/>\n<\/code><\/p>\n<p> &#8230; working for us, here, locally, displaying a Pie Chart &#8230;<\/p>\n<p><img decoding=\"async\" src=\"\/\/www.rjmprogramming.com.au\/Python\/pie_chart_python.jpg\"><\/img><\/p>\n<p> &#8230; via our local Python<sup>3<\/sup> Matplotlib modularized environment.<\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<p>Your installer for Python modules is likely to be one of, for the example of <i>matplotlib<\/i> module &#8230;<\/p>\n<p><code><br \/>\npip install matplotlib<br \/>\n<\/code><\/p>\n<p> &#8230; or &#8230;<\/p>\n<p><code><br \/>\npip3 install matplotlib<br \/>\n<\/code><\/p>\n<p> &#8230; corresponding to whether command line &#8230;<\/p>\n<p><code><br \/>\npython pie_chart_python.py<br \/>\n<\/code><\/p>\n<p> &#8230; or &#8230;<\/p>\n<p><code><br \/>\npython3 pie_chart_python.py<br \/>\n<\/code><\/p>\n<p> &#8230; works for you at your local system command line.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d74751' onclick='var dv=document.getElementById(\"d74751\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/python\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d74751' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d74762' onclick='var dv=document.getElementById(\"d74762\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/crontab\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d74762' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d74773' onclick='var dv=document.getElementById(\"d74773\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/label\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d74773' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d74778' onclick='var dv=document.getElementById(\"d74778\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/dropdown\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d74778' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We doubt you&#8217;ll meet many programmers not interested in &#8220;peer to peer&#8221; software suite arrangements. Thinking about Python Matplotlib module, of course, &#8220;peer to peer&#8221; becomes interesting in that the difference between the presentation of various chart types amounts to &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/python-matplotlib-more-charts-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,29,37],"tags":[2458,1669,1885,1835,4115,199,5659,218,4600,5662,234,274,327,367,5660,2671,3336,450,452,2537,1839,1615,541,611,629,677,678,707,5657,802,885,2181,3440,914,919,932,944,2550,2643,997,1012,5658,1165,5661,2056,1232,1675,2167,1319,1411],"class_list":["post-74778","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-abstraction","tag-address-bar","tag-argument","tag-arguments","tag-basename","tag-chart","tag-chart-type","tag-code","tag-code-file","tag-code-file-name","tag-command-line","tag-crontab","tag-did-you-know","tag-dropdown","tag-file-naming-convention","tag-file-specification","tag-filename","tag-folder","tag-form","tag-generic","tag-genericization","tag-glob","tag-graphics","tag-install","tag-ip-address","tag-korn-shell","tag-label","tag-linux","tag-matplotlib","tag-module","tag-operating-system-2","tag-package-manager","tag-peer","tag-peer-to-peer","tag-personalization","tag-php","tag-pie-chart","tag-pip","tag-placeholder","tag-programming","tag-python","tag-python3","tag-soft-link","tag-software-suite","tag-suite","tag-symbolic-link","tag-textbox","tag-title","tag-tutorial","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/74778"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=74778"}],"version-history":[{"count":11,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/74778\/revisions"}],"predecessor-version":[{"id":74791,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/74778\/revisions\/74791"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=74778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=74778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=74778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}