寻求 ggplot 2.2.0 破坏的 gtable_add_grob 代码的解决方法

2024-01-06

在具有多个方面变量的图中,ggplot2 重复“外部”变量的方面标签,而不是在“内部”变量的所有级别上使用单个跨越方面带。我有一些代码,我一直在使用这些代码来使用单个跨越小平面条来覆盖重复的外小平面标签gtable_add_grob来自gtable包裹。

不幸的是,由于构面条的 grob 结构发生了变化,此代码不再适用于 ggplot2 2.2.0。具体来说,在 ggplot2 的早期版本中,每行分面标签都有自己的一组 grobs。然而,在版本 2.2.0 中,每个垂直的构面标签堆栈看起来都是一个单独的 grob。这破坏了我的代码,我不知道如何修复它。

这是一个具体的例子,取自我几个月前回答过的一个问题 https://stackoverflow.com/questions/36968581/ggplot2-boxplot-with-colors-and-text-labels-mapped-to-combination-of-two-catego/36971938#36971938:

# Data
df = structure(list(location = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L), .Label = c("SF", "SS"), class = "factor"), species = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("AGR", "LKA"), class = "factor"), 
        position = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
        2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
        1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
        2L), .Label = c("top", "bottom"), class = "factor"), density = c(0.41, 
        0.41, 0.43, 0.33, 0.35, 0.43, 0.34, 0.46, 0.32, 0.32, 0.4, 
        0.4, 0.45, 0.34, 0.39, 0.39, 0.31, 0.38, 0.48, 0.3, 0.42, 
        0.34, 0.35, 0.4, 0.38, 0.42, 0.36, 0.34, 0.46, 0.38, 0.36, 
        0.39, 0.38, 0.39, 0.39, 0.39, 0.36, 0.39, 0.51, 0.38)), .Names = c("location", 
    "species", "position", "density"), row.names = c(NA, -40L), class = "data.frame")

# Begin with a regular ggplot with three facet levels
p=ggplot(df, aes("", density)) + 
  geom_boxplot(width=0.7, position=position_dodge(0.7)) + 
  theme_bw() +
  facet_grid(. ~ species + location +  position) +
  theme(panel.margin=unit(0,"lines"),
        strip.background=element_rect(color="grey30", fill="grey90"),
        panel.border=element_rect(color="grey90"),
        axis.ticks.x=element_blank()) +
  labs(x="")

我们从一个具有三个层面的情节开始。

现在我们将用跨越条覆盖顶部的两个小面条,这样我们就不会出现重复的条标签:

pg = ggplotGrob(p)

# Add spanning strip labels for species
pos = c(4,11)    
for (i in 1:2) {
  pg <- gtable_add_grob(pg, 
                        list(rectGrob(gp=gpar(col="grey50", fill="grey90")),
                             textGrob(unique(densityAGRLKA$species)[i], 
                                      gp=gpar(cex=0.8))), t=3,l=pos[i],b=3,r=pos[i]+7,
                        name=c("a","b"))
}

# Add spanning strip labels for location
pos=c(4,7,11,15)
for (i in 1:4) {
    pg = gtable_add_grob(pg, 
                         list(rectGrob(gp = gpar(col="grey50", fill="grey90")),
                              textGrob(rep(unique(densityAGRLKA$location),2)[i], 
                                       gp=gpar(cex=0.8))), t=4,l=pos[i],b=4,r=pos[i]+3, 
                         name = c("c","d"))
}

grid.draw(pg)

这是 ggplot2 2.1.0 中该图的样子:

但是,如果我在 ggplot2 2.2.0 上尝试相同的代码,我会得到原始图,条带标签没有任何变化。看看原图的grob结构p表明为什么会发生这种情况。我已将 grob 表粘贴到这个问题的底部。为了节省空间,我仅包含与面条相关的行。

看着cells请注意,在 2.1.0 版本的绘图中,每行中的前两个数字是 3、4 或 5,表示该对象相对于绘图中其他对象的垂直位置。在上面的代码中,t and l论点gtable_add_grob设置为值 3 或 4,因为这些是我想用跨越条覆盖的面条行。

