小编Heb*_*rst的帖子

将线段添加到绘图中的简洁方法(使用 python/jupyter 笔记本)?

我想创建一个带有几个水平线段的棒棒糖图,如下所示 - https://python-graph-gallery.com/184-lollipop-plot-with-2-group。我想使用plotly,因为我更喜欢图形(和简单的交互性),但找不到简洁的方法。

有两个折线图(https://plot.ly/python/line-charts/),您可以在布局中添加线条(https://plot.ly/python/shapes/#vertical-and-horizo​​ntal -lines- Positioned-relative-to-the-axes),但这两种解决方案都需要单独添加每个线段,每个线段大约有 4-8 行代码。虽然我可以只 for 循环这个,但如果有人可以向我指出任何具有内置矢量化的内容,例如 matplotlib 解决方案(第一个链接),我将不胜感激!

编辑:还尝试了以下代码,首先将绘图设为 matplotlib,然后转换为plotly。线段在此过程中消失。开始认为这是不可能的。

mpl_fig = plt.figure()

# make matplotlib plot - WITH HLINES
plt.rcParams['figure.figsize'] = [5,5]
ax = mpl_fig.add_subplot(111)
ax.hlines(y=my_range, xmin=ordered_df['value1'], xmax=ordered_df['value2'], 
color='grey', alpha=0.4)
ax.scatter(ordered_df['value1'], my_range, color='skyblue', alpha=1, 
label='value1')
ax.scatter(ordered_df['value2'], my_range, color='green', alpha=0.4 , 
label='value2')
ax.legend()

# convert to plotly
plotly_fig = tls.mpl_to_plotly(mpl_fig)
plotly_fig['layout']['xaxis1']['showgrid'] = True
plotly_fig['layout']['xaxis1']['autorange'] = True
plotly_fig['layout']['yaxis1']['showgrid'] = True
plotly_fig['layout']['yaxis1']['autorange'] = True

# plot: hlines disappear :/
iplot(plotly_fig)
Run Code Online (Sandbox Code Playgroud)

python plotly jupyter-notebook plotly-python

8
推荐指数
2
解决办法
6240
查看次数

“更新”Kubernetes RBAC 权限有什么作用?

我怎么也找不到所有 Kubernetes RBAC 动词的作用的详细表格。我看到人们推荐的唯一资源就是这个,但它严重不足。

所以我一直在通过实验来解决这个问题。

到目前为止,大多数都相当简单,除了UPDATE. 这似乎无法完成我期望的任何事情。

我在命名空间中的[ ]上授予了我的别名: [ GET, ]权限UPDATEdeploymentsdefault

我尝试过的事情:

  • kubectl set image deployment/hello-node echoserver=digitalocean/flask-helloworld --as user
  • kubectl edit deploy hello-node --as user
  • kubectl apply -f hello-node.yaml --as eks-user

这些都失败并出现错误:deployments.apps "hello-node" is forbidden: User "user" cannot patch resource "deployments" in API group "apps" in the namespace "default"

然后我尝试了一些推出命令,例如:

  • k rollout undo deploy hello-node --as user

但他们失败了,因为我没有副本集访问权限。


TLDR: Kubernetes RBAC 动词的意义是什么update

就此而言,有人有所有 …

updates rbac kubernetes kubernetes-rbac

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