Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Points with error bars #386

Open
bennydeslandes opened this issue Mar 8, 2024 · 2 comments
Open

Points with error bars #386

bennydeslandes opened this issue Mar 8, 2024 · 2 comments

Comments

@bennydeslandes
Copy link

Thanks for the great package!

I was wondering if it would be possible to plot points with error bars?

I'm trying to create a circos plot that divided into 6 sections (per each gene). For the first track I wanted to plot points with error bars/confidence intervals? This is an example of the structure of my dataset:

data <- data.frame(
  genes = as.factor(c("gene1", "gene2", "gene3", "gene4", "gene5", "gene6", "gene1", "gene2", "gene3", "gene4", "gene5", "gene6")),
  OR = c(0.5, 1.2, 1.3, 1.7, -0.3, -0.9, 0.5, 1.2, 1.3, 1.7, -0.3, -0.9), 
  upper_CI = c(0.7, 1.4, 1.5, 1.9, -0.1, -0.7, 0.7, 1.4, 1.5, 1.9, -0.1, -0.7),
  lower_CI = c(0.3, 1.0, 1.1, 1.5, -0.5, -1.1, 0.3, 1.0, 1.1, 1.5, -0.5, -1.1),
  pval = c(0.01, 0.01, 0.005, 0.00001, 0.1, 0.6, 0.01, 0.01, 0.005, 0.00001, 0.1, 0.6),
  label = c("ct1tp1", "ct1tp2", "ct2tp1", "ct2tp2", "ct3tp4", "ct5tp8", "ct8tp2", "ct1tp9", "ct3tp5", "ct9tp9", "ct6tp9", "ct11tp8")
)

Thank you in advance

@bennydeslandes
Copy link
Author

I tried to adapt a code from a previous question (#361) but it just turned out weird - the error bars are inside the points

circos.initialize(letters[1:6], xlim = c(0, 10))
circos.track(ylim = c(0, 1.2), panel.fun = function(x, y) {
  value = runif(10)
  mid = 1:10 - 0.5
 
  circos.points(mid, value, pch = 16, col = "blue", cex = 2)
  
  error = value * 0.2
  circos.segments(mid, value - error, mid, value + error, col = "red")
  circos.segments(mid - 0.15, value - error, mid + 0.15, value - error, col = "red")
  circos.segments(mid - 0.15, value + error, mid + 0.15, value + error, col = "red")
})
circos.clear()

@bennydeslandes
Copy link
Author

Never mind! I think I've found how to fix it (change the point size)

circos.initialize(letters[1:6], xlim = c(0, 10))
circos.track(ylim = c(0, 1.2), panel.fun = function(x, y) {
  value = runif(10)
  mid = 1:10 - 0.5
 
  circos.points(mid, value, pch = 16, col = "black", cex = 0.5)
  
  error = value * 0.2
  circos.segments(mid, value - error, mid, value + error, col = "black")
  circos.segments(mid - 0.15, value - error, mid + 0.15, value - error, col = "black")
  circos.segments(mid - 0.15, value + error, mid + 0.15, value + error, col = "black")
})
circos.clear()

Thanks for the great package 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant