{"id":393768,"date":"2024-06-29T11:12:40","date_gmt":"2024-06-29T11:12:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=393768"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=393768","title":{"rendered":"<span>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0432 Python<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/553\/ad3\/1cb\/553ad31cb7f1e6ba4b514c9d4fe3b62c.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/553\/ad3\/1cb\/553ad31cb7f1e6ba4b514c9d4fe3b62c.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b-\u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041e\u043d\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0430\u0436\u043d\u044b\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0434\u043e\u0445\u043e\u0434\u0430\u043c\u0438 \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u043e\u0434\u0430\u0436 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 plotly.express<\/strong><\/p>\n<p><a href=\"https:\/\/plotly.com\/python\/plotly-express\/\">Plotly Express<\/a> \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f Plotly, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 <a href=\"https:\/\/plotly.com\/python\/px-arguments\/\">\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/a> \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0444\u0438\u0433\u0443\u0440\u044b <a href=\"https:\/\/plotly.com\/python\/styling-plotly-express\/\">\u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u0442\u0438\u043b\u0435<\/a>.\u00a0<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>px.funnel<\/em> \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043e\u0440\u043e\u043d\u043a\u0438.<\/p>\n<pre><code class=\"python\">import plotly.express as px data = dict(     number=[39, 27.4, 20.6, 11, 2],     stage=[\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"]) fig = px.funnel(data, x='number', y='stage') fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0a8\/8b7\/972\/0a88b797272a8ef05ac607d062084b25.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0a8\/8b7\/972\/0a88b797272a8ef05ac607d062084b25.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 plotly.express<\/h2>\n<pre><code class=\"python\">import plotly.express as px import pandas as pd stages = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"] df_mtl = pd.DataFrame(dict(number=[39, 27.4, 20.6, 11, 3], stage=stages)) df_mtl['office'] = 'Montreal' df_toronto = pd.DataFrame(dict(number=[52, 36, 18, 14, 5], stage=stages)) df_toronto['office'] = 'Toronto' df = pd.concat([df_mtl, df_toronto], axis=0) fig = px.funnel(df, x='number', y='stage', color='office') fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ab\/c95\/889\/2abc95889181e10616d10ed75f2b40fc.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2ab\/c95\/889\/2abc95889181e10616d10ed75f2b40fc.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 graph_objects go.Funnel<\/h2>\n<p>\u0415\u0441\u043b\u0438 Plotly Express \u043d\u0435 \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <em>go.Funnel<\/em> \u0438\u0437 <em>plotly.graph_objects (<\/em><a href=\"https:\/\/plotly.com\/python\/graph-objects\/\"><em><u>https:\/\/plotly.com\/python\/graph-objects\/<\/u><\/em><\/a><em>)<\/em>.<\/p>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnel(     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"],     x = [39, 27.4, 20.6, 11, 2]))  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/75d\/7c4\/438\/75d7c4438fe5082dd48aa0e31f9ee76d.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/75d\/7c4\/438\/75d7c4438fe5082dd48aa0e31f9ee76d.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0446\u0432\u0435\u0442\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432<\/strong><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <a href=\"https:\/\/plotly.com\/python\/reference\/scatter\/#scatter-textposition\"><em>textposition<\/em><\/a> \u0438 <a href=\"https:\/\/plotly.com\/python\/reference\/funnel\/#funnel-textinfo\"><em>textinfo<\/em><\/a><em> <\/em>\u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0446\u044b.<\/p>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnel(     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"Finalized\"],     x = [39, 27.4, 20.6, 11, 2],     textposition = \"inside\",     textinfo = \"value+percent initial\",     opacity = 0.65, marker = {\"color\": [\"deepskyblue\", \"lightsalmon\", \"tan\", \"teal\", \"silver\"],     \"line\": {\"width\": [4, 2, 2, 3, 1, 1], \"color\": [\"wheat\", \"wheat\", \"blue\", \"wheat\", \"wheat\"]}},     connector = {\"line\": {\"color\": \"royalblue\", \"dash\": \"dot\", \"width\": 3}})     )  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/21f\/91e\/2e7\/21f91e2e75c23cecb38eb88049d8b6b3.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/21f\/91e\/2e7\/21f91e2e75c23cecb38eb88049d8b6b3.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 go.Funnel<\/h2>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure()  fig.add_trace(go.Funnel(     name = 'Montreal',     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\"],     x = [120, 60, 30, 20],     textinfo = \"value+percent initial\"))  fig.add_trace(go.Funnel(     name = 'Toronto',     orientation = \"h\",     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"],     x = [100, 60, 40, 30, 20],     textposition = \"inside\",     textinfo = \"value+percent previous\"))  fig.add_trace(go.Funnel(     name = 'Vancouver',     orientation = \"h\",     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\", \"Finalized\"],     x = [90, 70, 50, 30, 10, 5],     textposition = \"outside\",     textinfo = \"value+percent total\"))  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ea9\/745\/9f7\/ea97459f7a60c89c4557742039c2741b.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ea9\/745\/9f7\/ea97459f7a60c89c4557742039c2741b.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438 \u0441 plotly.express<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>px.funnel_area<\/code> \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043e\u0440\u043e\u043d\u043a\u0438.<\/p>\n<pre><code class=\"python\">import plotly.express as px fig = px.funnel_area(names=[\"The 1st\",\"The 2nd\", \"The 3rd\", \"The 4th\", \"The 5th\"],                     values=[5, 4, 3, 2, 1]) fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/110\/6a9\/e75\/1106a9e758639a722097e27e66731ff1.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/110\/6a9\/e75\/1106a9e758639a722097e27e66731ff1.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438 \u0441 go.Funnelarea<\/h2>\n<p>\u0415\u0441\u043b\u0438 Plotly Express \u043d\u0435 \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/plotly.com\/python\/graph-objects\/\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 go.Funnelarea \u0438\u0437 plotly.graph_objects<\/a><em>.<\/em><\/p>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnelarea(     text = [\"The 1st\",\"The 2nd\", \"The 3rd\", \"The 4th\", \"The 5th\"],     values = [5, 4, 3, 2, 1]     )) fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ad2\/00f\/8c6\/ad200f8c63bc55ab948937fc0d88ffcd.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad2\/00f\/8c6\/ad200f8c63bc55ab948937fc0d88ffcd.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0446\u0432\u0435\u0442\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432 \u0432 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438<\/h2>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnelarea(       values = [5, 4, 3, 2, 1], text = [\"The 1st\",\"The 2nd\", \"The 3rd\", \"The 4th\", \"The 5th\"],       marker = {\"colors\": [\"deepskyblue\", \"lightsalmon\", \"tan\", \"teal\", \"silver\"],                 \"line\": {\"color\": [\"wheat\", \"wheat\", \"blue\", \"wheat\", \"wheat\"], \"width\": [0, 1, 5, 0, 4]}},       textfont = {\"family\": \"Old Standard TT, serif\", \"size\": 13, \"color\": \"black\"}, opacity = 0.65)) fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa3\/2dc\/807\/aa32dc80701df6ff9e5d620fb65c7e6e.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa3\/2dc\/807\/aa32dc80701df6ff9e5d620fb65c7e6e.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043e\u043d\u043e\u043a \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438<\/h2>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure()  fig.add_trace(go.Funnelarea(     scalegroup = \"first\", values = [500, 450, 340, 230, 220, 110], textinfo = \"value\",     title = {\"position\": \"top center\", \"text\": \"Sales for Sale Person A in U.S.\"},     domain = {\"x\": [0, 0.5], \"y\": [0, 0.5]}))  fig.add_trace(go.Funnelarea(     scalegroup = \"first\", values = [600, 500, 400, 300, 200, 100], textinfo = \"value\",     title = {\"position\": \"top center\", \"text\": \"Sales of Sale Person B in Canada\"},     domain = {\"x\": [0, 0.5], \"y\": [0.55, 1]}))  fig.add_trace(go.Funnelarea(     scalegroup = \"second\", values = [510, 480, 440, 330, 220, 100], textinfo = \"value\",     title = {\"position\": \"top left\", \"text\": \"Sales of Sale Person A in Canada\"},     domain = {\"x\": [0.55, 1], \"y\": [0, 0.5]}))  fig.add_trace(go.Funnelarea(             scalegroup = \"second\", values = [360, 250, 240, 130, 120, 60],             textinfo = \"value\", title = {\"position\": \"top left\", \"text\": \"Sales of Sale Person B in U.S.\"},             domain = {\"x\": [0.55, 1], \"y\": [0.55, 1]}))  fig.update_layout(             margin = {\"l\": 200, \"r\": 200}, shapes = [             {\"x0\": 0, \"x1\": 0.5, \"y0\": 0, \"y1\": 0.5},             {\"x0\": 0, \"x1\": 0.5, \"y0\": 0.55, \"y1\": 1},             {\"x0\": 0.55, \"x1\": 1, \"y0\": 0, \"y1\": 0.5},             {\"x0\": 0.55, \"x1\": 1, \"y0\": 0.55, \"y1\": 1}])  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/169\/ae5\/21d\/169ae521dab0d980359eab580f80b558.png\" width=\"903\" height=\"525\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/169\/ae5\/21d\/169ae521dab0d980359eab580f80b558.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/strong><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 <a href=\"https:\/\/plotly.com\/python-api-reference\/generated\/plotly.express.funnel\">\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0438<\/a> \u0434\u043b\u044f <em>px.(funnel)<\/em> \u0438\u043b\u0438 <a href=\"https:\/\/plotly.com\/python\/reference\/funnel\/\">https:\/\/plotly.com\/python\/reference\/funnel\/<\/a> \u0438 <a href=\"https:\/\/plotly.com\/python\/reference\/funnelarea\/\"><u>https:\/\/plotly.com\/python\/reference\/funnelarea\/<\/u><\/a> , \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h2>\u0410 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 Dash?<\/h2>\n<p><a href=\"https:\/\/dash.plot.ly\/?_ga=2.178328301.833075374.1636360219-1482683062.1636360219\">Dash<\/a> \u2013 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0432 \u043d\u0435\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f JavaScript, \u0438 \u043e\u043d \u0442\u0435\u0441\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c Plotly.<\/p>\n<p>\u0423\u0437\u043d\u0430\u0439\u0442\u0435, \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Dash <a href=\"https:\/\/dash.plot.ly\/installation\">\u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<p>\u0412\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 <code>fig.show()<\/code>, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 Dash, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0435\u0433\u043e \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>figure<\/code> \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 <a href=\"https:\/\/dash.plot.ly\/dash-core-components\/graph?_ga=2.114831438.833075374.1636360219-1482683062.1636360219\">Graph<\/a> \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 <code>built-in dash_core_components<\/code>, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go # or plotly.express as px fig = go.Figure() # or any Plotly Express function e.g. px.bar(...) # fig.add_trace( ... ) # fig.update_layout( ... )  import dash import dash_core_components as dcc import dash_html_components as html  app = dash.Dash() app.layout = html.Div([     dcc.Graph(figure=fig) ])  app.run_server(debug=True, use_reloader=False)  # Turn off reloader if inside Jupyter<\/code><\/pre>\n<hr\/>\n<blockquote>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/nuYG\/\">\u00abPython \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438\u00bb.<\/a> <\/p>\n<p>\u0412\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043d\u0430 demo-\u0437\u0430\u043d\u044f\u0442\u0438\u0435 <strong>\u00abSQL \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438\u00bb<\/strong>. SQL \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0432, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432 \u0438 \u043c\u0430\u0440\u043a\u0435\u0442\u043e\u043b\u043e\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0432\u0438\u0442\u0440\u0438\u043d. <a href=\"https:\/\/otus.pw\/AmCj\/\"><strong>>> \u0420\u0415\u0413\u0418\u0421\u0422\u0420\u0410\u0426\u0418\u042f \u041d\u0410 \u0417\u0410\u041d\u042f\u0422\u0418\u0415<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/588190\/\"> https:\/\/habr.com\/ru\/articles\/588190\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b-\u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041e\u043d\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0430\u0436\u043d\u044b\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c \u0431\u0438\u0437\u043d\u0435\u0441-\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0434\u043e\u0445\u043e\u0434\u0430\u043c\u0438 \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u043e\u0434\u0430\u0436 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043e\u0442 \u043e\u0431\u0449\u0435\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432\u0441\u0435\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p><strong>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 plotly.express<\/strong><\/p>\n<p><a href=\"https:\/\/plotly.com\/python\/plotly-express\/\">Plotly Express<\/a> \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f Plotly, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 <a href=\"https:\/\/plotly.com\/python\/px-arguments\/\">\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/a> \u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0444\u0438\u0433\u0443\u0440\u044b <a href=\"https:\/\/plotly.com\/python\/styling-plotly-express\/\">\u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u0442\u0438\u043b\u0435<\/a>.\u00a0<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>px.funnel<\/em> \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043e\u0440\u043e\u043d\u043a\u0438.<\/p>\n<pre><code class=\"python\">import plotly.express as px data = dict(     number=[39, 27.4, 20.6, 11, 2],     stage=[\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"]) fig = px.funnel(data, x='number', y='stage') fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 plotly.express<\/h2>\n<pre><code class=\"python\">import plotly.express as px import pandas as pd stages = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"] df_mtl = pd.DataFrame(dict(number=[39, 27.4, 20.6, 11, 3], stage=stages)) df_mtl['office'] = 'Montreal' df_toronto = pd.DataFrame(dict(number=[52, 36, 18, 14, 5], stage=stages)) df_toronto['office'] = 'Toronto' df = pd.concat([df_mtl, df_toronto], axis=0) fig = px.funnel(df, x='number', y='stage', color='office') fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 graph_objects go.Funnel<\/h2>\n<p>\u0415\u0441\u043b\u0438 Plotly Express \u043d\u0435 \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <em>go.Funnel<\/em> \u0438\u0437 <em>plotly.graph_objects (<\/em><a href=\"https:\/\/plotly.com\/python\/graph-objects\/\"><em><u>https:\/\/plotly.com\/python\/graph-objects\/<\/u><\/em><\/a><em>)<\/em>.<\/p>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnel(     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"],     x = [39, 27.4, 20.6, 11, 2]))  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0446\u0432\u0435\u0442\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432<\/strong><\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <a href=\"https:\/\/plotly.com\/python\/reference\/scatter\/#scatter-textposition\"><em>textposition<\/em><\/a> \u0438 <a href=\"https:\/\/plotly.com\/python\/reference\/funnel\/#funnel-textinfo\"><em>textinfo<\/em><\/a><em> <\/em>\u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0439 \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0446\u044b.<\/p>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnel(     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"Finalized\"],     x = [39, 27.4, 20.6, 11, 2],     textposition = \"inside\",     textinfo = \"value+percent initial\",     opacity = 0.65, marker = {\"color\": [\"deepskyblue\", \"lightsalmon\", \"tan\", \"teal\", \"silver\"],     \"line\": {\"width\": [4, 2, 2, 3, 1, 1], \"color\": [\"wheat\", \"wheat\", \"blue\", \"wheat\", \"wheat\"]}},     connector = {\"line\": {\"color\": \"royalblue\", \"dash\": \"dot\", \"width\": 3}})     )  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 go.Funnel<\/h2>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure()  fig.add_trace(go.Funnel(     name = 'Montreal',     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\"],     x = [120, 60, 30, 20],     textinfo = \"value+percent initial\"))  fig.add_trace(go.Funnel(     name = 'Toronto',     orientation = \"h\",     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\"],     x = [100, 60, 40, 30, 20],     textposition = \"inside\",     textinfo = \"value+percent previous\"))  fig.add_trace(go.Funnel(     name = 'Vancouver',     orientation = \"h\",     y = [\"Website visit\", \"Downloads\", \"Potential customers\", \"Requested price\", \"invoice sent\", \"Finalized\"],     x = [90, 70, 50, 30, 10, 5],     textposition = \"outside\",     textinfo = \"value+percent total\"))  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438 \u0441 plotly.express<\/h2>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>px.funnel_area<\/code> \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043e\u0440\u043e\u043d\u043a\u0438.<\/p>\n<pre><code class=\"python\">import plotly.express as px fig = px.funnel_area(names=[\"The 1st\",\"The 2nd\", \"The 3rd\", \"The 4th\", \"The 5th\"],                     values=[5, 4, 3, 2, 1]) fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438 \u0441 go.Funnelarea<\/h2>\n<p>\u0415\u0441\u043b\u0438 Plotly Express \u043d\u0435 \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/plotly.com\/python\/graph-objects\/\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 go.Funnelarea \u0438\u0437 plotly.graph_objects<\/a><em>.<\/em><\/p>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnelarea(     text = [\"The 1st\",\"The 2nd\", \"The 3rd\", \"The 4th\", \"The 5th\"],     values = [5, 4, 3, 2, 1]     )) fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u0446\u0432\u0435\u0442\u0430 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432 \u0432 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u043e\u0440\u043e\u043d\u043a\u0438 \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438<\/h2>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure(go.Funnelarea(       values = [5, 4, 3, 2, 1], text = [\"The 1st\",\"The 2nd\", \"The 3rd\", \"The 4th\", \"The 5th\"],       marker = {\"colors\": [\"deepskyblue\", \"lightsalmon\", \"tan\", \"teal\", \"silver\"],                 \"line\": {\"color\": [\"wheat\", \"wheat\", \"blue\", \"wheat\", \"wheat\"], \"width\": [0, 1, 5, 0, 4]}},       textfont = {\"family\": \"Old Standard TT, serif\", \"size\": 13, \"color\": \"black\"}, opacity = 0.65)) fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0440\u043e\u043d\u043e\u043a \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438<\/h2>\n<pre><code class=\"python\">from plotly import graph_objects as go  fig = go.Figure()  fig.add_trace(go.Funnelarea(     scalegroup = \"first\", values = [500, 450, 340, 230, 220, 110], textinfo = \"value\",     title = {\"position\": \"top center\", \"text\": \"Sales for Sale Person A in U.S.\"},     domain = {\"x\": [0, 0.5], \"y\": [0, 0.5]}))  fig.add_trace(go.Funnelarea(     scalegroup = \"first\", values = [600, 500, 400, 300, 200, 100], textinfo = \"value\",     title = {\"position\": \"top center\", \"text\": \"Sales of Sale Person B in Canada\"},     domain = {\"x\": [0, 0.5], \"y\": [0.55, 1]}))  fig.add_trace(go.Funnelarea(     scalegroup = \"second\", values = [510, 480, 440, 330, 220, 100], textinfo = \"value\",     title = {\"position\": \"top left\", \"text\": \"Sales of Sale Person A in Canada\"},     domain = {\"x\": [0.55, 1], \"y\": [0, 0.5]}))  fig.add_trace(go.Funnelarea(             scalegroup = \"second\", values = [360, 250, 240, 130, 120, 60],             textinfo = \"value\", title = {\"position\": \"top left\", \"text\": \"Sales of Sale Person B in U.S.\"},             domain = {\"x\": [0.55, 1], \"y\": [0.55, 1]}))  fig.update_layout(             margin = {\"l\": 200, \"r\": 200}, shapes = [             {\"x0\": 0, \"x1\": 0.5, \"y0\": 0, \"y1\": 0.5},             {\"x0\": 0, \"x1\": 0.5, \"y0\": 0.55, \"y1\": 1},             {\"x0\": 0.55, \"x1\": 1, \"y0\": 0, \"y1\": 0.5},             {\"x0\": 0.55, \"x1\": 1, \"y0\": 0.55, \"y1\": 1}])  fig.show()<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/strong><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 <a href=\"https:\/\/plotly.com\/python-api-reference\/generated\/plotly.express.funnel\">\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0438<\/a> \u0434\u043b\u044f <em>px.(funnel)<\/em> \u0438\u043b\u0438 <a href=\"https:\/\/plotly.com\/python\/reference\/funnel\/\">https:\/\/plotly.com\/python\/reference\/funnel\/<\/a> \u0438 <a href=\"https:\/\/plotly.com\/python\/reference\/funnelarea\/\"><u>https:\/\/plotly.com\/python\/reference\/funnelarea\/<\/u><\/a> , \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h2>\u0410 \u043a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 Dash?<\/h2>\n<p><a href=\"https:\/\/dash.plot.ly\/?_ga=2.178328301.833075374.1636360219-1482683062.1636360219\">Dash<\/a> \u2013 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0432 \u043d\u0435\u043c \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f JavaScript, \u0438 \u043e\u043d \u0442\u0435\u0441\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c Plotly.<\/p>\n<p>\u0423\u0437\u043d\u0430\u0439\u0442\u0435, \u043a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Dash <a href=\"https:\/\/dash.plot.ly\/installation\">\u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<p>\u0412\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 <code>fig.show()<\/code>, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 Dash, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0435\u0433\u043e \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>figure<\/code> \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 <a href=\"https:\/\/dash.plot.ly\/dash-core-components\/graph?_ga=2.114831438.833075374.1636360219-1482683062.1636360219\">Graph<\/a> \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 <code>built-in dash_core_components<\/code>, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">import plotly.graph_objects as go # or plotly.express as px fig = go.Figure() # or any Plotly Express function e.g. px.bar(...) # fig.add_trace( ... ) # fig.update_layout( ... )  import dash import dash_core_components as dcc import dash_html_components as html  app = dash.Dash() app.layout = html.Div([     dcc.Graph(figure=fig) ])  app.run_server(debug=True, use_reloader=False)  # Turn off reloader if inside Jupyter<\/code><\/pre>\n<hr\/>\n<blockquote>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/nuYG\/\">\u00abPython \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438\u00bb.<\/a> <\/p>\n<p>\u0412\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043d\u0430 demo-\u0437\u0430\u043d\u044f\u0442\u0438\u0435 <strong>\u00abSQL \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438\u00bb<\/strong>. SQL \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u043e\u0432, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432 \u0438 \u043c\u0430\u0440\u043a\u0435\u0442\u043e\u043b\u043e\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0432\u0438\u0442\u0440\u0438\u043d. <a href=\"https:\/\/otus.pw\/AmCj\/\"><strong>>> \u0420\u0415\u0413\u0418\u0421\u0422\u0420\u0410\u0426\u0418\u042f \u041d\u0410 \u0417\u0410\u041d\u042f\u0422\u0418\u0415<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/588190\/\"> https:\/\/habr.com\/ru\/articles\/588190\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-393768","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/393768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=393768"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/393768\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=393768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=393768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=393768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}