geom_contour_filled色阶不对应中断

问题描述

我想根据大于数据范围的中断范围绘制带有颜色的轮廓填充,以便不同的图具有相同的比例。在下面的示例中,预期蓝色和红色分别对应于更多的负值或正值。但是,当绘图不包含整个范围时,geom_contour_filled会识别中断但与色标不匹配。因此,正值全是蓝色。

library(ggplot2)

grid <- expand.grid(x=0:10,y=0:10)
grid$z <- with(grid,x*y) # 0 to 100 does not work as expected
# grid$z <- with(grid,2*x*y-100) # -100 to 100 works as expected

ggplot(grid,aes(x=x,y=y,z=z)) +
  scale_colour_manual( aesthetics = 'fill',values = colorRampPalette(c('blue','white','red'))(20) ) +
  geom_contour_filled( breaks=floor(seq(-100,100,length.out=20)) )

解决方法

您需要在色阶中添加var element = document.getElementById('edit_pickup_date_modal'); var input = element.getElementsByName('type')[0]; input.value = '2'

df['member_name']=np.where(df['Certificacion'].isna(),df['full_name'],df['full_name']+','+df['Certificacion'])

enter image description here