现在看看cells2.2.0 版本图中的列:请注意,前两个数字始终为 6。另请注意,小面条仅由 8 个小块组成,而不是 2.1.0 版本中的 24 个小块。在版本 2.2.0 中,似乎每堆三个方面标签现在都是一个单独的 grob,而不是三个单独的 grob。所以即使我改变t and b中的论点gtable_add_grob到6,所有三个小面条都被覆盖。这是一个例子:

pg = ggplotGrob(p)

# Add spanning strip labels for species
pos = c(4,11)    
for (i in 1:2) {
  pg <- gtable_add_grob(pg, 
                        list(rectGrob(gp=gpar(col="grey50", fill="grey90")),
                             textGrob(unique(densityAGRLKA$species)[i], 
                                      gp=gpar(cex=0.8))), t=6,l=pos[i],b=6,r=pos[i]+7,
                        name=c("a","b"))
}

因此,在冗长的介绍之后,这是我的问题:如何使用 ggplot2 版本 2.2.0 创建跨越面条,它看起来像我使用创建的那样gtable_add_grobggplot2 版本 2.1.0?我希望有一个简单的调整,但如果需要大手术,那也没关系。

ggplot2.1.0

pg
TableGrob (9 x 19) "layout": 45 grobs
    z         cells       name                                   grob
2   1 ( 3- 3, 4- 4)  strip-top   absoluteGrob[strip.absoluteGrob.147]
3   2 ( 4- 4, 4- 4)  strip-top   absoluteGrob[strip.absoluteGrob.195]
4   3 ( 5- 5, 4- 4)  strip-top   absoluteGrob[strip.absoluteGrob.243]
5   4 ( 3- 3, 6- 6)  strip-top   absoluteGrob[strip.absoluteGrob.153]
6   5 ( 4- 4, 6- 6)  strip-top   absoluteGrob[strip.absoluteGrob.201]
7   6 ( 5- 5, 6- 6)  strip-top   absoluteGrob[strip.absoluteGrob.249]
8   7 ( 3- 3, 8- 8)  strip-top   absoluteGrob[strip.absoluteGrob.159]
9   8 ( 4- 4, 8- 8)  strip-top   absoluteGrob[strip.absoluteGrob.207]
10  9 ( 5- 5, 8- 8)  strip-top   absoluteGrob[strip.absoluteGrob.255]
11 10 ( 3- 3,10-10)  strip-top   absoluteGrob[strip.absoluteGrob.165]
12 11 ( 4- 4,10-10)  strip-top   absoluteGrob[strip.absoluteGrob.213]
13 12 ( 5- 5,10-10)  strip-top   absoluteGrob[strip.absoluteGrob.261]
14 13 ( 3- 3,12-12)  strip-top   absoluteGrob[strip.absoluteGrob.171]
15 14 ( 4- 4,12-12)  strip-top   absoluteGrob[strip.absoluteGrob.219]
16 15 ( 5- 5,12-12)  strip-top   absoluteGrob[strip.absoluteGrob.267]
17 16 ( 3- 3,14-14)  strip-top   absoluteGrob[strip.absoluteGrob.177]
18 17 ( 4- 4,14-14)  strip-top   absoluteGrob[strip.absoluteGrob.225]
19 18 ( 5- 5,14-14)  strip-top   absoluteGrob[strip.absoluteGrob.273]
20 19 ( 3- 3,16-16)  strip-top   absoluteGrob[strip.absoluteGrob.183]
21 20 ( 4- 4,16-16)  strip-top   absoluteGrob[strip.absoluteGrob.231]
22 21 ( 5- 5,16-16)  strip-top   absoluteGrob[strip.absoluteGrob.279]
23 22 ( 3- 3,18-18)  strip-top   absoluteGrob[strip.absoluteGrob.189]
24 23 ( 4- 4,18-18)  strip-top   absoluteGrob[strip.absoluteGrob.237]
25 24 ( 5- 5,18-18)  strip-top   absoluteGrob[strip.absoluteGrob.285]

ggplot2 2.2.0

pg
TableGrob (11 x 21) "layout": 42 grobs
    z         cells       name                                    grob
