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

Controlling Ticks Repetition. #27

Open
g-pacheco opened this issue Nov 24, 2021 · 4 comments
Open

Controlling Ticks Repetition. #27

g-pacheco opened this issue Nov 24, 2021 · 4 comments

Comments

@g-pacheco
Copy link

Hello,

Thanks a lot for the great package. I understand that one can control the label repetition by using repeat.tick.labels. Would it be possible to add a similar option for the ticks themselves?

Best regards, George.

@stefanedwards
Copy link
Owner

stefanedwards commented Nov 24, 2021 via email

@g-pacheco
Copy link
Author

g-pacheco commented Nov 25, 2021

Hello @stefanedwards,

Thanks for your quick reply. Say I have the plot below created with this code:

# Creates Manhattan panel ~
Fst_Window <-
  ggplot() +
  geom_line(data = fulldfa, aes(x = gPoint, y = Fst, colour = Pops), linetype = 1, size = .6) +
  facet_rep_grid(CHR ~. , scales = "free", repeat.tick.labels = "left", labeller = labeller(CHR = y_strip_labels)) +
  scale_x_continuous("Genomic Position",
                     breaks = c(5000000, 10000000, 15000000, 20000000, 25000000, 30000000), 
                     labels = c("5Mb", "10Mb", "15Mb", "20Mb", "25Mb", "30Mb"),
                     limits = c(0, 32000000),
                     expand = c(0, 0)) +
  scale_y_continuous("Fst Across Chrmosomes",
                     breaks = c(.1, .3, .5), 
                     labels = c("0.1", "0.3", "0.5"),
                     limits = c(0, .525),
                     expand = c(0, 0)) +
  scale_colour_manual(values = c("#4daf4a", "#9970ab", "#f46d43")) +
  theme(panel.background = element_rect(fill = "#ffffff"),
        panel.border = element_blank(),
        panel.grid.minor = element_blank(),
        axis.line = element_line(colour = "#000000", size = .3),
        axis.title.x = element_text(size = 20, face = "bold", color = "#000000", margin = margin(t = 30, r = 0, b = 0, l = 0)),
        axis.title.y = element_text(size = 20, face = "bold", color = "#000000", margin = margin(t = 0, r = 30, b = 0, l = 0)),
        axis.text = element_text(colour = "#000000", size = 15),
        axis.ticks = element_line(color = "#000000", size = .3),
        strip.background.y = element_rect(colour = "#000000", fill = "#d6d6d6", size = .3),
        strip.text = element_text(colour = "#000000", size = 11.5, face = "bold"),
        legend.position = "top",
        legend.margin = margin(t = 0, b = 0, r = 0, l = 0),
        legend.box.margin = margin(t = 30, b = 25, r = 0, l = 0),
        legend.key = element_rect(fill = NA),
        legend.background =element_blank()) +
  guides(colour = "none", fill = "none")

I would like to have the ticks on the x-axis just once (very first x-axis down), and not on the repeated x-axis lines. So, the option would allow the user to control this behaviour. What do you think?

Thanks again, George.

BSG_EuropeanFlounder--Fst-Windows-NoStepping_Lines_BalticSea

@stefanedwards
Copy link
Owner

stefanedwards commented Nov 25, 2021 via email

@g-pacheco
Copy link
Author

Hej. Sorry for not making myself clear -- thanks for your explanation. I still do not think that what I am looking for is the default behaviour of facet_grid. I was only brave to draw on 3 of them, but I hope you will get the idea. What I would like it to do is to repeat only the x-axis line, and not the x-axis line AND the x-axis ticks. So, the x-axis ticks and labels would appear only once (on the bottom panel ), while the x-axis line would be present in all panels. Does it make more sense now?

InkedBSG_EuropeanFlounder--Fst-Windows-NoStepping_Lines_BalticSea_LI

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

2 participants