Skip to content

Commit 1a63cae

Browse files
fixed bug
1 parent c691d59 commit 1a63cae

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

part-09/lecture-plotting.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Lecture VIII - Data Visualization"
2+
title: "Lecture IX - Data Visualization"
33
subtitle: "Programming with Python"
44
author: "Dr. Tobias Vlćek"
55
institute: "Kühne Logistics University Hamburg - Fall 2024"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
4+
# Set the style
5+
plt.style.use('default')
6+
fig, ax = plt.subplots(figsize=(12, 7))
7+
fig.set_facecolor('#f8f9fa')
8+
ax.set_facecolor('#ffffff')
9+
10+
# Generate data
11+
x = np.linspace(0, 10, 100)
12+
y1 = np.sin(x)
13+
y2 = np.cos(x)
14+
15+
# Create plots with modern styling
16+
ax.plot(x, y1, label="Sine", color='#4361ee', linewidth=2.5)
17+
ax.plot(x, y2, label="Cosine", color='#f72585', linewidth=2.5)
18+
19+
# Customize the plot with modern aesthetics
20+
ax.set_title('Sine and Cosine Functions', fontsize=16, pad=20, fontweight='bold')
21+
ax.set_xlabel('x', fontsize=12, labelpad=10)
22+
ax.set_ylabel('y', fontsize=12, labelpad=10)
23+
24+
# Improve grid and spines
25+
ax.grid(True, linestyle='--', alpha=0.3, color='#666666')
26+
ax.spines['top'].set_visible(False)
27+
ax.spines['right'].set_visible(False)
28+
29+
# Enhanced legend
30+
ax.legend(fontsize=11, framealpha=0.95, loc='upper right')
31+
32+
# Add a slight margin to the plot
33+
ax.margins(x=0.02)
34+
35+
# Adjust layout and display
36+
plt.tight_layout()
37+
plt.show()
38+
plt.show()

part-09/tutorial-plotting.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Tutorial VIII - Data Visualization"
2+
title: "Tutorial IX - Data Visualization"
33
subtitle: "Programming with Python"
44

55
format:

0 commit comments

Comments
 (0)