我尝试过插件transform-remove-strict-mode但它没有用。结果格式是生活,我在gulp中使用汇总(并且babel作为汇总插件)。
答案 0 :(得分:2)
在输出选项中使用strict : false
https://rollupjs.org/guide/en#command-line-reference
答案 1 :(得分:0)
将remove_rate
添加到汇总配置完成了工作
答案 2 :(得分:0)
只需确保在配置输出对象中指定import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objects as go
def get_data():
x = np.linspace(-1, 1, 10)
y = np.linspace(-1, 1, 10)
X, Y = np.meshgrid(x, y)
Z = np.array([[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291],
[2.58677481, 3.22528864, 3.65334814, 3.86669336, 3.86399048,
3.64525411, 3.21186215, 2.56819809, 1.72989472, 0.78569291]])
return X, Y, Z
# One-color arrows & arrowheads
colorscale = [
[0, "rgb(84,48,5)"],
[1, "rgb(84,48,5)"],
]
X, Y, Z = get_data()
data = {
key: {
"min": v.min(),
"max": v.max(),
"mid": (v.max() + v.min()) / 2,
"range": v.max() - v.min(),
}
for (key, v) in dict(x=X, y=Y, z=Z).items()
}
def get_arrow(axisname="x"):
# Create arrow body
body = go.Scatter3d(
marker=dict(size=1, color=colorscale[0][1]),
line=dict(color=colorscale[0][1], width=3),
showlegend=False, # hide the legend
)
head = go.Cone(
sizeref=0.1,
autocolorscale=None,
colorscale=colorscale,
showscale=False, # disable additional colorscale for arrowheads
hovertext=axisname,
)
for ax, direction in zip(("x", "y", "z"), ("u", "v", "w")):
if ax == axisname:
body[ax] = data[ax]["min"], data[ax]["max"]
head[ax] = [data[ax]["max"]]
head[direction] = [1]
else:
body[ax] = data[ax]["mid"], data[ax]["mid"]
head[ax] = [data[ax]["mid"]]
head[direction] = [0]
return [body, head]
def add_axis_arrows(fig):
for ax in ("x", "y", "z"):
for item in get_arrow(ax):
fig.add_trace(item)
def get_annotation_for_ax(ax):
d = dict(showarrow=False, text=ax, xanchor="left", font=dict(color="#1f1f1f"))
for ax_ in ("x", "y", "z"):
if ax_ == ax:
d[ax_] = data[ax]["max"] - data[ax]["range"] * 0.05
else:
d[ax_] = data[ax_]["mid"]
if ax in {"x", "y"}:
d["xshift"] = 15
return d
def get_axis_names():
return [get_annotation_for_ax(ax) for ax in ("x", "y", "z")]
def get_scene_axis(axisname="x"):
return dict(
title="", # remove axis label (x,y,z)
showbackground=False,
visible=True,
showticklabels=False, # hide numeric values of axes
showgrid=True, # Show box around plot
gridcolor="grey", # Box color
tickvals=[data[axisname]["min"], data[axisname]["max"]], # Set box limits
range=[
data[axisname]["min"],
data[axisname]["max"],
], # Prevent extra lines around box
)
fig = go.Figure(
data=[
go.Surface(
z=Z,
x=X,
y=Y,
opacity=0.6,
showscale=False, # Set to True to show colorscale
),
],
layout=dict(
title="surface",
autosize=True,
width=700,
height=500,
margin=dict(l=20, r=20, b=25, t=25),
scene=dict(
xaxis=get_scene_axis("x"),
yaxis=get_scene_axis("y"),
zaxis=get_scene_axis("z"),
annotations=get_axis_names(),
),
),
)
add_axis_arrows(fig)
fig.show()
。
strict: false
您可以在此处查看默认选项: https://rollupjs.org/guide/en/#configuration-files