erocoar / ggpol

🌍 Parliament diagrams and more for ggplot2

Home Page:https://erocoar.github.io/ggpol/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

your pkg with dark bg

PythonCoderUnicorn opened this issue · comments

Hello,

I decided to try out your pkg and made a rainbow colored ggpol.

when I save this image or use RStudio clipboard it shows white bg edges so i screen captured this

Screen Shot 2021-11-11 at 4 24 10 PM

my initial try was to put ggdark::dark_mode() at the end for a dark plot but that did not work. here is the code i used to make my plot dark, maybe you will find it useful

# install.packages("ggpol")
library(ggpol)

rb = data.frame(
  flag = factor( c('red','orange','yellow',
                   'green','blue','purple')),
  seats = c(200, 46, 92, 80, 153, 69),
  colors = c('red','orange','yellow',
             'green','blue','purple')
)

ggplot(rb) + 
  geom_parliament(aes(seats = seats,
                      fill = flag), 
                  color = "black") + 
  scale_fill_manual(values = rb$colors, 
                    labels = rb$flag) +
  labs(title = "\nParliamentary diagram {ggpol} #PrideFlag")+
  coord_fixed() + 
  theme(
    text = element_text(family = "Rubik"),
    plot.title = element_text(size = 14, 
                              hjust = 0.5
                              ),
    panel.grid.major = element_line(linetype = "blank"),
    panel.grid.minor = element_line(linetype = "blank"),
    legend.text = element_text(colour = "white"),
    legend.title = element_markdown(size = 12,
                                    colour = "white"), 
    panel.background = element_rect(fill = "gray0"),
    plot.background = element_rect(fill = "gray0"),
    legend.background = element_rect(fill = "gray0"),
    legend.position = "bottom", legend.direction = "horizontal",
    axis.text.x = element_blank(),
    axis.text.y = element_blank(),
    axis.ticks = element_blank()
    )

Thanks for the package. : )

Thanks, looks awesome! I'll try to figure out why ggdark is not working as intended 😄