-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle_sheets.py
More file actions
31 lines (22 loc) · 818 Bytes
/
style_sheets.py
File metadata and controls
31 lines (22 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
"""Anpassung des Plotstyles mittels style sheets.
Matplotlib bietet mit den sogenannten style sheets [0] einen
komfortablen Weg an, das Aussehen von Plots zu manipulieren. Diese
ermöglichen es die Parameter zur Darstellung seiner Abbildungen zentral
zu definieren und in seinen Skripten zu laden. Auf diese Weise ist es
sehr einfach Abbildungen den gewünschten Look zu verleihen oder diesen
zu ändern.
[0] http://matplotlib.org/users/style_sheets.html
"""
import numpy as np
import matplotlib.pyplot as plt
# Liste der verfügbaren styles.
print(plt.style.available)
# Setzen eines matplotlib styles.
plt.style.use('bmh')
x = np.linspace(0, 2 * np.pi, 50)
fig, ax = plt.subplots()
ax.plot(x, np.sin(x), label='Sinus')
ax.plot(x, np.cos(x), label='Kosinus')
ax.legend()
plt.show()