问题标签 [ggalt]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
522 浏览

r - geom_lollipop(包 Ggalt)不工作

我正在关注如何使用的教程geom_lollipop,来自ggalt以下链接的包。

我试图运行的代码如下:

我的输出不是创建棒棒糖图,而是如下: 棒糖

看来这geom_lollipop行不通。此外,当我尝试计算 geom_lollipop 时,Rstudio 似乎在可用功能中找不到它。

我以为是包版本的问题,但是我已经更新了R并重新安装了上面的所有包。遵循正在使用的 R 和库的版本:

知道为什么这不起作用吗?

0 投票
1 回答
3119 浏览

r - 在 `R` 的 `ggalt::geom_dumbbell` 中为哑铃图添加传统传说

如何在使用ggalt::geom_dumbbellin创建的哑铃图中添加传统图例R

这个问题有一个图表图例的答案。如何映射美学以获得侧面/底部点的单独图例?

在此处输入图像描述

0 投票
1 回答
1721 浏览

r - 忽略未知参数:point.colour.1

我正在使用 ggplot2 和 ggalt 构建一个哑铃图,显示不同患者被诊断出患有某种疾病的时间点到他们死于该疾病的时间点。

我正在使用以下代码:

但是我收到以下警告消息:

谁能帮忙,我是否将“point.colour.1”等放在正确的位置?我想要做的就是改变“哑铃”两端点的颜色和大小

谢谢