28  2 ( 6- 6, 4- 4)  strip-t-1                           gtable[strip]
29  2 ( 6- 6, 6- 6)  strip-t-2                           gtable[strip]
30  2 ( 6- 6, 8- 8)  strip-t-3                           gtable[strip]
31  2 ( 6- 6,10-10)  strip-t-4                           gtable[strip]
32  2 ( 6- 6,12-12)  strip-t-5                           gtable[strip]
33  2 ( 6- 6,14-14)  strip-t-6                           gtable[strip]
34  2 ( 6- 6,16-16)  strip-t-7                           gtable[strip]
35  2 ( 6- 6,18-18)  strip-t-8                           gtable[strip]

事实上,ggplot2 v2.2.0 逐列构造复杂的条带,每列一个单独的 grob。这可以通过提取一条条带然后检查其结构来检查。使用你的情节:

library(ggplot2)
library(gtable)
library(grid)

# Your data
df = structure(list(location = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
 2L, 2L), .Label = c("SF", "SS"), class = "factor"), species = structure(c(1L, 
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("AGR", "LKA"), class = "factor"), 
    position = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 
    1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
    2L), .Label = c("top", "bottom"), class = "factor"), density = c(0.41, 
    0.41, 0.43, 0.33, 0.35, 0.43, 0.34, 0.46, 0.32, 0.32, 0.4, 
    0.4, 0.45, 0.34, 0.39, 0.39, 0.31, 0.38, 0.48, 0.3, 0.42, 
    0.34, 0.35, 0.4, 0.38, 0.42, 0.36, 0.34, 0.46, 0.38, 0.36, 
    0.39, 0.38, 0.39, 0.39, 0.39, 0.36, 0.39, 0.51, 0.38)), .Names = c("location", 
   "species", "position", "density"), row.names = c(NA, -40L), class = "data.frame")

# Your ggplot with three facet levels
p=ggplot(df, aes("", density)) + 
  geom_boxplot(width=0.7, position=position_dodge(0.7)) + 
  theme_bw() +
  facet_grid(. ~ species + location +  position) +
  theme(panel.spacing=unit(0,"lines"),
     strip.background=element_rect(color="grey30", fill="grey90"),
     panel.border=element_rect(color="grey90"),
     axis.ticks.x=element_blank()) +
  labs(x="")

# Get the ggplot grob
pg = ggplotGrob(p)

# Get the left most strip
index = which(pg$layout$name == "strip-t-1")
strip1 = pg$grobs[[index]]

# Draw the strip
grid.newpage()
grid.draw(strip1)

# Examine its layout
strip1$layout
gtable_show_layout(strip1)

使外部条带标签“跨越”内部标签的一种粗略方法是从头开始构建条带:

# Get the strips, as a list, from the original plot
strip = list()
for(i in 1:8) {
   index = which(pg$layout$name == paste0("strip-t-",i))
   strip[[i]] = pg$grobs[[index]]
}

# Construct gtable to contain the new strip
newStrip  = gtable(widths = unit(rep(1, 8), "null"), heights = strip[[1]]$heights)

## Populate the gtable    
# Top row
for(i in 1:2) {
   newStrip = gtable_add_grob(newStrip, strip[[4*i-3]][1], 
           t = 1, l = 4*i-3, r = 4*i)
}

# Middle row
for(i in 1:4){
   newStrip = gtable_add_grob(newStrip, strip[[2*i-1]][2], 
         t = 2, l = 2*i-1, r = 2*i)
}

# Bottom row
for(i in 1:8) {
   newStrip = gtable_add_grob(newStrip, strip[[i]][3], 
       t = 3, l = i)
}

# Put the strip into the plot 
# (It could be better to remove the original strip. 
# In this case, with a coloured background, it doesn't matter)
pgNew = gtable_add_grob(pg, newStrip, t = 7, l = 5, r = 19)

# Draw the plot
grid.newpage()
grid.draw(pgNew)

OR使用矢量化 gtable_add_grob (参见评论):

pg = ggplotGrob(p)

# Get a list of strips from the original plot
strip = lapply(grep("strip-t", pg$layout$name), function(x) {pg$grobs[[x]]})

# Construct gtable to contain the new strip
newStrip  = gtable(widths = unit(rep(1, 8), "null"), heights = strip[[1]]$heights)

## Populate the gtable    
# Top row
cols = seq(1, by = 4, length.out = 2)
newStrip = gtable_add_grob(newStrip, lapply(strip[cols], `[`, 1), t = 1, l = cols, r = cols + 3)

