Skip to content

Issues with x-axis not showing 0 at the origin #98

@javisolivan

Description

@javisolivan

Hi!

I have generated a plot using ggcyto. I am unable to set the scale in such way that it shows me the origin. I have tried using ggcyto_par_set, scale_x_continuous, and scale_y_continuous. None seem to allow me to overwrite the x-axis. I was hoping someone could help me. I have attached an image of the plot. Thanks!! Here is the code:

plot_for_sample <- ggcyto(sample_selection, aes(x = "RL2-A", y = "BL1-A")) +
    #geom_hex(alpha=1, bins = 260) +
    geom_point(shape = 21, fill = "black", stroke = 0.2, alpha = 0.25, size = 0.5)+
    stat_density_2d(aes(fill = ..level..), geom = "polygon", 
                    alpha = 0.08, #linewidth = 0.6,
                    bins = 100, lineend = "round",
                    linejoin = "round") +
    ylab("PDX1") +
    xlab("CHGA") +
    stats_null() +
    geom_stats("/Live/Single Cells/CHGAnegPDX1pos", adjust = c(0.2,0.8),fontface = "bold", size = 5.2)+ 
    geom_stats("/Live/Single Cells/CHGAposPDX1pos", adjust = c(0.8, 0.8),fontface = "bold",size = 5.2) +   
    geom_stats("/Live/Single Cells/CHGAposPDX1neg"  , adjust = c(0.8, 0.1),fontface = "bold",size = 5.2)+ 
    geom_stats("/Live/Single Cells/CHGAnegPDX1neg", adjust = c(0.2,0.1),fontface = "bold",size = 5.2)+ 

    geom_gate(c("/Live/Single Cells/CHGAnegPDX1pos",
                "/Live/Single Cells/CHGAposPDX1pos",
                "/Live/Single Cells/CHGAposPDX1neg",
                "/Live/Single Cells/CHGAnegPDX1neg"), 
              colour = "black", alpha = 10/10, size = 1, linewidth = 0.3)+
    theme_classic() +
    scale_fill_gradientn(colours = colfunc(400), trans = "log10") +
    theme(panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.background = element_blank(),
          text = element_text(size = 16),
          axis.title.x = element_text(margin = margin(t = 10), size = 20),
          axis.title.y = element_text(margin = margin(t = 10), size = 20),
          axis.text = element_text(margin = margin(t = 10), size = 16),
          axis.title = element_text(margin = margin(t = 10), size = 16),
          plot.title = element_text(size = 10),
          legend.text = element_text(size = 12),
          legend.title = element_text(size = 12),
          legend.position = "none",
          plot.margin = margin(0.25, 1, 0.25, 0.25, "cm"),  # Adjust the right margin (2 cm in this example)
          axis.line = element_line(colour = "black", linewidth = 0.3),
          strip.background = element_blank(),
          strip.text = element_text(face = "plain", hjust = 0)) +
    axis_x_inverse_trans()+ # Remove facet label background)
    axis_y_inverse_trans()

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions