{"id":752,"date":"2021-08-01T23:07:14","date_gmt":"2021-08-01T23:07:14","guid":{"rendered":"https:\/\/mark-baerthel.de\/?p=752"},"modified":"2025-01-15T12:17:41","modified_gmt":"2025-01-15T12:17:41","slug":"interactive-plots-with-python","status":"publish","type":"post","link":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/","title":{"rendered":"Interactive plots with Python"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When working with large datasets the explanatory analysis proofs to be of high importance, both for the client and the data scientist. A visual and potentially interactive approach can greatly help with the development of research hypotheses and is a great start for the data cleaning and prepping process. In <a href=\"https:\/\/mark-baerthel.de\/index.php\/2022\/python-vs-excel-for-financial-modeling\/\">Python<\/a>, there are great packages available to visualize data and great interactive plots.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This blog post gives a small overview of available tools, development, and deployment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> The vibrant and ever-developing landscape of Python libraries offers a variety of possibilities in 2021. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Interactive Python vizualisation libraries<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are low code alternatives like:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/flourish.studio\/\" target=\"_blank\" rel=\"noreferrer noopener\">Flourish<\/a><\/li><li><a href=\"https:\/\/www.datawrapper.de\/\" target=\"_blank\" rel=\"noreferrer noopener\">DataWrapper<\/a><\/li><li><a href=\"https:\/\/www.chartblocks.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Chartblocks<\/a><\/li><li><a href=\"https:\/\/infogram.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Infogram<\/a><\/li><li><a href=\"https:\/\/plotly.com\/chart-studio\/\" target=\"_blank\" rel=\"noreferrer noopener\">ChartStudio<\/a><\/li><li><a href=\"https:\/\/public.tableau.com\/en-us\/s\/\" target=\"_blank\" rel=\"noreferrer noopener\">TableauPublic<\/a><\/li><li><a href=\"https:\/\/rawgraphs.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">RAW Graphs<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I personally love Tableau, especially in client interactions and meetings. However, in the research-focused setting, we then work more on the code level. Any list at this point can merely be an inspiration to play:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/matplotlib.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Mathplotlib<\/a><\/li><li><a href=\"https:\/\/seaborn.pydata.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Seaborn<\/a><\/li><li><a href=\"https:\/\/ggplot2.tidyverse.org\/reference\/ggplot.html\" target=\"_blank\" rel=\"noreferrer noopener\">GGplot<\/a><\/li><li><a href=\"https:\/\/bokeh.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Bokeh<\/a><\/li><li><a href=\"https:\/\/plotly.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Plotly<\/strong><\/a><\/li><li><a href=\"https:\/\/gleam.run\/\" target=\"_blank\" rel=\"noreferrer noopener\">Gleam<\/a><\/li><li><a href=\"https:\/\/pypi.org\/project\/leather\/\" target=\"_blank\" rel=\"noreferrer noopener\">Leather<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Plotly (-Express) \/ Plotly-ChartStudio<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The weapon of choice featured in this post is Plotly with its great extensions and wrapper Plotly-Express and ChartStudio. We love the highly developed library that allows creating interactive graphs with just a few lines of code. The deployment is easy as it works directly from a Jupyther notebook.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example &#8211; Show me the code&#8230;.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I directly mount the Google drive, that stores my dataset in this example, from the notebook and import the relevant libraries. The credentials and the api_key for the hosting solution are also provided in the script. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from google.colab import drive\ndrive.mount('\/content\/drive')\npip install dash\npip install chart_studio\nimport os\nimport pandas as pd\nimport numpy as np\nimport plotly.express as px\nimport dash\nimport dash_core_components as dcc\nimport dash_html_components as html\nfrom dash.dependencies import Input, Output\nimport chart_studio\nchart_studio.tools.set_credentials_file(username='XXXXXXX', api_key='XXXXXXXXXXXXXXXXXXX')<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The data was gathered from the three largest crowdfunding sites in Germany. In this example, I want to explorer several variables at once. First, the success of the campaign and therefore if the funding limit was reached. Second, the presentation format is represented by the video length of the pitch and the number of pictures used. Third, we are interested if the start-up has already registered a patent. Furthermore, the graph should illustrate the equity offered by the start-up on the platform.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fig2 = px.box(df, x=\"plat\", y=\"equityoffer\")\nfig2.show()\npy.plot(fig2, filename = 'boxplot', auto_open=True)\n\nfig = px.scatter_3d(df, x=\"n_words\", y=\"n_vidlength\", z=\"n_picgraph\", color=\"d_fundlim\", size=\"equityoffer\", hover_name=\"location\",\n                  symbol=\"d_Patents_registered\")\nfig.show()\npy.plot(fig, filename = 'basic-line', auto_open=True)<\/code><\/pre>\n\n\n\n<iframe width=\"900\" height=\"800\" frameborder=\"0\" scrolling=\"no\" data-src=\"\/\/plotly.com\/~sisiphos\/5.embed\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n\n\n\n<iframe width=\"900\" height=\"800\" frameborder=\"0\" scrolling=\"no\" data-src=\"\/\/plotly.com\/~sisiphos\/1.embed\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\">Play with the graphs and have fun \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with large datasets the explanatory analysis proofs to be of high importance, both for the client and the data scientist. A visual and potentially interactive approach can greatly help with the development of research hypotheses and is a great start for the data cleaning and prepping process. In Python, there are great packages available to visualize data and great interactive plots. This blog post gives a small overview of available tools, development, and deployment. The vibrant and ever-developing landscape of Python libraries offers a variety of possibilities in 2021. Interactive Python vizualisation libraries There are low code alternatives [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[128,1],"tags":[129,130],"class_list":["post-752","post","type-post","status-publish","format-standard","hentry","category-python-playground","category-uncategorized","tag-python-2","tag-research"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Interactive plots with Python - Mark Baerthel<\/title>\n<meta name=\"description\" content=\"Learn how to create interactive Python visualizations with Plotly. Explore tools, code examples, and tips for effective data analysis and visualization\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Interactive plots with Python - Mark Baerthel\" \/>\n<meta property=\"og:description\" content=\"Learn how to create interactive Python visualizations with Plotly. Explore tools, code examples, and tips for effective data analysis and visualization\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Mark Baerthel\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-01T23:07:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-15T12:17:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mark-baerthel.de\/wp-content\/uploads\/2020\/11\/boatsmall.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1400\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#\\\/schema\\\/person\\\/ac3b28e0319b942c21e3bf20ce84c1ca\"},\"headline\":\"Interactive plots with Python\",\"datePublished\":\"2021-08-01T23:07:14+00:00\",\"dateModified\":\"2025-01-15T12:17:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/\"},\"wordCount\":339,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#organization\"},\"keywords\":[\"python\",\"research\"],\"articleSection\":[\"Python Playground\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/\",\"url\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/\",\"name\":\"Interactive plots with Python - Mark Baerthel\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#website\"},\"datePublished\":\"2021-08-01T23:07:14+00:00\",\"dateModified\":\"2025-01-15T12:17:41+00:00\",\"description\":\"Learn how to create interactive Python visualizations with Plotly. Explore tools, code examples, and tips for effective data analysis and visualization\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/2021\\\/interactive-plots-with-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mark-baerthel.de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Interactive plots with Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#website\",\"url\":\"https:\\\/\\\/mark-baerthel.de\\\/\",\"name\":\"Mark Baerthel\",\"description\":\"Data Science Consulting\",\"publisher\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/mark-baerthel.de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#organization\",\"name\":\"Mark Baerthel\",\"url\":\"https:\\\/\\\/mark-baerthel.de\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/mark-baerthel.de\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/cropped-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/mark-baerthel.de\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/cropped-logo.jpg\",\"width\":512,\"height\":512,\"caption\":\"Mark Baerthel\"},\"image\":{\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/#\\\/schema\\\/person\\\/ac3b28e0319b942c21e3bf20ce84c1ca\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mark-baerthel.de\\\/wp-content\\\/litespeed\\\/avatar\\\/8115544bc182c338441acb3f662a72ff.jpg?ver=1780537998\",\"url\":\"https:\\\/\\\/mark-baerthel.de\\\/wp-content\\\/litespeed\\\/avatar\\\/8115544bc182c338441acb3f662a72ff.jpg?ver=1780537998\",\"contentUrl\":\"https:\\\/\\\/mark-baerthel.de\\\/wp-content\\\/litespeed\\\/avatar\\\/8115544bc182c338441acb3f662a72ff.jpg?ver=1780537998\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/mark-baerthel.de\"],\"url\":\"https:\\\/\\\/mark-baerthel.de\\\/index.php\\\/author\\\/mail2markb_zg8hrtle\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Interactive plots with Python - Mark Baerthel","description":"Learn how to create interactive Python visualizations with Plotly. Explore tools, code examples, and tips for effective data analysis and visualization","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:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/","og_locale":"en_US","og_type":"article","og_title":"Interactive plots with Python - Mark Baerthel","og_description":"Learn how to create interactive Python visualizations with Plotly. Explore tools, code examples, and tips for effective data analysis and visualization","og_url":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/","og_site_name":"Mark Baerthel","article_published_time":"2021-08-01T23:07:14+00:00","article_modified_time":"2025-01-15T12:17:41+00:00","og_image":[{"width":1400,"height":700,"url":"https:\/\/mark-baerthel.de\/wp-content\/uploads\/2020\/11\/boatsmall.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/#article","isPartOf":{"@id":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/"},"author":{"name":"admin","@id":"https:\/\/mark-baerthel.de\/#\/schema\/person\/ac3b28e0319b942c21e3bf20ce84c1ca"},"headline":"Interactive plots with Python","datePublished":"2021-08-01T23:07:14+00:00","dateModified":"2025-01-15T12:17:41+00:00","mainEntityOfPage":{"@id":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/"},"wordCount":339,"commentCount":0,"publisher":{"@id":"https:\/\/mark-baerthel.de\/#organization"},"keywords":["python","research"],"articleSection":["Python Playground"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/","url":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/","name":"Interactive plots with Python - Mark Baerthel","isPartOf":{"@id":"https:\/\/mark-baerthel.de\/#website"},"datePublished":"2021-08-01T23:07:14+00:00","dateModified":"2025-01-15T12:17:41+00:00","description":"Learn how to create interactive Python visualizations with Plotly. Explore tools, code examples, and tips for effective data analysis and visualization","breadcrumb":{"@id":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mark-baerthel.de\/index.php\/2021\/interactive-plots-with-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mark-baerthel.de\/"},{"@type":"ListItem","position":2,"name":"Interactive plots with Python"}]},{"@type":"WebSite","@id":"https:\/\/mark-baerthel.de\/#website","url":"https:\/\/mark-baerthel.de\/","name":"Mark Baerthel","description":"Data Science Consulting","publisher":{"@id":"https:\/\/mark-baerthel.de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mark-baerthel.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mark-baerthel.de\/#organization","name":"Mark Baerthel","url":"https:\/\/mark-baerthel.de\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mark-baerthel.de\/#\/schema\/logo\/image\/","url":"https:\/\/mark-baerthel.de\/wp-content\/uploads\/2020\/08\/cropped-logo.jpg","contentUrl":"https:\/\/mark-baerthel.de\/wp-content\/uploads\/2020\/08\/cropped-logo.jpg","width":512,"height":512,"caption":"Mark Baerthel"},"image":{"@id":"https:\/\/mark-baerthel.de\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/mark-baerthel.de\/#\/schema\/person\/ac3b28e0319b942c21e3bf20ce84c1ca","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mark-baerthel.de\/wp-content\/litespeed\/avatar\/8115544bc182c338441acb3f662a72ff.jpg?ver=1780537998","url":"https:\/\/mark-baerthel.de\/wp-content\/litespeed\/avatar\/8115544bc182c338441acb3f662a72ff.jpg?ver=1780537998","contentUrl":"https:\/\/mark-baerthel.de\/wp-content\/litespeed\/avatar\/8115544bc182c338441acb3f662a72ff.jpg?ver=1780537998","caption":"admin"},"sameAs":["https:\/\/mark-baerthel.de"],"url":"https:\/\/mark-baerthel.de\/index.php\/author\/mail2markb_zg8hrtle\/"}]}},"_links":{"self":[{"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/posts\/752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/comments?post=752"}],"version-history":[{"count":8,"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/posts\/752\/revisions"}],"predecessor-version":[{"id":859,"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/posts\/752\/revisions\/859"}],"wp:attachment":[{"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/media?parent=752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/categories?post=752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mark-baerthel.de\/index.php\/wp-json\/wp\/v2\/tags?post=752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}