Back
Close

Computing with Data

elgeish
31.2K views
Previous: Data Preparation Next: Line Plots

Graphing Data in Python

Despite the fact that R has excellent graphics capabilities, it's sometimes desirable to graph data in another programming language. For example, when the entire data analysis process is in Python, it may make sense to graph the data within Python as well. Below and in the rest of this chapter, we explore matplotlib — a popular Python module for graphing data.

import matplotlib.pyplot as plt

# Working with figures in matplotlib
f1 = plt.figure()  # open a figure
f2 = plt.figure()  # open a second figure
plt.savefig('f2.pdf')  # save fig 2 - the active figure
plt.close(f2)
plt.savefig('f1.pdf')  # save fig 2 - the active figure
plt.close(f1)
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants