2.7. Figure Import/Export
2.7.1. Reading data
with open('filename.csv')
- context managernumpy.loadtxt('filename.csv', delimeter=',', unpack=True)
csv.DictReader()
pandas
DataFrame
2.7.2. pandas
and matplotlib
All of plotting functions expect
np.array
ornp.ma.masked_array
as inputClasses that are 'array-like' such as
pandas
data objects andnp.matrix
may or may not work as intendedIt is best to convert these to
np.array
objects prior to plottingConvert a
pandas.DataFrame
:import matplotlib.pyplot as plt import pandas as pd import numpy as np np.random.seed(0) a = pandas.DataFrame(np.random.rand(4,5), columns = list('abcde')) a_asndarray = a.values
2.7.3. Exporting
Renderer |
Filetypes |
Type |
Description |
---|---|---|---|
AGG |
High quality images using the Anti-Grain Geometry engine |
||
PS |
Postscript output |
||
Portable Document Format |
|||
SVG |
Scalable Vector Graphics |
||
Cairo |
using the Cairo graphics library |