Skip to content

RWTH Aachen University Corporate Design Colors in various colors, including a python package to seemlessly integrate RWTH Colors into matplotlib

License

Notifications You must be signed in to change notification settings

ifs-rwth-aachen/RWTH-Colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RWTH Aachen University - Corporate Design Colors

This repository contains RWTH Aachen University's corporate design color definitions in different formats. See here for oringinal color defintions (German only)

Android Studio

An XML file containing most RWTH colors

CSS

.css file containing all RWTH Colors

LaTeX

.tex file containing all RWTH Colors for use with the xcolor package

Draw.io

A json file containing all RWTH Colors for use with draw.io

Python Package

To integrate RWTH's colors into your python application, you can use the rwthcolors package

Installation

You can install rwthcolors via pip:

pip install rwthcolors

Usage

# RWTHColors Python Package

## Overview

The `rwthcolors` package allows you to integrate RWTH's official color palette into your Python applications, particularly for use with matplotlib.

## Installation

Install `rwthcolors` via pip:

```bash
pip install rwthcolors

Usage

Importing RWTHColors

To automatically set the default color cycle to RWTH colors, simply import:

import RWTHColors

This will make all matplotlib figures by default use RWTH colors!

Alternatively, apply RWTH colors to your matplotlib plots using:

plt.style.use('rwth')

Additional styles include:

  • rwth-full: A color cycle with more colors.
  • rwth-dark: For dark backgrounds. Use it with:
    with plt.style.context(['dark_background', 'rwth-dark']):
        # Your plotting code here

Accessing Colors Explicitly

To access colors explicitly, use ColorManager:

from RWTHColors import ColorManager
cm = ColorManager()

Example to get RWTH black at 75% intensity:

c = cm.RWTHSchwarz.p(75)

By default, this returns the HEX code. For RGB codes, instantiate ColorManager with:

cm = ColorManager(frmt='RGB')

Retrieve colors directly by calling them:

c = cm.RWTHBlau()  # RWTHBlau at 100%
c = cm.RWTHBlau(50)  # RWTHBlau at 50%

⚠️ Warning: RWTHColors only contains the official RWTH colors at 100 %, 75%, 50 %, 25 % and 10 %. It does not interpolate inbetween values.

Print color values using:

print(RWTHRot.colors('RGB')) # or
print(RWTHRot())

When instantiated, ColorManager replaces matplotlib's default color cycle with the cycle used in the rwth mplstyle.

Color Palette

Display all RWTH colors with:

cm.plot_color_palette()

Color Palette

Tips for Enhanced Plots

Enhance your plots by combining rwthcolors with the SciencePlots package. Example style combination:

with plt.style.context(['science', 'grid', 'rwth']):
    # Your plotting code here

Example Plot

import matplotlib.pyplot as plt
import numpy as np
import RWTHColors
import scienceplots

plt.style.use(['science', 'grid', 'rwth'])

x = np.arange(0, 4*np.pi, .01)

fig, ax = plt.subplots(1, 1, figsize=(10, 4))

for a in [1, 2, 3, 4, 5, 6, 7, 8]:
    ax.plot(x, a*np.sin(x), label='$\hat{a}=$' + '${}$'.format(a))
    
ax.legend(loc=1)
ax.set_xlabel('$x$')
ax.set_ylabel('$f(x)$')

plt.show()

This produces:

Example Plot

Disclaimer

This repository is not maintained by RWTH Aachen University's marketing department but a voluntary offer by the Institute of Rail Vehicles and Transport Systems. If you have the color definitions in other formats, feel free to contribute them using a merge request.

About

RWTH Aachen University Corporate Design Colors in various colors, including a python package to seemlessly integrate RWTH Colors into matplotlib

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published