ggplot2 相关问题

ggplot2是一个积极维护的R开源图表绘图包,由Hadley Wickham编写,基于“图形语法”的原则。它部分取代了R的基本图和格子包,同时提供了一个干净,强大,正交和有趣的API。



基于r

中实现这一目标

回答 1 投票 0


盖图特和桌子并排在rmarkDown

i是在rmarkDown中生成一个GGPLOT图和桌子。它需要工作 在HTML和PDF输出中。我找到了一种使用Inline CSS为HTML实现这一目标的“骇人听闻”的方式,但这没有...

回答 1 投票 0

在同一ggplot上绘制点和弧 我正在尝试使用ggplot2叠加一些随机点和弧线,但似乎无法同时实现这两个。 这是我的代码: 图书馆(ggplot2) 图书馆(GGFORCE) #生成随机数据 X

library(ggplot2) library(ggforce) # Generate random data x <- runif(20) y <- runif(20) df <- data.frame(x = x, y = y) # Plot points and quarter circle ggplot(df, aes(x = x, y = y)) + geom_point(size = 3) + geom_arc( aes(x0 = 0, y0 = 0, r = 1, start = 0, end = pi / 2), color = "red", size = 1 ) <-...

回答 1 投票 0

GGPLOT视觉日期选择power vi r脚本

问题。当我在R中运行GGPLOT视觉效果时,我会得到以下类型的图表。 当我使用R脚本Visual在Power BI中运行相同的视觉效果时,我会得到以下不像D ...

回答 1 投票 0

Ggplotly-仅显示errorbar

我有一个带有错误键的barplot,我正在通过

回答 1 投票 0

如何在ggplot中打印科学符号的p值

<- 100 x <- rnorm(n) y <- 2 * x + rnorm(n, sd = 0.5) data <- data.frame(x =...

回答 1 投票 0


我如何在ggplot2图上叠加传奇? 我想在GGPLOT2图中放置一个传奇。例如,请参见代码 ggplot(iris,aes(sepal.length,petal。 geom_point() + 主题(传说

我希望由此产生的传说位于图表的右下角,即叠加在灰色背景上,但是传奇。position.position.inside始终放置传奇

回答 2 投票 0

我创建了一个实际上是4种不同的ggplots的大型曲线,使用包含4个不同结果的结果的数据框架。

p1 <- logit_results %>% filter(outcome == "Time_Sport", term != "(Intercept)") %>% ggplot(aes(x = estimate, y = term)) + geom_point(aes(color = treat), size = 2) + facet_wrap(~ treat, nrow = 2, labeller = as_labeller(condition_labels)) + labs(title = "Time for sports") p2 <- logit_results %>% filter(outcome == "Money_Sport", term != "(Intercept)") %>% ggplot(aes(x = estimate, y = term)) + geom_point(aes(color = treat), size = 2) + facet_wrap(~ treat, nrow = 2, labeller = as_labeller(condition_labels)) + labs(title = "Money for sports") p1+p2

回答 1 投票 0

如何重现这些图(使用python制成) 我有三个因素,并产生了以下图 mtcars%>%ggplot(aes(as.factor(carb),fill = as.factor(am)))+ geom_bar(aes(y = .. count ../ tapply(.. count ..,.. fill ..,sum)[.. fill ..])...

mtcars%>% ggplot( aes(as.factor(carb),fill=as.factor(am)))+ geom_bar(aes( y=..count../tapply(..count.., ..fill.. ,sum)[..fill..]), position="fill")+ facet_wrap(~as.factor(vs))+ theme(legend.position = "bottom")

回答 1 投票 0

-scale_fill_manual因子级别,颜色或顺序忽略

我很难使用Scale_fill_manual创建地图,以根据该地区的某些属性在地图上填充区域。我正在使用带有Terra和Tidyverse套件的Tidyterra。我不熟悉...

回答 1 投票 0

如何在一个图上绘制多个图?

library(shiny) library(ggplot2) load(url("https://github.com/bandcar/Unemployment-Rate-Pre-and-Post-Covid/blob/main/ue_wider.RData?raw=true")) ui <- fluidPage( titlePanel("US Unemployment Rates Before and After COVID"), sidebarLayout( sidebarPanel( selectInput(inputId = "y", label = "State", choices = c("Alabama","Alaska", "Arizona", "Arkansas", "California", "Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"), selected = "Alabama"), Multiple = TRUE, selectInput(inputId = "x", label = "X-axis:", choices = c("Year"), selected = "Year"), selectInput(inputId = "col_p", label = "Select a Point Color", choices = c("red", "dark green", "blue", "black"), selected = "black"), selectInput(inputId = "col_l", label = "Select a Line Color:", choices = c("Red", "Blue", "Black", "Dark Green"), selected = "blue"), ), mainPanel( plotOutput(outputId = "graph") ) ) ) server <- function(input, output) { output$graph <- renderPlot({ ggplot(q, aes_string(x=input$x, y=input$y)) + geom_point(colour=input$col_p) + geom_line(colour=input$col_l) + ylim(2,15) }) } shinyApp(ui = ui, server = server)

回答 1 投票 0

我如何在rShiny

我在r上绘制了一个酒吧,如下所示: 现在,我需要显示Y轴的各个值以及第二杆和第一杆之间的百分比差异(从右到左的降低率降低了。

回答 1 投票 0




具有不同间距数据的图纸轮廓

数据帧看起来像:

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.