# Middle row
cols = seq(1, by = 2, length.out = 4)
newStrip = gtable_add_grob(newStrip, lapply(strip[cols], `[`, 2), t = 2, l = cols, r = cols + 1)

# Bottom row
newStrip = gtable_add_grob(newStrip, lapply(strip, `[`, 3), t = 3, l = 1:8)

# Put the strip into the plot
pgNew = gtable_add_grob(pg, newStrip, t = 7, l = 5, r = 19)

# Draw the plot
grid.newpage()
grid.draw(pgNew)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

寻求 ggplot 2.2.0 破坏的 gtable_add_grob 代码的解决方法 的相关文章

  • 多功能测试仪替代 system.time

    我已经看到 我认为是这样 使用了类似于 system time 的函数 它可以同时评估多个函数的时间并输出一个输出 我不记得它是什么 并且用我正在使用的术语进行互联网搜索并没有得到我想要的响应 有人知道我正在谈论的功能的名称 位置吗 你想要
  • 通过间接引用列来修改数据框中的某些值

    我正在整理一些数据 我们将失败的数据分类到垃圾箱中 并按批次计算每个分类箱的有限产量 我有一个描述排序箱的元表 这些行按升序测试顺序排列 一些排序标签带有非语法名称 sort tbl lt tibble tribble weight lab
  • 如何使用 usmap 标记数字而不是名称?

    我知道 usmap 有一个选项label in plot usmap 我想标记一些数字 而不是状态名称 我想 usmap 中应该有与州质心坐标相关的数据 但我不知道如何找到它 如果我能得到 坐标然后我可以用它来标记数字geom text 这
  • pyomo + 网状错误 6 句柄无效

    我正在尝试运行pyomo优化 我收到错误消息 Error 6 The handle is invalid 不知道如何解释它 环顾四周似乎与特权有关 但我不太明白 在下面找到完整的错误跟踪以及重现它的玩具示例 完整的错误跟踪 py run f
  • twitterR 和 ROAuth R 软件包安装

    我在安装 CRAN 上的 twitteR 和 RAOuth 软件包时遇到一些问题 我尝试了几种不同的方法 在 Windows 下使用源代码 在 Ubuntu 下使用 RStudio 我尝试了以下命令 sudo apt get install
  • 为什么 dplyr filter() 不能在函数内工作(即使用变量作为列名)?

    使用 dplyr 函数对数据进行过滤 分组和变异的函数 基本管道序列在函数之外工作得很好 这就是我使用真实列名称的地方 将其放入一个函数中 其中列名称是一个变量 并且某些函数可以工作 但有些函数则不能 尤其是 dplyr filter 例如
  • 以引用透明的方式从函数的省略号参数中提取符号

    事情又发生了 我正要按下发布答案按钮的问题被删除了 我正在寻找一种方法来从函数的省略号参数中提取绑定到符号的对象的值以及符号 也就是说 我试图以引用透明的方式从省略号中提取符号 我尝试过使用替代品和lazy dots 但没有成功 funct
  • R 中的列乘以子字符串

    假设我有一个数据框 其中包含多个组件及其在多个列中列出的属性 并且我想对这些列运行多个函数 我的方法是尝试将其基于每个列标题中的子字符串 但我无法弄清楚如何做到这一点 下面是数据框的示例 Basket F Type 1 F Qty 1 F
  • 将每列的值乘以 R 中另一个 data.frame 中的权重

    我有两个data frames df and weights 代码如下 df看起来像这样 id a b d EE f 1 this 0 23421153 0 02324956 0 5457353 0 73068586 0 5642554 2
  • 如何在 R 或 Python 中制作旭日图?

    到目前为止 我一直无法找到一个可以创建旭日图的 R 库约翰 斯塔斯科 http www cc gatech edu gvu ii sunburst 有人知道如何在 R 或 Python 中实现这一点吗 在极坐标投影中使用 matplotli
  • ggplot2:如何标记事件发生的日期

    我想从第二个情节中获取第一个情节的信息 第二张图表示事件发生的天数 它看起来更宽 因为它没有图例 但它是相同的时间尺度 我选择在第一个图中手动分配颜色 I would like to overlay the second plot dots
  • R 中用于调用 sed、rsync、ssh 等的 system() 的替代方案:函数是否存在,我应该编写自己的函数,还是我错过了重点?

    最近 我发现了base files命令 与其他命令一起使用 例如getwd write lines file show dir等等 似乎有许多 bash 函数的 R 等价物 我还在 R 中编写了一些函数来简化对ssh and rsync通过
  • applyStrategy 错误

    我是R新手 最近运行后遇到以下错误applyStrategy函数来自quantstrat包裹 Error in eval expr envir enclos object signal not found Error in colnames
  • 使用 template.docx 从 Shiny App 编织 Word 文档

    我正在尝试使用 template docx 文件从闪亮的应用程序编写一个 Word 文档 我收到以下错误消息 pandoc exe template docx openBinaryFile 不存在 没有这样的文件或目录 以下 3 个文件当前
  • 闭包作为数据合并习惯的解决方案

    我正在尝试解决闭包问题 而且我think我发现了一个案例 他们可能会有所帮助 我有以下几部分需要处理 一组正则表达式 旨在清理状态名称 位于函数中 具有州名称 上述函数创建的标准化形式 和州 ID 代码的 data frame 用于链接两者
  • Shiny:动态数据框构建; renderUI、观察、reactiveValues

    我认为如何使用 Shiny 的 renderUI 功能动态子集数据的问题经常出现 但我很难理解何时使用 renderUI 带有 uiOutput 而不是其他功能 包括观察 反应 反应值甚至条件面板 我想构建一个完全交互式的数据框架 其中每个
  • 如何使用 tidymodels 和工作流集在同一数据集上拟合多个不同的线性模型

    我想评估同一数据集上多个 主要是 线性回归模型的性能 我想也许使用tidymodels包连同workflowsets workflow set 可能会起作用 我按照这个例子here https workflowsets tidymodels
  • 无法更改 RStudio 中的 R 版本

    我的 RStudio V 0 99 491 无法更改 R 版本 我以平常的方式行事Global Options gt R Version 然后它挂起并且不再工作或反应 R 运行良好的初始版本是R 3 1 0 我以前从未遇到过这样的问题 也许
  • 如何修复 R 中 Kaplan Meier 图的风险表计算错误

    以下是一个数据帧 其中 6 个参与者中的每一个都有唯一的 record ID 我想绘制一个生存分析图 其中包含感兴趣事件的复发以及在时间间隔 tstart 到 tstop 内 暴露 药物剂量 数值变量 的时间依赖性协变量 每个参与者的最大
  • 麦当劳 omega:R 中的警告

    我正在计算几种不同尺度的欧米茄 并在 R 中使用不同的 omega 函数获取不同比例的不同警告消息 我的问题是如何解释这些警告以及报告检索到的 omega 统计数据是否安全 当我使用 从 alpha 到 omega 内部一致性估计普遍问题的

