{"id":1943,"date":"2023-08-13T02:38:50","date_gmt":"2023-08-13T09:38:50","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1943"},"modified":"2023-08-13T02:38:50","modified_gmt":"2023-08-13T09:38:50","slug":"385-scatterplot-matrix-using-seaborn-library","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/385-scatterplot-matrix-using-seaborn-library\/","title":{"rendered":"#385 Scatterplot matrix using seaborn library"},"content":{"rendered":"<p><a href=\"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/385-scatterplot-matrix-using-seaborn-library\/ex385\/\" rel=\"attachment wp-att-1944\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex385.png?resize=1080%2C964&#038;ssl=1\" alt=\"\" width=\"1080\" height=\"964\" class=\"alignnone size-full wp-image-1944\" srcset=\"https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex385.png 1120w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex385-980x875.png 980w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex385-480x429.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1120px, 100vw\" \/><\/a><\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#Scatterplot matrix using seaborn library\r\nimport matplotlib.pyplot as plt\r\n#conda install -c anaconda seaborn\r\nimport seaborn as sns\r\nsns.set_theme(style=&quot;ticks&quot;)\r\n\r\ndef main():\r\n    df = sns.load_dataset(&quot;penguins&quot;)\r\n    sns.pairplot(df, hue=&quot;species&quot;)\r\n    plt.savefig(&quot;ex385.png&quot;, dpi=100)\r\n    plt.show()\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#Scatterplot matrix using seaborn library import matplotlib.pyplot as plt #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=&quot;ticks&quot;) def main(): df = sns.load_dataset(&quot;penguins&quot;) sns.pairplot(df, hue=&quot;species&quot;) plt.savefig(&quot;ex385.png&quot;, dpi=100) plt.show() if __name__ == &#8216;__main__&#8217;: main()<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[91,2,92],"tags":[],"class_list":["post-1943","post","type-post","status-publish","format-standard","hentry","category-plot","category-python","category-seaborn"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-vl","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1921,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/376-scatterplot-with-continuous-hues-and-sizes-using-seaborn-library\/","url_meta":{"origin":1943,"position":0},"title":"#376 Scatterplot with continuous hues and sizes using seaborn library","author":"gantovnik","date":"2023-08-10","format":false,"excerpt":"[code language=\"python\"] #Scatterplot with continuous hues and sizes import matplotlib.pyplot as plt #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"whitegrid\") def main(): # Load the example planets dataset planets = sns.load_dataset(\"planets\") cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True) g = sns.relplot( data=planets, x=\"distance\", y=\"orbital_period\", hue=\"year\", size=\"mass\", palette=cmap, sizes=(10, 200), ) g.set(xscale=\"log\",\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex376.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex376.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex376.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1915,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/373-scatterplot-with-multiple-semantics-using-seaborn-library\/","url_meta":{"origin":1943,"position":1},"title":"#373 Scatterplot with multiple semantics using seaborn library","author":"gantovnik","date":"2023-08-09","format":false,"excerpt":"[code language=\"python\"] import numpy as np import matplotlib.pyplot as plt import os from scipy.special import fresnel #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"whitegrid\") def main(): # Load the example diamonds dataset diamonds = sns.load_dataset(\"diamonds\") # Draw a scatter plot while assigning point colors and sizes to different\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex373.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex373.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex373.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex373.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex373.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":1933,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/381-overlapping-densities-ridge-plot-using-seaborn-library\/","url_meta":{"origin":1943,"position":2},"title":"#381 Overlapping densities ridge plot using seaborn library","author":"gantovnik","date":"2023-08-10","format":false,"excerpt":"[code language=\"python\"] #Overlapping densities ridge plot using seaborn library import matplotlib.pyplot as plt import pandas as pd import numpy as np #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"white\", rc={\"axes.facecolor\": (0, 0, 0, 0)}) def main(): # Create the data rs = np.random.RandomState(1979) x = rs.randn(500) g =\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex381.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1028,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/183-creating-a-histogram-using-seaborn\/","url_meta":{"origin":1943,"position":3},"title":"#184 Creating a histogram using seaborn","author":"gantovnik","date":"2021-11-07","format":false,"excerpt":"[code language=\"python\"] import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os os.chdir(r'D:\\projects\\wordpress\\ex183') os.getcwd() url = \"https:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/auto-mpg\/auto-mpg.data\" df = pd.read_csv(url) column_names = ['mpg', 'cylinders', 'displacement', 'horsepower', 'weight', 'acceleration', 'year', 'origin', 'name'] df = pd.read_csv(url, names= column_names, delim_whitespace=True) print(df.head()) #Convert the horsepower and\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex183.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex183.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex183.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex183.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex183.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex183.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1032,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/184-creating-a-boxplot-using-seaborn\/","url_meta":{"origin":1943,"position":4},"title":"#183 Creating a boxplot using seaborn","author":"gantovnik","date":"2021-11-07","format":false,"excerpt":"[code language=\"python\"] import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os os.chdir(r'D:\\projects\\wordpress\\ex184') os.getcwd() url = \"https:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/auto-mpg\/auto-mpg.data\" df = pd.read_csv(url) column_names = ['mpg', 'cylinders', 'displacement', 'horsepower', 'weight', 'acceleration', 'year', 'origin', 'name'] df = pd.read_csv(url, names= column_names, delim_whitespace=True) print(df.head()) #Convert the horsepower and\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex184.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex184.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex184.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex184.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex184.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex184.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":1037,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/185-creating-a-scatter-plot-using-seaborn\/","url_meta":{"origin":1943,"position":5},"title":"#185 Creating a scatter plot using seaborn","author":"gantovnik","date":"2021-11-07","format":false,"excerpt":"[code language=\"python\"] import matplotlib.pyplot as plt import numpy as np import pandas as pd import os import seaborn as sns os.chdir(r'D:\\projects\\wordpress\\ex185') os.getcwd() url = \"https:\/\/archive.ics.uci.edu\/ml\/machine-learning-databases\/auto-mpg\/auto-mpg.data\" df = pd.read_csv(url) column_names = ['mpg', 'cylinders', 'displacement', 'horsepower', 'weight', 'acceleration', 'year', 'origin', 'name'] df = pd.read_csv(url, names= column_names, delim_whitespace=True) df.loc[df.horsepower == '?', 'horsepower'] =\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex185b.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex185b.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex185b.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex185b.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex185b.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex185b.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1943"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1943\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}