小编Arc*_*rch的帖子

ggplot 2中的多行标题,带有多个斜体字

我试图创建一个手动格式化在两行上的情节标题,其中包括两个斜体字,我已经 在Stack Exchange上做了一些搜索但是没有找到一个很好的解决方案来解决这个看似简单的问题.

这两个物种的科学名称相当长,因此需要多行标题(ggplot2不会对此进行格式化).

目的:

..........第一行标题与物种

第二行的话是另一种语言的结尾

ggplot(mtcars,aes(x=wt,y=mpg))+
  geom_point()+
  labs(title= expression(paste(atop("First line of title with ", atop((italic("Species")))),"
       secondline words", italic("anotherSpecies"), "the end")))
Run Code Online (Sandbox Code Playgroud)

产生以下错位标题:

在此输入图像描述

plot r ggplot2

11
推荐指数
2
解决办法
3172
查看次数

绘制相同数据的GLM和LM

我想绘制相同数据的线性模型(LM)和非线性(GLM)模型.

LM和GLM之间的范围应在16%-84%之间,引用:第3.5节

我已经包含了更完整的代码块,因为我不确定在哪一点上我应该尝试削减线性模型.或者我搞砸了 - 我想用线性模型.

下面的代码会产生以下图像: 以下代码的输出

我的目标(摘自以前的引文链接).

通缉

这是我的数据:

mydata3 <- structure(list(
               dose = c(0, 0, 0, 3, 3, 3, 7.5, 7.5, 7.5, 10,     10, 10, 25, 25, 25, 50, 50, 50), 
               total = c(25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L, 25L), 
               affected = c(1, 0, 1.2, 2.8, 4.8, 9, 2.8, 12.8, 8.6, 4.8, 4.4, 10.2, 6, 20, 14, 12.8, 23.4, 21.6), 
               probability = c(0.04, 0, 0.048, 0.112, …
Run Code Online (Sandbox Code Playgroud)

r linear-regression ggplot2 logistic-regression drc

2
推荐指数
1
解决办法
375
查看次数

绘制对数刻度(使用渐近线)和ggplot2中的零

我正在绘制具有渐近尾部的剂量 - 反应曲线.我真的想在显示0的图中包括载体(对照)剂量

0通常计算为.0000000001的剂量 - 这些图中的常见做法.

我真的很喜欢下面的图像显示这个,图像是从pdf中获取的,如何使用该程序绘图:GraphPad:PRISM

旁注:我已经找到了如何使用基本图形,但使用ggplot2.

在此输入图像描述

关于matlab提出了类似但不同的SE问题:这里

我的R代码如下:

library(ggplot2)
library(scales)

ggplot(df, aes(x=dose,y=probability, group=model))+

  geom_ribbon(aes(ymin=Lower,ymax=Upper,x=dose,
                  fill=model, col=model,alpha=2))+

  #Axis log transformation:
  annotation_logticks(scaled = TRUE,sides="b") +
  scale_x_log10(breaks = 10^(-1:10),
                labels = trans_format("log10", math_format(10^.x)))+
  #Axes labels:
  labs(x="dosage (log scale)", y="response",size=1)
Run Code Online (Sandbox Code Playgroud)

数据:

df<-structure(list(dose = c(1.0000001, 1.04737100217022, 1.09698590648847,1.14895111335032, 1.20337795869652, 1.26038305255123, 1.32008852886009,1.38262230716338, 1.44811836666478, 1.51671703328309, 61.5098612858473,64.4236386159454, 67.4754441930906, 70.6718165392165, 74.0196039119089,77.525978976861, 81.1984541753771, 85.0448978198478, 89.073550951683,93.2930449978201, 97.7124202636365, 102.341145301888, 107.189137199173,112.266782823381, 117.584961077656, 123.155066208544, 128.98903221828,135.099358433491, 141.499136285126, 148.202077356965, 155.222542762819,162.575573915347, 6294.98902185499, 6593.18830115198, 6905.51354792318,7232.63392192496, 7575.25028161186, 7934.09668573241, 8309.9419660568,8703.59137460616, 9115.88830891252, 9547.71611900591, 10000),probability = c(0.000541224108467882, …
Run Code Online (Sandbox Code Playgroud)

plot r ggplot2 drc

1
推荐指数
1
解决办法
1372
查看次数

标签 统计

ggplot2 ×3

r ×3

drc ×2

plot ×2

linear-regression ×1

logistic-regression ×1