structure(list(position = c(179403522, 179403566, 179404286, 179418418, 179418418, 179422457, 179425091, 179427963, 179433407, 179438874, 179440067, 179441649, 179442238, 179444429, 179454576, 179455162, 179456704, 179458085, 179469477, 179469477, 179470359, 179477004, 179487411, 179487411, 179487411, 179632576), Var1 = structure(c(4L, 5L, 6L, 22L, 22L, 26L, 33L, 36L, 45L, 50L, 51L, 54L, 56L, 60L, 66L, 69L, 70L, 74L, 78L, 78L, 80L, 85L, 93L, 93L, 93L, 103L), .Label = c("179395822", "179400405", "179401029", "179403522", "179403566", "179404286", "179404491", "179406990", "179408239", "179410544", "179410799", "179411339", "179412245", "179412902", "179413187", "179414153", "179414506", "179416474", "179416530", "179416531", "179417723", "179418418", "179419765", "179422231", "179422249", "179422457", "179422725", "179423314", "179424036", "179424398", "179424496", "179424782", "179425091", "179426073", "179426074", "179427963", "179428086", "179428871", "179429468", "179429849", "179430371", "179430544", "179432420", "179433213", "179433407", "179433665", "179433758", "179434009", "179435468", "179438874", "179440067", "179440319", "179441015", "179441649", "179441870", "179442238", "179442324", "179442793", "179443339", "179444429", "179444661", "179452242", "179452411", "179452435", "179453427", "179454576", "179454957", "179455112", "179455162", "179456704", "179457005", "179457392", "179458075", "179458085", "179462634", "179463684", "179466263", "179469477", "179469738", "179470359", "179471841", "179472127", "179472155", "179472209", "179477004", "179477169", "179477885", "179478861", "179478864", "179481600", "179485012", "179485829", "179487411", "179497039", "179497076", "179498055", "179506963", "179558736", "179591957", "179604264", "179605063", "179605941", "179632576", "179634455", "179644174", "179658189", "179658211"), class = "factor"), Freq = c(3L, 4L, 1L, 4L, 4L, 1L, 1L, 5L, 4L, 14L, 1L, 1L, 5L, 1L, 2L, 1L, 34L, 5L, 5L, 5L, 4L, 1L, 8L, 8L, 8L, 3L), Mutation.Type = structure(c(6L, 6L, 6L, 6L, 6L, 6L, 6L, 2L, 6L, 2L, 2L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 2L, 2L, 2L, 2L, 6L, 6L, 6L, 6L), .Label = c("", "Deletion", "Deletion/Insetion", "Duplication", "Insertion", "Substitution"), class = "factor"), Functional.Domain = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), .Label = c("M-band", "A-band", "I-band", "Z-disk"), class = "factor"), AAA = c(179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179400709, 179483311, 179483311, 179483311, 179483311 ), BBB = c(179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179483218, 179639929, 179639929, 179639929, 179639929), Deaceased = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Y", class = "factor"), Age.Dx = c(52, 47.9, 43, 47.9, 47.9, 30, 35, 47.9, 47.9, 59, 37, 37, 47.9, 49, 20, 25, 47.9, 47.9, 47.9, 47.9, 47.9, 46, 47.9, 47.9, 47.9, 47.9), Current.age = c(58L, 49L, 50L, 68L, 72L, 38L, 40L, 35L, 67L, 63L, 55L, 42L, 44L, 55L, 37L, 28L, 33L, 43L, 18L, 50L, 30L, 49L, 68L, 75L, 58L, 66L), Mutation = structure(c(68L, NA, 23L, 52L, 52L, 96L, 18L, 83L, 49L, 3L, 46L, 56L, NA, 14L, 11L, 32L, NA, 13L, 44L, 44L, 70L, 69L, 6L, 6L, 6L, 100L ), .Label = c("p.Ala12675", "p.Ala12873fs", "p.Ala22353fs", "p.Ala29119Leufs*17", "p.Ala486Serfs*26", "p.Arg14967*", "p.Arg16695*", "p.Arg17736*", "p.Arg18056*", "p.Arg18858X", "p.Arg18985X", "p.Arg19560X", "p.Arg19618Glufs*6", "p.Arg20858X", "p.Arg21009*", "p.Arg21209*", "p.Arg22817*", "p.Arg26949X", "p.Arg29415X", "p.Arg30857", "p.Arg31056*", "p.Arg31126fs", "p.Arg31195X", "p.Arg31606*", "p.Arg35174Alafs*4", "p.Asn30367Lysfs*3", "p.Asn30734Glnfs*17", "p.Asp14909", "p.Asp16007Profs*19", "p.Asp16122", "p.Cys13771X", "p.Cys18789X", "p.Gln20809*", "p.Gln24059fs", "p.Gln25689X", "p.Gln25732*", "p.Gln26147*", "p.Gln27004*", "p.Gln30081X", "p.Gln4249X", "p.Glu14779fs", "p.Glu15206*", "p.Glu17978fs", "p.Glu18113Aspfs*10", "p.Glu18141", "p.Glu21956fs", "p.Glu23066Glyfs*8", "p.Glu23514*", "p.Glu25818*", "p.Glu27300", "p.Glu29510X", "p.Glu29772*", "p.Gly10159", "p.Gly16189X", "p.Gly18918Valfs*17", "p.Gly21497", "p.Gly30648Valfs*", "p.Gly4007Glufs*7", "p.Gly4300Argfs*3", "p.His18335", "p.Ile20447*", "p.Ile26829Metfs*15", "p.Lys14528*", "p.Lys17753Asnfs*7", "p.Lys18487Serfs*3", "p.Lys21640fs", "p.Lys27131*", "p.Lys31371X", "p.Phe15108fs", "p.Pro17886*", "p.Pro29241Leufs*24", "p.Ser1248Profs*14", "p.Ser24241fs", "p.Ser25617Cysfs*18", "p.Ser27179fs", "p.Ser28693Ilefs*2", "p.Ser28958Lysfs*10", "p.Ser29255Alafs*18", "p.Ser31841X", "p.Ser493*", "p.Ser6394fs", "p.Thr21135", "p.Thr27632Serfs*5", "p.Thr28262Lysfs*38", "p.Thr28262Lysfs*39", "p.Thr29725fs", "p.Thr30165", "p.Thr30513fs", "p.Trp27147X", "p.Trp27591*", "p.Trp29474*", "p.Trp976Arg", "p.Trp976Arg/ p.Arg19560X", "p.Tyr16421*", "p.Tyr21301", "p.Tyr27567X", "p.Tyr28326fs", "p.Tyr2951", "p.Tyr30384*", "p.Tyr3127*", "p.Val11879", "p.Val11879 p.Asp18235", "p.Val25131Leufs*16", "p.Val26772*", "p.Val33646Hisfs*26" ), class = "factor")), .Names = c("position", "Var1", "Freq", "Mutation.Type", "Functional.Domain", "AAA", "BBB", "Deaceased", "Age.Dx", "Current.age", "Mutation"), row.names = c(NA, -26L), class = "data.frame")

