Git Product home page Git Product logo

Comments (4)

teunbrand avatar teunbrand commented on July 30, 2024

Hi there, can you post a reproducible example with, if your data are private, mocked up data or a standard dataset?

from ggh4x.

star9926 avatar star9926 commented on July 30, 2024

Super! thanks for your quick response. I uploaded the file and code for data visualization. ###
I failed with barplot, but succeed with boxplot.
##for barplot
pi_cf_blo <- ggbarplot(cytoflex_p1_blood,
x='Group',y='Statistic',nrow=1,
color = 'Group',fill = 'Group',alpha=.6,
#facet.by = c('cellCytokine'),
#facet.by = c('response','cellCytokine'),#'cellType','ICytokine'
palette = c(#'#868686FF',
"#CD534CFF",'#0073C2FF','#EFC000FF'),
add = c('mean_se','point'),
add.params = list(color='response',binwidth=1,
fill='response' ))+
scale_color_manual(values = c("High IL-6" = "black",
"Low IL-6" = 'gray'))+
ggh4x::facet_grid2(response ~ cellType + ICytokine,#Type, # cellCytokine, #
scales = 'free_y')+
scale_y_continuous(labels = scales::label_scientific(digits = 2))+
stat_pvalue_manual(stat_pvalue,label = 'p.adj.signif',tip.length = 0,
remove.bracket = F,hide.ns = T,size=2,#,
step.increase = 0.02,label.size = 2)+
theme(legend.position = 'top',
strip.placement = "outside",
panel.border = element_rect(color = NA, fill=NA),
axis.line = element_line(colour = "black"),
legend.key.size = unit(.5,units = 'cm'),
axis.text.x = element_blank(),
axis.text.y = element_text(face = 'bold',size = 7),
axis.title.y = element_text(face = 'bold',size = 13),
axis.title.x = element_blank(),
#legend.text = element_text(face = 'bold',size = 14),
legend.text = element_text(face = 'bold',size = 12),
legend.title = element_blank(),
strip.text.y = element_text(size = 10,face = 'bold'),
strip.text.x = element_text(size = 7,face = 'bold'))+
labs(x='Group',y='Blood Internal cytokine MFI')
pi_cf_blo
##for boxplot
ggboxplot(cytoflex_p1_blood,
x='Group',y='Statistic',nrow=1,
color = 'Group',fill = 'Group',alpha=.6,
palette = c(#'#868686FF',
"#CD534CFF",'#0073C2FF','#EFC000FF'),
add = 'point',
add.params = list(color='response',binwidth=.2,#size=.5,
fill='response'))+
scale_color_manual(values = c("High IL-6" = "black",
"Low IL-6" = 'gray'))+
ggh4x::facet_grid2(response ~ cellType + ICytokine,
scales = 'free_y',
independent = 'y'#,nrow = 1
)+
#facet_wrap(vars(cellType,ICytokine), scales = 'free_y',nrow = 1)+
scale_y_continuous(labels = scales::label_scientific(digits = 2))+
stat_pvalue_manual(stat_pvalue,label = 'p.adj.signif',tip.length = 0,
remove.bracket = F,hide.ns = T,size=2,#,
step.increase = 0.02,label.size = 2)+
theme(legend.position = 'top',
axis.text.x = element_blank(),
axis.text.y = element_text(face = 'bold',size = 7),
axis.title.y = element_text(face = 'bold',size = 13),
axis.title.x = element_blank(),
#legend.text = element_text(face = 'bold',size = 14),
legend.text = element_text(face = 'bold',size = 12),
legend.title = element_blank(),
strip.text.y = element_text(size = 10,face = 'bold'),
strip.text.x = element_text(size = 7,face = 'bold'))+
labs(x='Group',y='Blood Internal cytokine MFI')

240202_dt.csv

from ggh4x.

teunbrand avatar teunbrand commented on July 30, 2024

I can't reproduce either of these plots as there seems to be a response variable missing.
In general, my advise for doing any sort of advanced plotting is to build plots from scratch instead of relying on wrappers like ggbarplot(). You can go layer-by-layer and identify more easily when something is going wrong.

from ggh4x.

star9926 avatar star9926 commented on July 30, 2024

Thanks for your advice, my apologies for the delay. I have attached an updated CSV file, I still have no idea how to have 3 facets in ggbarplot, will try with scratch as you suggested.
240208_dt.csv

Anyhow, I tried to merged the 'cellType' and 'cytokines' into a single variable, and presented it within one facet.
ggbarplot(cytoflex_p1_blood,
x='Group',y='Statistic',nrow=1,
facet.by = c('response','Type'),
color = 'Group',fill = 'Group',alpha=.6,
palette = c(#'#868686FF',
"#CD534CFF",'#0073C2FF','#EFC000FF'),
add = c('mean_se','point'),#'point',#
add.params = list(color='response',
binwidth=.1,#size=.5,
fill='response' ))+
scale_color_manual(values = c("High IL-6" = "black",
"Low IL-6" = 'gray'))+
ggh4x::facet_grid2(response ~ Type, #cellType + ICytokine,
scales = 'free_y',
independent = 'y'#,nrow = 1
)+
scale_y_continuous(labels = scales::label_scientific(digits = 2))+
theme(legend.position = 'top',
strip.placement = "outside",
panel.border = element_rect(color = NA, fill=NA),
axis.line = element_line(colour = "black"),
legend.key.size = unit(.5,units = 'cm'),
axis.text.x = element_blank(),#element_text(face = 'bold',size = 8),
# angle = 90),
axis.text.y = element_text(face = 'bold',size = 5),
axis.title.y = element_text(face = 'bold',size = 13),
axis.title.x = element_blank(),
#legend.text = element_text(face = 'bold',size = 14),
legend.text = element_text(face = 'bold',size = 12),
legend.title = element_blank(),
strip.text.y = element_text(size = 10,face = 'bold'),
strip.text.x = element_text(size = 5,face = 'bold',
colour = 'black'))+
labs(x='Group',y='Blood Internal cytokine MFI')

from ggh4x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.