R绘图子批次警告';布局';对象不';我们没有这些属性:';NA';
我正在尝试组合两个绘图图形(R绘图子批次警告';布局';对象不';我们没有这些属性:';NA';,r,plotly,warnings,r-plotly,R,Plotly,Warnings,R Plotly,我正在尝试组合两个绘图图形(type='mesh3d'和type='scatter3d')。在没有任何警告的情况下,每个单独的绘图都是完美的。使用子绘图后,每次尝试显示绘图时都会出现警告 警告“布局”对象没有这些属性:“NA” 我已尝试抑制警告,但没有任何效果 你知道我在这里遗漏了什么来摆脱这个警告吗 绘图版本:4.9.3 R版本:4.0.1 # plot data plt_data <- data.frame(maturity=rep(1:10, each=10),
type='mesh3d'
和type='scatter3d'
)。在没有任何警告的情况下,每个单独的绘图都是完美的。使用子绘图后,每次尝试显示绘图时都会出现警告
警告“布局”对象没有这些属性:“NA”
我已尝试抑制警告
,但没有任何效果
你知道我在这里遗漏了什么来摆脱这个警告吗
绘图版本:4.9.3
R版本:4.0.1
# plot data
plt_data <- data.frame(maturity=rep(1:10, each=10),
tenor=rep(1:10, 10),
value=rnorm(100))
# plot 1
fig11 <- plot_ly(
data=plt_data, x=~maturity, y=~tenor, z = ~value,
type = "mesh3d",intensity = ~value,
colors = colorRamp(c(
rgb(168, 191, 173, max = 255),
rgb(100, 181, 117, max = 255),
rgb(0,100,80, max = 255)
)),
contour=list(show=T, width=4, color="#fff"),
showscale = F,
scene='scene1',
lighting = list(ambient = 0.9),
hoverinfo="skip",
source="myID"
)
# plot 2
fig12 <- plot_ly(
data=plt_data, x=~maturity, y=~tenor, z = ~value,
type = "scatter3d",
mode="markers",
hovertemplate="Maturity: %{x:.f}<br>Tenor: %{y:.f}<br>Value: %{z:.4f}<extra></extra>",
marker=list(
symbol="square-open",
size=4,
color="#3d543f"
),
scene='scene1',
source="myID",showlegend=F
)
# subplot which does throw a warning
subplot(fig11, fig12)
#绘图数据
plt_数据与警告有关。这里有一个解决方法来隐藏这种情况下的警告-
function_to_hide_plotly_warning <- function(...) {
plot <- subplot(...)
plot$x$layout <- plot$x$layout[grep('NA', names(plot$x$layout), invert = TRUE)]
plot
}
function_to_hide_plotly_warning(fig11, fig12)
用于R和Shinyapps的功能\u至\u隐藏\u绘图\u警告,以抑制以下警告:
选项(warn=-1)
我发现了这个公开问题,但无法将其翻译成R.Thx!