随机推荐

  • 在哪里可以找到“SIP Communicator”库[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我正在为 Android 开发 Sip 客户端 我需要这个库来完成我的项目 有一个使用这个库的开源代码 但我在任何地方都找不到它 一款知名
  • Django - 在基于类的视图上使用reverse()

    我的 Django 项目中有以下 url 配置 urlpatterns patterns r my view MyViewClass as view 有没有办法使用reverse 函数获取上面视图的url 就在这里 Use the name
  • TransactionScope 和 Npgsql - 准备好的事务问题

    我有以下代码 using TransactionScope tScope new TransactionScope using NpgsqlConnection myConnection new NpgsqlConnection MyCon
  • 将 RecyclerView 锚定在折叠工具栏布局上稍高的位置 [重复]

    这个问题在这里已经有答案了 是否可以将 RecyclerView 锚定在比通常位置高一点的位置 就像大多数可折叠视图上的 FAB 图标一样 有关预期结果 请参见图 1 Image 1 我尝试了以下代码 但它没有给出预期结果 有关当前结果 请
  • 批量分配令牌

    我有以下问题 我正在从数据库中读取字段 这些字段并非都是必填字段 因此 并非所有内容都已填写 我遇到的问题是 Batch ms dos 和 Tokens 函数 让我举一个例子 有问题的字段如下 示例 First Name John Last
  • 如何在 XAML 中注入转换器

    我有一个 IValueConverter 实现的类 我需要使用我的 DI 容器 Ninject 注入它 问题是 在 XAML 中 没有立即明显的方法来控制 Converter 对象的实例化 所以我的 XAML 包含这样一行 Source 绑
  • for 循环的限制是计算一次还是每次循环都计算?

    以下循环中的限制 12332 324234 是计算一次还是每次循环运行时计算 for int i 0 i lt 12332 324234 i Do something 为此 计算一次 或更可能计算 0 次 编译器将为您优化乘法 然而 如果你
  • 发布者订阅者模式的现代替代方案

    我有一个 C Windows 应用程序 我正在处理发布者 订阅者的情况 其中我的一个类 发布者 定期生成数据并将其传递给另一个类 订阅者 该类不断等待接收来自发布者的通知 我是设计模式的新手 我查找了发布者订阅者模型的常见实现 我注意到它们
  • jquery 如果鼠标悬停

    我有一个带有悬停功能的 img 来显示元素 其中一些新元素与 img 重叠 因此如果我将鼠标悬停在新元素上 因为光标不再位于 img 上 该元素会隐藏自身 然后立即重新出现 因为光标再次位于 img 上 如果光标位于新元素内的 img 上
  • Pandas,groupby 并找到组中的最大值,返回值和计数

    我有一个带有日志数据的 pandas DataFrame host service 0 this com mail 1 this com mail 2 this com web 3 that com mail 4 other net mai
  • 是否可以在 Firebase 托管上托管 Express 和 socket.io 应用程序?

    我关注 Firebase 云功能已经有一段时间了 最近 我发现在 Firebase Hosting 上托管 Node js 应用程序 但它仅使用 Express 我们可以在 Firebase 上托管 socket io 应用吗 Fireba
  • 部分 Fragment 项目隐藏在操作栏下

    我正在学习 android 开发 我的问题可能很简单 我被困在下面的部分并请求你的帮助 描述 我正在使用android默认的 导航抽屉 活动来实现一个小项目 我创建了一个片段 当用户从导航抽屉中选择一个选项时 该片段将打开 面临的问题 Wh
  • Python3 - Matplotlib FuncAnimation 连续内存泄漏

    EDIT2 因此 经过更多的工作 我创建了最小的样本 它在每台机器上都相当不错地重现了 Memoryleak 这段代码只是创建一个 TKinter 窗口和一个带有 3 个正弦波的 matplotlib 画布 然后尝试制作动画 看到 blit
  • 在 laravel 8 上安装 laravel/jetstream 失败

    通过composer安装jetstream后composer require laravel jetstream然后突然得到一个ErrorException 没有这样的文件或目录 Writing lock file Generating o
  • 使用 JAXB 解组 XML

    我有一个 XML 文件 我正在尝试对其进行解组 但我不知道如何执行此操作 XML 看起来像
  • 致命错误:webp 不支持调色板图像

    我保存的是png图像webp使用以下代码格式化但有时显示 致命错误 webp 不支持调色板图像 所以 请给我建议 im imagecreatetruecolor 120 20 text color imagecolorallocate im
  • 如何在没有手动限制的情况下在一侧扩展 ggplot 条形刻度而不是另一侧

    目标是消除刻度线和条形底部之间的空间 而不切断条形另一端之外的任何百分比标签 我正在使用 R 的 ggplot2 运行数十个条形图 并尝试遵循我们的组织风格指南 该指南是使用 Excel 手动为每个图表开发的 不同图表中的最大长度条的长度不
  • 在服务器端为 ColdFusion 实现 Showdown.js markdown 解析器

    这是一个 事实调查 问题 旨在了解使用以下命令创建 ColdFusion UDF 来解析服务器上的 markdown 有多困难 showdown js 解析器 http attacklab net showdown 已经有一个利用 show
  • 如何激活Dataflow Shuffle服务?

    我正在尝试使用数据流洗牌服务 https cloud google com dataflow service dataflow service desc cloud dataflow shuffle在 python 环境中 但似乎 shuf
  • 寻求 ggplot 2.2.0 破坏的 gtable_add_grob 代码的解决方法

    在具有多个方面变量的图中 ggplot2 重复 外部 变量的方面标签 而不是在 内部 变量的所有级别上使用单个跨越方面带 我有一些代码 我一直在使用这些代码来使用单个跨越小平面条来覆盖重复的外小平面标签gtable add grob来自gt