【问题标题】:How to create contour plot in R which with the color in each contour scaled separately by the density of all points within the contour如何在 R 中创建等高线图,每个等高线中的颜色由等高线内所有点的密度分别缩放
【发布时间】:2021-11-03 21:27:41
【问题描述】:

我正在尝试在 R 中创建一个等高线图,其中某个等高线中的所有点都根据该等高线内的密度进行缩放,而不是相对于所有点的总密度。例如,我正在尝试复制这样的图:https://docs.flowjo.com/flowjo/graphs-and-gating/data-visualization-and-display/gw-zebra/

我不知道在哪里继续这样做。如果有人可以提供任何建议,将不胜感激。

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: r contour


【解决方案1】:

Myabe 这会帮助你

library(tidyverse)

示例数据

df <-
  tibble(
    x = rnorm(1000),
    y = rnorm(1000)
    )

代码

df %>% 
  ggplot(aes(x, y))+
  geom_density_2d_filled() 

输出

【讨论】:

    猜你喜欢
    • 2014-01-25
    • 2020-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多