1. <legend id='WOGTw'><style id='WOGTw'><dir id='WOGTw'><q id='WOGTw'></q></dir></style></legend>
        <tfoot id='WOGTw'></tfoot>
      2. <i id='WOGTw'><tr id='WOGTw'><dt id='WOGTw'><q id='WOGTw'><span id='WOGTw'><b id='WOGTw'><form id='WOGTw'><ins id='WOGTw'></ins><ul id='WOGTw'></ul><sub id='WOGTw'></sub></form><legend id='WOGTw'></legend><bdo id='WOGTw'><pre id='WOGTw'><center id='WOGTw'></center></pre></bdo></b><th id='WOGTw'></th></span></q></dt></tr></i><div id='WOGTw'><tfoot id='WOGTw'></tfoot><dl id='WOGTw'><fieldset id='WOGTw'></fieldset></dl></div>

        • <bdo id='WOGTw'></bdo><ul id='WOGTw'></ul>

        <small id='WOGTw'></small><noframes id='WOGTw'>

        Plotly 域变量解释(多图)

        Plotly domain variable explained (Multiple graphs)(Plotly 域变量解释(多图))

            <tbody id='PJ5QR'></tbody>
        1. <small id='PJ5QR'></small><noframes id='PJ5QR'>

          <i id='PJ5QR'><tr id='PJ5QR'><dt id='PJ5QR'><q id='PJ5QR'><span id='PJ5QR'><b id='PJ5QR'><form id='PJ5QR'><ins id='PJ5QR'></ins><ul id='PJ5QR'></ul><sub id='PJ5QR'></sub></form><legend id='PJ5QR'></legend><bdo id='PJ5QR'><pre id='PJ5QR'><center id='PJ5QR'></center></pre></bdo></b><th id='PJ5QR'></th></span></q></dt></tr></i><div id='PJ5QR'><tfoot id='PJ5QR'></tfoot><dl id='PJ5QR'><fieldset id='PJ5QR'></fieldset></dl></div>

              <legend id='PJ5QR'><style id='PJ5QR'><dir id='PJ5QR'><q id='PJ5QR'></q></dir></style></legend>
                <bdo id='PJ5QR'></bdo><ul id='PJ5QR'></ul>
                • <tfoot id='PJ5QR'></tfoot>
                  本文介绍了Plotly 域变量解释(多图)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在查看以下教程的饼图子图"部分(页面上的最后一个)https://plot.ly/python/pie-charts/.

                  I am looking at the 'Pie Chart Subplots' section (last one on page) of the following tutorial https://plot.ly/python/pie-charts/.

                  在一次绘制多个图形时,我不知道如何理解域变量.例如:

                  I cant figure out how to understand the domain variable when it comes to plotting multiple graphs at once. For instance:

                          {
                          'labels': ['1st', '2nd', '3rd', '4th', '5th'],
                          'values': [38, 27, 18, 10, 7],
                          'type': 'pie',
                          'name': 'Starry Night',
                          'marker': {'colors': ['rgb(56, 75, 126)',
                                                'rgb(18, 36, 37)',
                                                'rgb(34, 53, 101)',
                                                'rgb(36, 55, 57)',
                                                'rgb(6, 4, 4)']},
                          'domain': {'x': [0, .48],
                                     'y': [0, .49]},
                          'hoverinfo':'label+percent+name',
                          'textinfo':'none'
                      },
                  

                  将在左下角坐标绘制一个饼图.

                  will plot a pie chart in the bottom left coordinates.

                  有人可以解释域变量(及其 x 和 y 分量)在 plotly 中的实际工作原理吗?

                  Can someone explain how the domain variable (and its x and y components) works in practice in plotly?

                  推荐答案

                  我们只使用Javascript,因为它可以在这里执行.域属性在 Python 和 Javascript 中是相同的.

                  Let's just use Javascript because it can be executed here. The domain attribute is identical in Python and Javascript.

                  来自文档:

                  x(数组)

                  默认值:[0, 1]

                  设置此饼图的水平域(在绘图部分中).每个对象都有下面列出的一个或多个键.

                  Sets the horizontal domain of this pie trace (in plot fraction). Each object has one or more of the keys listed below.

                  数组的第一个成员是开始位置,第二个成员是结束位置.

                  The first member of the array is the start position and the 2nd member is the end position.

                  对于x 0 表示一直向左,1 表示一直向右.

                  For x 0 means all the way to the left and 1 is all the way to right.

                  对于 y 0 是顶部,1 是底部.

                  For y 0 is top and 1 is bottom.

                  例如左上象限是 x = [0, 0.5]y = [0, 0.5]

                  e.g. the upper left quadrant would be x = [0, 0.5] and y = [0, 0.5]

                  如果您有多个地块,例如在下面的示例中,有两个 div,每个有 4 个绘图,每个绘图的域指定它占用的空间.在第一个示例中,每个地块获得四分之一的可用空间(即 x 和 y 设置为 0 到 0.5 和 0.5 到 1).

                  If you have multiple plots, e.g. in the example below there are two divs with 4 plots each, the domain of each plot specifies which space is occupied by it. In the first example each plot gets a quarter of the available space (i.e. x and y are set to 0 to 0.5 resp. 0.5 to 1).

                  在第二个示例中,最后一个图的 domain 与其他域重叠(0.25 到 0.75).

                  In the second example the domain of the last plot overlaps with the other domains (0.25 to 0.75).

                  在第三个示例中,最后一个图的 domain 更大,并与其余部分重叠(0 到 0.75).

                  In the third example the domain of the last plot is bigger and overlaps with the rest (0 to 0.75).

                  简而言之,domain只是指定子图占用总绘图区域的哪个空间.

                  In short, domain just specifies which space of the total plot area is occupied by the subplot.

                  var allValues = [
                    [50, 30, 20],
                    [45, 30, 25],
                    [55, 25, 20],
                    [50, 15, 35]
                  ];
                  
                  var data = [{
                    values: allValues[0],
                    type: 'pie',
                    domain: {
                      x: [0, .5],
                      y: [0, .5]
                    },
                  }, {
                    values: allValues[1],
                    type: 'pie',
                    domain: {
                      x: [0.5, 1],
                      y: [0, .5]
                    }
                  }, {
                    values: allValues[2],
                    type: 'pie',
                    domain: {
                      x: [0, .5],
                      y: [.5, 1]
                    }
                  }, {
                    values: allValues[3],
                    type: 'pie',
                    domain: {
                      x: [0.5, 1],
                      y: [0.5, 1]
                    },
                  }];
                  
                  
                  
                  Plotly.newPlot('myDiv', data);
                  data[3].domain.x = [0.25, 0.75];
                  data[3].domain.y = [0.25, 0.75];
                  
                  Plotly.newPlot('myDiv2', data);
                  
                  data[3].domain.x = [0.0, 0.75];
                  data[3].domain.y = [0.0, 0.75];
                  Plotly.newPlot('myDiv3', data);

                  <div id='myDiv'></div>
                  <div id='myDiv2'></div>
                  <div id='myDiv3'></div>
                  
                  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>

                  这篇关于Plotly 域变量解释(多图)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)

                        <tbody id='henk6'></tbody>
                          <bdo id='henk6'></bdo><ul id='henk6'></ul>

                        • <legend id='henk6'><style id='henk6'><dir id='henk6'><q id='henk6'></q></dir></style></legend>

                          <small id='henk6'></small><noframes id='henk6'>

                            <tfoot id='henk6'></tfoot>
                            <i id='henk6'><tr id='henk6'><dt id='henk6'><q id='henk6'><span id='henk6'><b id='henk6'><form id='henk6'><ins id='henk6'></ins><ul id='henk6'></ul><sub id='henk6'></sub></form><legend id='henk6'></legend><bdo id='henk6'><pre id='henk6'><center id='henk6'></center></pre></bdo></b><th id='henk6'></th></span></q></dt></tr></i><div id='henk6'><tfoot id='henk6'></tfoot><dl id='henk6'><fieldset id='henk6'></fieldset></dl></div>