{"id":76580,"date":"2025-01-12T21:50:54","date_gmt":"2025-01-12T21:50:54","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=76580"},"modified":"2025-06-25T02:24:50","modified_gmt":"2025-06-25T02:24:50","slug":"3d-scatter-plot-in-python","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76580","title":{"rendered":"3D Scatter Plot in Python"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Visualizing 3-D numeric data with Scatter Plots<\/h1>\n\n\n\n<h1 class=\"wp-block-heading\">length, breadth and depth<\/h1>\n\n\n\n<p><\/p>\n\n\n\n<p>Ref: https:\/\/towardsdatascience.com\/the-art-of-effective-visualization-of-multi-dimensional-data-6c7202990c57 <\/p>\n\n\n\n<p>import pandas as pd<br>import matplotlib.pyplot as plt<br>from mpl_toolkits.mplot3d import Axes3D<br>import matplotlib as mpl<br>import numpy as np<br>import seaborn as sns<br>%matplotlib inline<\/p>\n\n\n\n<p>fig = plt.figure(figsize=(8, 6))<br><strong><em>ax = fig.add_subplot(111, projection=&#8217;3d&#8217;)<\/em><\/strong><\/p>\n\n\n\n<p>xs = wines[&#8216;residual sugar&#8217;]<br>ys = wines[&#8216;fixed acidity&#8217;]<br>zs = wines[&#8216;alcohol&#8217;]<br>ax.scatter(xs, ys, zs, s=50, alpha=0.6, edgecolors=&#8217;w&#8217;)<\/p>\n\n\n\n<p>ax.set_xlabel(&#8216;Residual Sugar&#8217;)<br>ax.set_ylabel(&#8216;Fixed Acidity&#8217;)<br>ax.set_zlabel(&#8216;Alcohol&#8217;)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"772\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-11.png?resize=696%2C772\" alt=\"\" class=\"wp-image-76581\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-11.png?w=696 696w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-11.png?resize=270%2C300 270w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/figure>\n\n\n\n<p><strong>Other Visualizations of Wine Data<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Univariate Analysis<\/p>\n\n\n\n<p>tight_layout, 15 bins<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"555\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-12.png?resize=750%2C555\" alt=\"\" class=\"wp-image-76582\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-12.png?w=764 764w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-12.png?resize=300%2C222 300w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-12.png?resize=750%2C555 750w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><strong>Correlation Maps<\/strong>: Multivariate Analysis<\/p>\n\n\n\n<p>Seaborn &#8211; Heatmaps<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"577\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-13.png?resize=750%2C577\" alt=\"\" class=\"wp-image-76583\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-13.png?w=886 886w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-13.png?resize=300%2C231 300w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-13.png?resize=768%2C591 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-13.png?resize=750%2C577 750w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"418\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-14.png?resize=750%2C418\" alt=\"\" class=\"wp-image-76584\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-14.png?resize=1024%2C571 1024w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-14.png?resize=300%2C167 300w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-14.png?resize=768%2C428 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-14.png?resize=750%2C418 750w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-14.png?w=1276 1276w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><strong>plot parallel coordinates<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"413\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-15.png?resize=602%2C413\" alt=\"\" class=\"wp-image-76585\" style=\"width:795px;height:auto\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-15.png?w=602 602w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-15.png?resize=300%2C206 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>BOX Plot<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"310\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-16.png?resize=750%2C310\" alt=\"\" class=\"wp-image-76586\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-16.png?w=998 998w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-16.png?resize=300%2C124 300w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-16.png?resize=768%2C317 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-16.png?resize=750%2C310 750w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p>Violin plot: sns.violinplot(x=&#8221;quality&#8221;, y=&#8221;sulphates&#8221;, data=wines, ax=ax) : Seaborn<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"306\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-17.png?resize=750%2C306\" alt=\"\" class=\"wp-image-76587\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-17.png?w=1011 1011w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-17.png?resize=300%2C122 300w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-17.png?resize=768%2C313 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-17.png?resize=750%2C306 750w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><strong>3d Pairwise Scatter Plot<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"387\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-18.png?resize=750%2C387\" alt=\"\" class=\"wp-image-76588\" srcset=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-18.png?resize=1024%2C529 1024w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-18.png?resize=300%2C155 300w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-18.png?resize=768%2C397 768w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-18.png?resize=750%2C388 750w, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/01\/image-18.png?w=1376 1376w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Images are taken from my own executions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visualizing 3-D numeric data with Scatter Plots length, breadth and depth Ref: https:\/\/towardsdatascience.com\/the-art-of-effective-visualization-of-multi-dimensional-data-6c7202990c57 import pandas as pdimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport matplotlib as mplimport numpy as npimport seaborn as sns%matplotlib inline fig = plt.figure(figsize=(8, 6))ax = fig.add_subplot(111, projection=&#8217;3d&#8217;) xs = wines[&#8216;residual sugar&#8217;]ys = wines[&#8216;fixed acidity&#8217;]zs = wines[&#8216;alcohol&#8217;]ax.scatter(xs, ys, zs, s=50, alpha=0.6, edgecolors=&#8217;w&#8217;) ax.set_xlabel(&#8216;Residual &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=76580\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1903,1],"tags":[],"class_list":["post-76580","post","type-post","status-publish","format-standard","hentry","category-data-visualization","category-root","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76606,"url":"http:\/\/bangla.sitestree.com\/?p=76606","url_meta":{"origin":76580,"position":0},"title":"Python: MatPlotLib: Plot Data","author":"Sayed","date":"February 6, 2025","format":false,"excerpt":"import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D columns = [\"J_ID\", \"P_ID\", \"D_ID\", \"Year\", \"JOB_TITLE\", \"Department_Name\", \"Total Salary\", \"Commission\"] df = pd.read_csv(\"datamart.csv\", usecols=columns) # Create a 3D plot fig = plt.figure(figsize=(20, 15)) ax = fig.add_subplot(111, projection='3d') # Scatter plot ax.scatter(df['Year'], df['J_ID'], df['D_ID'], c=df['Total Salary'], cmap='viridis', marker='X')\u2026","rel":"","context":"In &quot;Root&quot;","block_context":{"text":"Root","link":"http:\/\/bangla.sitestree.com\/?cat=1"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/02\/image-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":16051,"url":"http:\/\/bangla.sitestree.com\/?p=16051","url_meta":{"origin":76580,"position":1},"title":"Data Visualization in Python (R)","author":"Sayed","date":"September 4, 2019","format":false,"excerpt":"Python Treemaps with Squarify & Matplotlib https:\/\/fcpython.com\/visualisation\/python-treemaps-squarify-matplotlib --- Treemaps With Squarify https:\/\/galaxydatatech.com\/2018\/03\/20\/treemaps-with-squarify\/ --- 200 Basic Treemap with python https:\/\/python-graph-gallery.com\/200-basic-treemap-with-python\/ --- Dendrograms in Python https:\/\/plot.ly\/python\/dendrogram\/ https:\/\/python-graph-gallery.com\/dendrogram\/ --- HIERARCHICAL CLUSTERING IN R: THE ESSENTIALS https:\/\/www.datanovia.com\/en\/lessons\/examples-of-dendrograms-visualization\/ --- Geographic Data with Basemap https:\/\/jakevdp.github.io\/PythonDataScienceHandbook\/04.13-geographic-data-with-basemap.html --- Plotting data on a map (Example Gallery)\u00b6 https:\/\/matplotlib.org\/basemap\/users\/examples.html --- A\u2026","rel":"","context":"In &quot;AI ML DS RL DL NN NLP Data Mining Optimization&quot;","block_context":{"text":"AI ML DS RL DL NN NLP Data Mining Optimization","link":"http:\/\/bangla.sitestree.com\/?cat=1910"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16059,"url":"http:\/\/bangla.sitestree.com\/?p=16059","url_meta":{"origin":76580,"position":2},"title":"Data Visualization Misc","author":"Sayed","date":"September 5, 2019","format":false,"excerpt":"Data Visualization Overview: ---------------------------- Data Visualization: About Data Visualization http:\/\/guides.library.duke.edu\/c.php?g=289678&p=1930713 I Can See Clearly Now: A Survey of Data Visualization Techniques & Practice https:\/\/www.slideshare.net\/myles_harrison\/i-can-see-clearly-now-a-survey-of-data-visualization-techniques-practice-31179055 Visualization in Data Science: What is it for? http:\/\/guides.library.duke.edu\/c.php?g=289678&p=1930713 Anscombe's quartet https:\/\/en.wikipedia.org\/wiki\/Anscombe's_quartet Storytelling and data visualization\u2026\u00a0So what? https:\/\/www.dapresy.com\/storytelling-and-data-visualization\/ Visualization Types https:\/\/guides.library.duke.edu\/datavis\/vis_types Junk Charts https:\/\/junkcharts.typepad.com\/junk_charts\/2012\/10\/expanding-circles-of-error.html Visualization Analysis\u2026","rel":"","context":"In &quot;AI ML DS RL DL NN NLP Data Mining Optimization&quot;","block_context":{"text":"AI ML DS RL DL NN NLP Data Mining Optimization","link":"http:\/\/bangla.sitestree.com\/?cat=1910"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":19920,"url":"http:\/\/bangla.sitestree.com\/?p=19920","url_meta":{"origin":76580,"position":3},"title":"health_status_visualizations, Health System Performance, Canada and Others","author":"Sayed","date":"February 7, 2021","format":false,"excerpt":"Justetc Social Services (non-profit)Jan 31\u00a0\u00b7\u00a04\u00a0min read import pandas as pdimport matplotlib.pyplot as plt%matplotlib inlinefrom __future__ import print_functionfrom ipywidgets import interact, interactive, fixed, interact_manualimport ipywidgets as widgetshealth_status = pd.read_excel('..\/data\/health-status.xls')health_status.head() health_status.set_index(['Indicator'])#health_status.loc[health_status['Cancer Mortality (F)']]#health_status.index.unique()indicators = pd.Index(health_status['Indicator']).unique()years = health_status['Data year'].unique()indicators[0], years[0]('Cancer Mortality (F)', '2013')cancer_mortality_2013 = health_status.loc[ (health_status['Indicator'] == indicators[0]) & (health_status['Data year'] == years[0])\u2026","rel":"","context":"In &quot;Data Visualization&quot;","block_context":{"text":"Data Visualization","link":"http:\/\/bangla.sitestree.com\/?cat=1903"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76075,"url":"http:\/\/bangla.sitestree.com\/?p=76075","url_meta":{"origin":76580,"position":4},"title":"K-Means Clustering","author":"Sayed","date":"May 18, 2024","format":false,"excerpt":"Click on the images to see them clearly #!\/usr\/bin\/env python coding: utf-8 In[1]: k-means clustering from numpy import unique from numpy import where from sklearn.datasets import make_classification from sklearn.cluster import KMeans from matplotlib import pyplot import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=525%2C300 1.5x"},"classes":[]},{"id":19914,"url":"http:\/\/bangla.sitestree.com\/?p=19914","url_meta":{"origin":76580,"position":5},"title":"IPywidgets, interactive","author":"Sayed","date":"February 7, 2021","format":false,"excerpt":"Justetc Social Services (non-profit)\u00b7Jan 31 from __future__ import print_functionfrom ipywidgets import interact, interactive, fixed, interact_manualimport ipywidgets as widgetsdef f(x): return xinteract(f, x=10);interactive(children=(IntSlider(value=10, description='x', max=30, min=-10), Output()), _dom_classes=('widget-\u2026interact(f, x=True);interactive(children=(Checkbox(value=True, description='x'), Output()), _dom_classes=('widget-interact',))interact(f, x='Hi there!');interactive(children=(Text(value='Hi there!', description='x'), Output()), _dom_classes=('widget-interact',))@interact(x=True, y=1.0)def g(x, y): return (x, y)interactive(children=(Checkbox(value=True, description='x'), FloatSlider(value=1.0, description='y', max=3.0, \u2026interact(f, x=['apples','oranges']);interactive(children=(Dropdown(description='x', options=('apples',\u2026","rel":"","context":"In &quot;Data Visualization&quot;","block_context":{"text":"Data Visualization","link":"http:\/\/bangla.sitestree.com\/?cat=1903"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76580"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76580\/revisions"}],"predecessor-version":[{"id":76589,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76580\/revisions\/76589"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76580"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}