4.6.1. Exercise: Plot styling#

In Exercise: Plotting a series 2, using these data:

# Video camera data
t = [0.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0]  # seconds
p = [0.0, 8.9, 28.0, 45.2, 60.4, 67.4, 75.5, 86.2, 93.0, 95.3, 100.0]  # meters

# Timing gates data (placed at positions 0m, 25m, 50m, 75m and 100m)
timing_gates_time = [0.0, 2.65, 5.70, 10.25, 20.0]  # seconds

you generated the following figure:

_images/e088abb2a3eacb6bf48bbed1f5b33b1b31ff79593fd2b0330210da8672219f4d.png

You now need to print it in black and white for publication in a journal. To maximize the clarity of the figure, you want to use markers and line styles instead of grey shades.

Generate the figure again, but this time with these specifications:

  • The video camera curve must be a full, black line with square markers;

  • The timing gates curve must be a dashed, black line with round markers.

Hide code cell content
import matplotlib.pyplot as plt

plt.plot(t, p, "s-k")
plt.plot(timing_gates_time, [0, 25, 50, 75, 100], "o--k")
plt.title("Race profile of a sprinter")
plt.xlabel("Time (s)")
plt.ylabel("Position (m)")
plt.legend(["Video camera", "Timing gates"])
plt.grid(True);
_images/35d351b88c1b7a72e53420870000863bed5d9c46fa3f8b3af245965ab45fd485.png