You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

To visualize data in Python we will use the library Matplotlib. Matplotlib is a Python 2D plotting library with a variety of vizualisation tools. To see the full gallery of possibilities inluding tutorials, we highly recommend you to visit the offical Matplotlib page. In the following examples we will only cover some basic and often used tools when visualizing data.


If you have not already installed Matplotlib, visit the Matplotlib installation instructions. As NumPy is used a lot when working with Matplotlib, we recommend looking into this first.

Simple plot


Simple plot
import numpy as np
import matplotlib.pyplot as plt

# Evenly sampled time from 0s to 10s at 200ms intervals
t = np.arange(0.0, 10.0, 0.2)

# Plotting t at x-axis and sin(t) at y-axis
plt.plot(t, np.sin(t))

# Naming the title and both axis
plt.title('Sinus function')
plt.ylabel('sin(t)')
plt.xlabel('t [s]')

# Need to call the show() function at the end to display my figure
plt.show()

  • No labels