MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / plotfile

Function plotfile

site-packages/matplotlib/pyplot.py:2236–2355  ·  view source on GitHub ↗

Plot the data in a file. *cols* is a sequence of column identifiers to plot. An identifier is either an int or a string. If it is an int, it indicates the column number. If it is a string, it indicates the column header. matplotlib will make column headers lower case, replac

(fname, cols=(0,), plotfuncs=None,
             comments='#', skiprows=0, checkrows=5, delimiter=',',
             names=None, subplots=True, newfig=True, **kwargs)

Source from the content-addressed store, hash-verified

2234
2235
2236def plotfile(fname, cols=(0,), plotfuncs=None,
2237 comments='#', skiprows=0, checkrows=5, delimiter=',',
2238 names=None, subplots=True, newfig=True, **kwargs):
2239 """
2240 Plot the data in a file.
2241
2242 *cols* is a sequence of column identifiers to plot. An identifier
2243 is either an int or a string. If it is an int, it indicates the
2244 column number. If it is a string, it indicates the column header.
2245 matplotlib will make column headers lower case, replace spaces with
2246 underscores, and remove all illegal characters; so ``'Adj Close*'``
2247 will have name ``'adj_close'``.
2248
2249 - If len(*cols*) == 1, only that column will be plotted on the *y* axis.
2250
2251 - If len(*cols*) > 1, the first element will be an identifier for
2252 data for the *x* axis and the remaining elements will be the
2253 column indexes for multiple subplots if *subplots* is *True*
2254 (the default), or for lines in a single subplot if *subplots*
2255 is *False*.
2256
2257 *plotfuncs*, if not *None*, is a dictionary mapping identifier to
2258 an :class:`~matplotlib.axes.Axes` plotting function as a string.
2259 Default is 'plot', other choices are 'semilogy', 'fill', 'bar',
2260 etc. You must use the same type of identifier in the *cols*
2261 vector as you use in the *plotfuncs* dictionary, e.g., integer
2262 column numbers in both or column names in both. If *subplots*
2263 is *False*, then including any function such as 'semilogy'
2264 that changes the axis scaling will set the scaling for all
2265 columns.
2266
2267 *comments*, *skiprows*, *checkrows*, *delimiter*, and *names*
2268 are all passed on to :func:`matplotlib.mlab.csv2rec` to
2269 load the data into a record array.
2270
2271 If *newfig* is *True*, the plot always will be made in a new figure;
2272 if *False*, it will be made in the current figure if one exists,
2273 else in a new figure.
2274
2275 kwargs are passed on to plotting functions.
2276
2277 Example usage::
2278
2279 # plot the 2nd and 4th column against the 1st in two subplots
2280 plotfile(fname, (0,1,3))
2281
2282 # plot using column names; specify an alternate plot type for volume
2283 plotfile(fname, ('date', 'volume', 'adj_close'),
2284 plotfuncs={'volume': 'semilogy'})
2285
2286 Note: plotfile is intended as a convenience for quickly plotting
2287 data from flat files; it is not intended as an alternative
2288 interface to general plotting with pyplot or matplotlib.
2289 """
2290
2291 if newfig:
2292 fig = figure()
2293 else:

Callers

nothing calls this directly

Calls 12

figureFunction · 0.85
gcfFunction · 0.85
getname_valFunction · 0.85
add_subplotMethod · 0.80
set_ylabelMethod · 0.80
is_last_rowMethod · 0.80
set_xlabelMethod · 0.80
autofmt_xdateMethod · 0.80
funcFunction · 0.50
getMethod · 0.45
appendMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected