Skip to content
Snippets Groups Projects
Select Git revision
  • 72902eef84e75a6aebaff4425c7f664e397b361d
  • main default protected
2 results

ccb_theme

  • Open with
  • Download source code
  • Your workspaces

      A workspace is a virtual sandbox environment for your code in GitLab.

      No agents available to create workspaces. Please consult Workspaces documentation for troubleshooting.

  • Name Last commit Last update
    CCB_theme.R
    README.md

    CCB_theme

    Getting started

    Use this stylesheet to quickly modify the style of your ggplot plots to the CCB style, for publications. You can use the stylesheet file like so:

    Example code

    After sourcing the function, you can use it in your ggplot codes by including the "CCB_plot_style" function code in your ggplot script. With "mycolor", you have the flexibility to select from various colors to represent your data.

    library(ggplot2)
    
    source("https://gitlab.cs.uni-duesseldorf.de/ghaffarinasabsharabiani/ccb_theme/-/raw/main/CCB_theme.R")
    
    
    
    #line chart with points
    #Here, "data" represents the data frame you want to plot, and "x" and "y" represent the variables you want to plot on the x and y #axes, respectively.
    #The ellipsis (...) represents any other ggplot2 code you want to add to customize your plot.
    
    df <- data.frame(x=1:10,y=rnorm(10))
    
    ggplot(df,aes(x=x,y=y))+
      geom_point()+
      geom_line(linewidth=1.5,color=mycolor[1])+
      CCB_plot_style()+
      scale_color_manual(values = mycolor)+ ...
    
    
    
    #Box_plot
    
    ggplot(mtcars, aes(x = wt, y = mpg, color = factor(cyl))) +
      geom_line() +
      ggtitle("Custom color palette") +
      CCB_plot_style()+
      scale_color_manual(values = mycolor)