小编Flu*_*990的帖子

Docker 构建速度如此之慢,如何加快速度?

每次我构建 Docker 镜像时,“[内部]加载 docker.io 的元数据...”和“[内部]加载构建上下文”步骤都会花费很长时间,这很痛苦。

下面是最近构建的输出,上面提到的两个步骤 (*) 总共花费了近 4 分钟。这是正常的吗?

 => [internal] load build definition from Dockerfile                                                             0.1s
 => => transferring dockerfile: 287B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 2B                                                                                    0.0s
 *=> [internal] load metadata for docker.io/library/python:3.8                                                     81.5s
 => [auth] library/python:pull token for registry-1.docker.io                                                      0.0s
 *=> [internal] load build context                                                                                167.5s
 => => transferring context: 3.59MB                                                                              167.4s
 => [1/6] FROM docker.io/library/python:3.8@sha256:53cb5152064a7e7b485ad42704ea63c5155b264c82e7f17de99d3aa28e4f89  0.0s
 => CACHED [2/6] WORKDIR /code                                                                                     0.0s
 => CACHED [3/6] COPY requirements.txt /code                                                                       0.0s
 => …
Run Code Online (Sandbox Code Playgroud)

docker

11
推荐指数
1
解决办法
5051
查看次数

Plotly:如何在注释中同时使用美元符号和换行符?

不确定我是否在这里遗漏了一些明显的东西,但是当我在带有注释的文本中插入一个中断(<br>)时,它似乎忽略了它。我已经尝试过fig.add_annotations,但同样的事情发生了。

你知道为什么这不起作用吗?

import pandas as pd
import plotly.graph_objects as go
import numpy as np

df = pd.DataFrame({"Growth_Type": ["Growing Fast", "Growing", "Stable", "Dropping", "Dropping Fast"],
                  "Accounts": [407,1275,3785,1467,623],
                  "Gain_Share": [1.20,8.1,34.4,6.5,0.4],
                  "Keep_Share": [16.5, 101.2, 306.3, 107.2, 27.7]})

df2 = pd.concat([pd.DataFrame({"Growth_Type":df["Growth_Type"], 
              "Opportunity_Type": np.repeat("Gain Share", 5),
             "Wallet_Share": df["Gain_Share"]}),
          pd.DataFrame({"Growth_Type":df["Growth_Type"], 
              "Opportunity_Type": np.repeat("Keep Share", 5),
             "Wallet_Share": df["Keep_Share"]})])

fig = go.Figure()

fig.add_trace(go.Bar(x = df2["Wallet_Share"], 
                     y = df2["Growth_Type"],
                     orientation = "h"
                    ))

fig.update_layout(font = dict(size = 12, color = "#A6ACAF"),
                 xaxis_tickprefix = "$",
                  plot_bgcolor …
Run Code Online (Sandbox Code Playgroud)

python plotly

4
推荐指数
1
解决办法
615
查看次数

Plotly:跟踪名称出现在 HoverInfo 之外

下面是一些代码的示例,其中名称出现在悬停信息标签的外部。

在我的实际代码中,我已经考虑了悬停信息中的名称,所以我只想让这一点消失(请参见下图中突出显示的部分)。

不幸的是,我无法设置name ="",因为我正在使用名称值来更改标记的颜色。

有谁能帮忙解决这个问题,或者以前有过尝试这样做的经验吗?任何帮助将不胜感激。

这很奇怪,因为这在本页的plotly dash 官方文档中显示发生了。

category = "a"

from plotly.subplots import make_subplots

fig_ex = make_subplots(rows=1, cols=2)

fig_ex.add_scatter(y=[4, 2, 3.5], mode="markers",
                marker=dict(size=20, color="MediumPurple"),
                name="a", row=1, col=1)

fig_ex.add_bar(y=[2, 1, 3],
            marker=dict(color="MediumPurple"),
            name="b", row=1, col=1)

fig_ex.add_scatter(y=[2, 3.5, 4], mode="markers",
                marker=dict(size=20, color="MediumPurple"),
                name="c", row=1, col=2)

fig_ex.add_bar(y=[1, 3, 2],
            marker=dict(color="MediumPurple"),
            name="d", row=1, col=2)

fig_ex.update_layout(showlegend = False)

fig_ex.update_traces(hovertemplate = 
                    "x: %{x}<br>" +
                    "y: %{y}")

fig_ex.for_each_trace(
    lambda trace: trace.update(marker_color="LightSeaGreen") if trace.name == category else (),
)

fig_ex.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

python plotly

1
推荐指数
1
解决办法
1233
查看次数

标签 统计

plotly ×2

python ×2

docker ×1