Contekan Visualisasi

Contekan dasar set styling seaborn dari sini dan dari sini

Seaborn

Dark

from jupyterthemes import jtplot
jtplot.style(theme='monokai', context='notebook', ticks=True, grid=False)

Light

jtplot.reset() ## I use dark mode by default hence needs to turn it off for books and stuff
custom_params = {"axes.spines.right": False, "axes.spines.top": False} ## ngilangin kotak sudut kanan atas
sns.set_theme(style="ticks", context='paper',font_scale=1,rc=custom_params) ## Kadang pake style "white" juga bisa
# plt.figure(figsize=(5,4),dpi=80, facecolor='w', edgecolor='k') ## biasanya ga perlu. context aja udah cukup

ggplot

Dark

library('ggplot2')
library('ggdark')
graph<-ggplot()+
  dark_theme_bw(base_size=18)+
  theme(text = element_text(color='#e0e0e0'),
        panel.border = element_blank(),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        axis.line = element_line(colour = "#e0e0e0"))
With function
library('ggplot2')
library('ggdark')
graph<-function(dataset, ...) {
  dataset |>
    ggplot(aes(...))+
    dark_theme_bw(base_size=18)+
    theme(text = element_text(color='#e0e0e0'),
          panel.border = element_blank(),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          axis.line = element_line(colour = "#e0e0e0"))
}

Light

graph<-function(dataset, ...) {
  dataset |>
  ggplot(aes(...))+
  theme_classic() +
  theme(panel.background = element_rect(fill = "#f0f1eb",
                                        colour = "#f0f1eb"),
        plot.margin = margin(0,0,0,0),
        plot.background = element_rect(fill = "#f0f1eb"),
        legend.key = element_rect(fill = "#f0f1eb",linetype = "blank"),
        legend.background = element_rect(fill="#f0f1eb"))
}

No info

theme_classic()+
  theme(axis.title.x = element_text(hjust=1),
        axis.title.y = element_text(angle=0,hjust=1,vjust=1),
        panel.grid=element_blank(),
        axis.text.x=element_blank(),
        axis.text.y=element_blank(),
        axis.ticks.x=element_blank(),
        axis.ticks.y=element_blank(),
        legend.position=c(1,1),
        legend.justification = c(1,1),
        legend.spacing=unit(0,"cm"),
        legend.margin=margin(0,0,0,0))
Sebelumnya
Selanjutnya