{"id":675,"date":"2021-03-29T08:27:51","date_gmt":"2021-03-29T08:27:51","guid":{"rendered":"https:\/\/fcpython.com\/?p=675"},"modified":"2021-03-31T10:21:34","modified_gmt":"2021-03-31T10:21:34","slug":"creating-multiple-visualisations-in-python-with-subplots","status":"publish","type":"post","link":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots","title":{"rendered":"Creating multiple visualisations in Python with subplots"},"content":{"rendered":"\n<p>More often than not, a chart isn\u2019t enough by itself. You need context, annotations, aggregations and explanations to make sure that your conclusion is heard.<\/p>\n<p>Subplots, or multiple charts on the same plot, can go a long way to add your aggregations and explanations visually, doing lots of the heavy lifting to clarify the point you are getting across.<\/p>\n<p>Want to show a player\u2019s busiest third of the pitch? Aggregate touches in a chart alongside the pitch.<\/p>\n<p>Want to compare every team\u2019s xG per game? Plot every team in a grid of charts.<\/p>\n<p>In this tutorial, we will take a look at how we can create subplots manually, programatically and give some examples of their applications. First up, let\u2019s load in our modules, with a very grateful nod to <a href=\"https:\/\/twitter.com\/numberstorm\">@numberstorm\u2019s<\/a> mplsoccer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">import matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport random\nfrom mplsoccer.pitch import Pitch<\/code><\/pre>\n\n\n\n<h3>Manually adding plots together<\/h3>\n\n\n\n<p>The easiest way to create multiple plots is to manually add them to a figure. We create a blank figure, then use the .add_axes() argument to add a new chart &#8211; passing the dimensions (left, bottom, width, height) in the arguments.<\/p>\n<p>The .add_axes() call is assigned to a variable, with which we can then create our charts or add text:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">fig = plt.figure()\nax1 = fig.add_axes([0.1, 0.5, 1, 0.4],\n                    xticklabels=[], ylim=(0, 100))\nax2 = fig.add_axes([0.1, 0.1, 1, 0.4],\n                    ylim=(0, 100))\nax1.text(0.5,50,\"Top Plot!\")\nax2.text(0.5,50,\"Bottom Plot!\")\nplt.show()<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-medium\"><img decoding=\"async\" loading=\"lazy\" width=\"300\" height=\"165\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-300x165.png\" alt=\"Basic subplot of two charts.\" class=\"wp-image-676\" srcset=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-300x165.png 300w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-768x422.png 768w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-370x203.png 370w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-760x417.png 760w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34.png 998w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<p>Instead of text, why don\u2019t you give it a try with a scatter or histogram?<\/p>\n<p>This is great and super customisable, but you need a loop or some very manual work to add lots of them in a tidy and orderly fashion. Surely there is a better way\u2026<\/p>\n<h3>Creating a grid and navigating it<\/h3>\n<p>This time, we will make use of the .subplots() function to create neat rows and columns of plots. .subplots() takes a few arguments; you have to tell it the number of rows and columns, but you can also use the sharex &amp; sharey arguments to make sure that the whole grid uses the same axes scale. You\u2019ll see that this gets rid of axes labels on the inside of the grid and looks loads better. The underlying theory point of \u2018less is more\u2019 helps us a lot here!<\/p>\n<p>Let\u2019s plot a 2 row, 3 column plot\u2026 in just 1 line!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">fig, ax = plt.subplots(2, 3, sharex='col', sharey='row', figsize = (6,3), dpi = 140)<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-medium\"><img decoding=\"async\" loading=\"lazy\" width=\"300\" height=\"149\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-300x149.png\" alt=\"6 chart subplot - all charts are blank\" class=\"wp-image-677\" srcset=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-300x149.png 300w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-1024x509.png 1024w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-768x382.png 768w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-1536x764.png 1536w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-370x184.png 370w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44-760x378.png 760w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.44.png 1556w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<p>Each of the 6 plots can easily be called for with square brackets and coordinates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">fig, ax = plt.subplots(2, 3, sharex='col', sharey='row', figsize = (6,3), dpi = 140)\nax[0, 0].text(0.5, 0.5, \"I am plot 0,0\u2026\", ha='center'),\nax[0, 1].text(0.5, 0.5, \"\u2026I am plot 0,1\u2026\", ha='center'),\nax[1, 2].text(0.5, 0.5, \"\u2026and I am plot 1,2\", ha='center'),\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-medium is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-300x149.png\" alt=\"subplot with text - 6 charts, some containing text to show coordinates\" class=\"wp-image-678\" width=\"355\" height=\"176\" srcset=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-300x149.png 300w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-1024x509.png 1024w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-768x382.png 768w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-1536x764.png 1536w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-370x184.png 370w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51-760x378.png 760w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.51.png 1556w\" sizes=\"(max-width: 355px) 100vw, 355px\" \/><\/figure>\n\n\n\n<p>Or if you just want to use one row:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">#Create random data in a dataframe with two columns - X\/Y\ndf = pd.DataFrame(np.random.randint(0,100,size=(200, 2)), columns=['X', 'Y'])\nfig, ax = plt.subplots(1, 2, sharex='col', sharey='row')\nax[0].plot(df['X'], df['Y'], 'o')\nax[1].hist(df['Y'], orientation='horizontal')<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.00.png\" alt=\"Two charts, scatter to the left, histogram to the right\" class=\"wp-image-679\" width=\"290\" height=\"193\"\/><\/figure>\n\n\n\n<p>Let\u2019s level this up with a for loop, and split out a bigger dataset for each plot, based on a variable.<\/p>\n<p>Our dataset has six teams, and their xG values (random numbers). We create our figure and blank subplots as before, but this time we use enumerate and reshape to loop through the axes and plot a team in each. Let&#8217;s take a quick look at these two functions as they may be new to you.<\/p>\n<p>enumerate: just like a for loop, but it gives us access to the number of the specific for loop. This is useful is we want to use it to select an item from another list that is not being used for the loop. In this example, we loop through the charts but want access to the teams and colours &#8211; enumerate lets us do this.<\/p>\n<p>reshape: Our axes are a 2&#215;3 grid of charts. Reshape allows us to mould that 2&#215;3 grid into a 1&#215;6 list with which we can reference each chart simply.<\/p>\n<p>With those in mind, you should be able to work through this code and see how we end up with the chart below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">#Create our colour list for the chart\ncolors = ['red', 'skyblue', 'navy', 'pink', 'green', 'black']\n\n#Create our dataframe\nteams = ['United', 'City', 'Albion', 'Athletic', 'FC', 'County']\nxGFor = np.random.rand(200)*3\nteamsArray = np.random.choice(teams, 200)\ndf = pd.DataFrame({'Team':teamsArray,'xGFor':xGFor, 'xGAgainst':xGAgainst})\n\n#Blank subplots\nfig, ax = plt.subplots(2, 3, sharex='col', sharey='row', figsize = (6,3), dpi = 140)\n\n#Loop through each chart in the subplot\nfor count, item in enumerate(ax.reshape(-1)):\n\n     #Histogram for each team\n     item.hist(df[df['Team']==teams[count]]['xGFor'],10, color = colors[count],range=[0, 3])\n\n     #Add team name\n     item.text(0.1,0.8,teams[count],transform=item.transAxes)\n\n     #Adjust axes limits\n     item.set_ylim([0,10])\n     item.set_xlim([0,3])\n\n     Figure axes titles\n     fig.text(0.5, -0.02, 'xGFor', ha='center', va='center')\n     fig.text(0.06, 0.5, 'Frequency', ha='center', va='center', rotation='vertical')\n\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"553\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-1024x553.png\" alt=\"Charts of 6 fictional teams xG scores\" class=\"wp-image-680\" srcset=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-1024x553.png 1024w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-300x162.png 300w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-768x415.png 768w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-1536x830.png 1536w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-370x200.png 370w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09-760x410.png 760w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.09.png 1570w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>These plots can be really useful for exploratory analysis and communication. If you plan on using them often, check out <a href=\"https:\/\/seaborn.pydata.org\/generated\/seaborn.FacetGrid.html\">Seaborn\u2019s facet grid<\/a>&nbsp;that makes them really easy to plot.<\/p>\n<p>What if we want to up our customisation and create uneven layouts?<\/p>\n<h3>Creating an uneven grid<\/h3>\n<p>So far, we have just created plots and figures where we use them entirely for our visualisations. This time, we will create grids and use parts of them selectively to build plots of different sizes.<\/p>\n<p>To do this, we can place a plt.GridSpec() on our plot. We pass a grid size to the argument, and can also set margins between the cells.<\/p>\n<p>Within the grid, we then place plots on the coordinates where we want to. Do this with fig.add_subplots(), passing it the coordinates with grid[x,y].<\/p>\n<p>Let\u2019s create some random x\/y data and create a scatterplot and histograms to summarise it. Notice the sharex and sharey arguments that align the data in the pitch and charts.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">df = pd.DataFrame(np.random.randint(0,100,size=(200, 2)), columns=['X', 'Y'])\nfig = plt.figure(figsize=(5,5), dpi = 140)\ngrid = plt.GridSpec(6, 6)\n\na1 = fig.add_subplot(grid[0:5, 0:5])\na2 = fig.add_subplot(grid[5, 1:4],sharex=a1)\na3 = fig.add_subplot(grid[0:5, 5],sharey=a1)\n\npitch = Pitch(pitch_type='opta', orientation='vertical', stripe=False)\npitch.draw(ax=a1)\npitch.scatter(df['X'], df['Y'],\n                    s=10, c='black', label='scatter', ax=a1)\n\na2.hist(df['Y'], 3, color = 'black', histtype='stepfilled')\na3.hist(df['X'], 9, orientation='horizontal', color='black', histtype='stepfilled')\n\nplt.show()<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24.png\" alt=\"Scatter plot on football pitch, histograms to summarise distributions\" class=\"wp-image-681\" width=\"384\" height=\"418\" srcset=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24.png 1064w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24-275x300.png 275w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24-939x1024.png 939w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24-768x837.png 768w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24-370x403.png 370w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.24-760x829.png 760w\" sizes=\"(max-width: 384px) 100vw, 384px\" \/><\/figure>\n\n\n\n<p>Now let\u2019s level this up with some styling, removing axes, and more:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">df = pd.DataFrame(np.random.randint(0,100,size=(200, 2)), columns=['X', 'Y'])\nfig = plt.figure(figsize=(5,5), dpi = 140)\ngrid = plt.GridSpec(6, 6, wspace=-0.45, hspace=0.2)\n\na1 = fig.add_subplot(grid[0:5, 0:5])\na2 = fig.add_subplot(grid[5, 1:4],sharex=a1)\na3 = fig.add_subplot(grid[0:5, 5],sharey=a1)\n\npitch = Pitch(pitch_type='opta', orientation='vertical', pitch_color='#f7fafa', line_color='pink', stripe=False)\npitch.draw(ax=a1)\npitch.scatter(df['X'], df['Y'],\n                    s=10, c='#06c7c4', label='scatter', ax=a1)\n\na2.hist(df['Y'], 3, color = 'pink', edgecolor=\"#fc8197\", histtype='stepfilled')\na2.axis('off')\n\na3.hist(df['X'], 9, orientation='horizontal', color='pink', edgecolor=\"#fc8197\", histtype='stepfilled')\na3.axis('off')\n\nplt.text(-64.8,110,'Player X - Touches', size=14)\nfig.set_facecolor('#ffffff')\n\nplt.show()<\/code><\/pre>\n\n\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43.png\" alt=\"Styled football pitch subplot and summary histograms\" class=\"wp-image-682\" width=\"346\" height=\"387\" srcset=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43.png 1088w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43-268x300.png 268w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43-913x1024.png 913w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43-768x861.png 768w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43-370x415.png 370w, https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.04.43-760x852.png 760w\" sizes=\"(max-width: 346px) 100vw, 346px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/twitter.com\/danzn1\">@danzn1<\/a> got in touch with a great alternative to subplot that you may find more intuitive, using subplot_mosaic:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\"><p lang=\"en\" dir=\"ltr\">FC_Python continuing to put out some good tutorials.<br><br>I feel compelled to add an alternative to gridspec, which is new-ish to matplotlib, and might feel more intuitive to use:<br><br>you can find the gist here:<a href=\"https:\/\/t.co\/DOm2zhRBBZ\">https:\/\/t.co\/DOm2zhRBBZ<\/a> <a href=\"https:\/\/t.co\/3DHElQtc98\">https:\/\/t.co\/3DHElQtc98<\/a> <a href=\"https:\/\/t.co\/jxgtBizMDh\">pic.twitter.com\/jxgtBizMDh<\/a><\/p>&mdash; danzn1 (@danzn1) <a href=\"https:\/\/twitter.com\/danzn1\/status\/1377201636486037504?ref_src=twsrc%5Etfw\">March 31, 2021<\/a><\/blockquote><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script>\n<\/div><\/figure>\n\n\n\n<h3>Conclusion<\/h3>\n<p>In this tutorial we have seen a number of ways to create multiple plots on the same figure.<\/p>\n<p>We can do this manually, if we know explicitly what we want to plot and where.<\/p>\n<p>We also have the option to create grids and access them programatically, to quickly plot subsets of our data.<\/p>\n<p>Finally, we created uneven plots to give both a summary and specifics of x\/y pitch data in one figure.<\/p>\n<p>We&#8217;d love to see what you create with subplots, get in touch on <a href=\"https:\/\/twitter.com\/FC_Python\">Twitter<\/a>\u00a0and let us know!<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[19,22,65],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.13 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating multiple visualisations in Python with subplots - FC Python<\/title>\n<meta name=\"description\" content=\"Subplots allow us to put multiple charts on the same image, manually or automatically. Learn how to create them with Python and matplotlib.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating multiple visualisations in Python with subplots - FC Python\" \/>\n<meta property=\"og:description\" content=\"Subplots allow us to put multiple charts on the same image, manually or automatically. Learn how to create them with Python and matplotlib.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\" \/>\n<meta property=\"og:site_name\" content=\"FC Python\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-29T08:27:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-31T10:21:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-300x165.png\" \/>\n<meta name=\"author\" content=\"FCPythonADMIN\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@FC__Python\" \/>\n<meta name=\"twitter:site\" content=\"@FC__Python\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FCPythonADMIN\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots#article\",\"isPartOf\":{\"@id\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\"},\"author\":{\"name\":\"FCPythonADMIN\",\"@id\":\"https:\/\/fcpython.com\/#\/schema\/person\/ed81e5728929acd0f3f2d9bf824a0bd0\"},\"headline\":\"Creating multiple visualisations in Python with subplots\",\"datePublished\":\"2021-03-29T08:27:51+00:00\",\"dateModified\":\"2021-03-31T10:21:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\"},\"wordCount\":882,\"publisher\":{\"@id\":\"https:\/\/fcpython.com\/#organization\"},\"keywords\":[\"matplotlib\",\"scatter plot\",\"visualisation\"],\"articleSection\":[\"Visualisation\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\",\"url\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\",\"name\":\"Creating multiple visualisations in Python with subplots - FC Python\",\"isPartOf\":{\"@id\":\"https:\/\/fcpython.com\/#website\"},\"datePublished\":\"2021-03-29T08:27:51+00:00\",\"dateModified\":\"2021-03-31T10:21:34+00:00\",\"description\":\"Subplots allow us to put multiple charts on the same image, manually or automatically. Learn how to create them with Python and matplotlib.\",\"breadcrumb\":{\"@id\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fcpython.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating multiple visualisations in Python with subplots\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fcpython.com\/#website\",\"url\":\"https:\/\/fcpython.com\/\",\"name\":\"FC Python\",\"description\":\"Learning Python through football\",\"publisher\":{\"@id\":\"https:\/\/fcpython.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fcpython.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fcpython.com\/#organization\",\"name\":\"FC Python\",\"url\":\"https:\/\/fcpython.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/fcpython.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fcpython.com\/wp-content\/uploads\/2017\/12\/Logocomp9.png\",\"contentUrl\":\"https:\/\/fcpython.com\/wp-content\/uploads\/2017\/12\/Logocomp9.png\",\"width\":981,\"height\":1049,\"caption\":\"FC Python\"},\"image\":{\"@id\":\"https:\/\/fcpython.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/FC__Python\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/fcpython.com\/#\/schema\/person\/ed81e5728929acd0f3f2d9bf824a0bd0\",\"name\":\"FCPythonADMIN\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/fcpython.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7a172a6f730270fc0f8bb1a8ff958895?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7a172a6f730270fc0f8bb1a8ff958895?s=96&d=mm&r=g\",\"caption\":\"FCPythonADMIN\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating multiple visualisations in Python with subplots - FC Python","description":"Subplots allow us to put multiple charts on the same image, manually or automatically. Learn how to create them with Python and matplotlib.","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:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots","og_locale":"en_GB","og_type":"article","og_title":"Creating multiple visualisations in Python with subplots - FC Python","og_description":"Subplots allow us to put multiple charts on the same image, manually or automatically. Learn how to create them with Python and matplotlib.","og_url":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots","og_site_name":"FC Python","article_published_time":"2021-03-29T08:27:51+00:00","article_modified_time":"2021-03-31T10:21:34+00:00","og_image":[{"url":"https:\/\/fcpython.com\/wp-content\/uploads\/2021\/03\/Screenshot-2021-03-29-at-08.03.34-300x165.png"}],"author":"FCPythonADMIN","twitter_card":"summary_large_image","twitter_creator":"@FC__Python","twitter_site":"@FC__Python","twitter_misc":{"Written by":"FCPythonADMIN","Estimated reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots#article","isPartOf":{"@id":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots"},"author":{"name":"FCPythonADMIN","@id":"https:\/\/fcpython.com\/#\/schema\/person\/ed81e5728929acd0f3f2d9bf824a0bd0"},"headline":"Creating multiple visualisations in Python with subplots","datePublished":"2021-03-29T08:27:51+00:00","dateModified":"2021-03-31T10:21:34+00:00","mainEntityOfPage":{"@id":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots"},"wordCount":882,"publisher":{"@id":"https:\/\/fcpython.com\/#organization"},"keywords":["matplotlib","scatter plot","visualisation"],"articleSection":["Visualisation"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots","url":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots","name":"Creating multiple visualisations in Python with subplots - FC Python","isPartOf":{"@id":"https:\/\/fcpython.com\/#website"},"datePublished":"2021-03-29T08:27:51+00:00","dateModified":"2021-03-31T10:21:34+00:00","description":"Subplots allow us to put multiple charts on the same image, manually or automatically. Learn how to create them with Python and matplotlib.","breadcrumb":{"@id":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fcpython.com\/visualisation\/creating-multiple-visualisations-in-python-with-subplots#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fcpython.com\/"},{"@type":"ListItem","position":2,"name":"Creating multiple visualisations in Python with subplots"}]},{"@type":"WebSite","@id":"https:\/\/fcpython.com\/#website","url":"https:\/\/fcpython.com\/","name":"FC Python","description":"Learning Python through football","publisher":{"@id":"https:\/\/fcpython.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fcpython.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/fcpython.com\/#organization","name":"FC Python","url":"https:\/\/fcpython.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/fcpython.com\/#\/schema\/logo\/image\/","url":"https:\/\/fcpython.com\/wp-content\/uploads\/2017\/12\/Logocomp9.png","contentUrl":"https:\/\/fcpython.com\/wp-content\/uploads\/2017\/12\/Logocomp9.png","width":981,"height":1049,"caption":"FC Python"},"image":{"@id":"https:\/\/fcpython.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/twitter.com\/FC__Python"]},{"@type":"Person","@id":"https:\/\/fcpython.com\/#\/schema\/person\/ed81e5728929acd0f3f2d9bf824a0bd0","name":"FCPythonADMIN","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/fcpython.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7a172a6f730270fc0f8bb1a8ff958895?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7a172a6f730270fc0f8bb1a8ff958895?s=96&d=mm&r=g","caption":"FCPythonADMIN"}}]}},"_links":{"self":[{"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/posts\/675"}],"collection":[{"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/comments?post=675"}],"version-history":[{"count":3,"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/posts\/675\/revisions"}],"predecessor-version":[{"id":688,"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/posts\/675\/revisions\/688"}],"wp:attachment":[{"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/media?parent=675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/categories?post=675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fcpython.com\/wp-json\/wp\/v2\/tags?post=675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}