0 投票
2 回答
939 浏览

r - 向 ggalt::geom_dumbbell 绘图添加图例并对 y 轴进行排序

这个 SO 答案中,用户 @Crops 展示了如何将图例添加到ggalt::geom_dumbbell绘图中。非常好。

在此处输入图像描述

我想trt按降序排序r。我尝试用 替换y = trty = reorder(trt, r)但我收到一个错误,即r找不到对象。

0 投票
2 回答
398 浏览

r - 在 ggalt 包中使用“geom_xspline”时的空白绘图输出

当尝试将geom_xsplinefromggaltggarrangefrom结合使用时ggpubr,输出为空白,并且在使用 清除之前无法制作其他绘图dev.off()

在我的用例中,我希望geom_xspline替换geom_line我的 ggplot 对象中的一些存在。有人知道使用从其他 R 包添加的 geoms 的问题吗?

这是一些要比较的代码,实际上没有什么有趣的,只是为了给出一个可重现的示例:

初始工作代码 w/ogeom_xspline

ggalt打包失败的代码

替代方法ggarrange我没有尝试使用此链接中的函数 ,grid_arrange_shared_legend函数使用gridand gridExtra。但是,我仍然很好奇为什么ggarrange不起作用。

这是我的会话信息:

快速添加,如果我将对象转换为 a ggplotGrob(),它将与 一起使用ggarrange,但当我尝试使用时它会失败common.legend = T

0 投票
1 回答
262 浏览

r - 如何以 x 轴为因子绘制平滑线 (ggalt::xspline) 图

我有以下数据框:

我想要做的是平滑情节。下面是我使用的代码:

它产生以下情节: 在此处输入图像描述

请注意,虚线是ggalt::geom_xspline()的预期平滑线。

我打算 x 轴的顺序是: c("NT", "IBD+PBS", "IBD+Serpin") 因此它们被编码为一个因素。

我怎样才能让它像这样顺利呢?但使用预期的 x 轴顺序:

在此处输入图像描述

0 投票
0 回答
247 浏览

r - 在 ggplot 哑铃图中添加图例

我在下面创建了一个哑铃图,我想根据显示x和的点的颜色添加一个图例xend。哑铃可以吗?

0 投票
2 回答
405 浏览

r - 基于变量的ggplot颜色轴标签

我有一个名为 df_plot 的数据框,我正在尝试创建一个按列排序的哑铃图(2020 年中龄),轴根据另一个类别分配了颜色)。这非常接近,但有人可以向我解释为什么轴上的颜色不匹配吗?正如您从数据框中看到的那样,所罗门群岛应该是红色的,但它们被输出为绿色?

非常感谢任何提示

图像颜色错误

名为 df_plot 的数据框

(我不确定您如何将数据帧添加到 stackoverflow 中,因此在此处复制标题 - 图片解释了结构。唯一的区别是我已将颜色更改为十六进制代码)

0 投票
2 回答
149 浏览

r - geom_dumbbel 图的问题给了我多个点而不是单点

在此处输入图像描述

我的哑铃图在我的图表上给了我多个点,我想知道为什么。我以为我应该得到一个点。我尝试编辑参数但无济于事。这使得添加其他美学变得困难。我将不胜感激。

0 投票
3 回答
117 浏览

r - 在以特定顺序重新排序数据后,在 R 中格式化几何哑铃图

我想要顶部的保留试验和底部的转移试验。我尝试重新排序数据,但它做的与我想要的完全相反。因此,顶部的灰色线条和底部的黑色线条。

我想要顶部的保留试验和底部的转移试验。我尝试重新排序数据,但它做的与我想要的完全相反。因此,顶部的灰色线条和底部的黑色线条。

当前地块