Changes the appearance of a python matplotlib 2D plot in accordance with DIN461.
DIN461 is a German standard:
import matplotlib.pyplot as plt
import numpy as np
from matplotlib_din461 import apply_din461
t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(4 * np.pi * t) + 2
plt.plot(t, s)
plt.xlabel("Time $t$")
plt.ylabel("Voltage $U$")
ax = plt.gca()
apply_din461(ax, "s", "V")
plt.tight_layout()
plt.show()
def apply_din461(ax, x_unit_name, y_unit_name, x_left_to_right=True, y_bottom_to_top=True):
- ax (matplotlib ax): Axis to be motified
- x_unit_name (unicode): Name of the unit in x direction
- y_unit_name (unicode): Name of the unit in y direction
- x_left_to_right (bool): If True, arrow from left to right
- y_bottom_to_top (bool): If True, arrow bottom to top
This project is licensed under the terms of the MIT license - see the LICENSE file for details.