Perhaps this is already implemented and I'm just unable to find it. I think this package in general is great; very easy to use and very beautiful. Thank you for your time making it.
import matplotlib.pyplot as plt
import matplotx
import numpy as np
# create data
rng = np.random.default_rng(0)
offsets = [1.0, 1.50, 1.60]
labels = ["no balancing", "CRV-27", "CRV-27*"]
x0 = np.linspace(0.0, 3.0, 100)
y = [offset * x0 / (x0 + 1) + 0.1 * rng.random(len(x0)) for offset in offsets]
fig, axes = plt.subplots(2,1) # add subplots
for ax in axes: # Let's make two identical subplots
with plt.style.context(matplotx.styles.dufte):
for yy, label in zip(y, labels):
ax.plot(x0, yy, label=label) # changed plt. to ax.
ax.set_xlabel("distance [m]") # changed plt. to ax.
matplotx.ylabel_top("voltage [V]") # move ylabel to the top, rotate
matplotx.line_labels() # line labels to the right
#plt.show() # Including this adds the 'pretty axis' below the subplots.
Perhaps this is already implemented and I'm just unable to find it. I think this package in general is great; very easy to use and very beautiful. Thank you for your time making it.
I'm unable to get
matplotxworking properly when using subplots. Adapting theClean line plots (dufte)example to include two subplots (side-by-side, or one-below-the-other) appears not to work.