Module Details¶
Classes to plot TimeSeries with matplotlib.
Classes¶
TimeSeriesPlot¶
- class TimeSeriesPlot(fig=None, *args, **kwargs)¶
Based on : SubPlot
Defines a subclass of matplotlib.axes.Subplot to plot time series.
A TimeSeries is associated with the plot. This time series is usually specified at the creation of the plot, through the optional parameter series. If no series is given at the creation, the first time series being plotted will be used as associated series.
The associated series is stored in the series attribute. It gives its frequency to the plot. This frequency can be accessed through the attribute freq. All the other series that will be plotted will be first converted to the freq frequency, using their asfreq method.
The same parameters used for the instanciation of a standard matplotlib.axes.Subplot are recognized.
Parameters: series : {None, TimeSeries}, optional
The time series allocated to the plot.
Warning
- Because the series to plot are first converted to the plot frequency, it is recommended when plotting several series to associate the plot with the series with the highest frequency, in order to keep a good level of detail.
Attributes
freq Underlying frequency. xdata (DateArray) The array of dates corresponding to the x axis. legendsymbols (list) legendlabels (list) List of the labels associated with each plot. The first label corresponds to the first plot, the second label to the second plot, and so forth. Methods
acorr(x, **kwargs) Plot the autocorrelation of x. add_artist(a) Add any Artist to the axes. add_callback(func) Adds a callback function that will be called whenever one of the Artist‘s properties changes. add_collection(collection[, autolim]) Add a Collection instance to the axes. add_container(container) Add a Container instance to the axes. add_image(image) Add a AxesImage to the axes. add_line(line) Add a Line2D to the list of plot add_patch(p) Add a Patch p to the list of axes patches; the clipbox will be set to the Axes clipping box. add_table(tab) Add a Table instance to the add_yaxis([fsp, position, yscale, basey, subsy]) Adds a second y-axis to a TimeSeriesPlot. angle_spectrum(x[, Fs, Fc, window, pad_to, ...]) Plot the angle spectrum. annotate(*args, **kwargs) Create an annotation: a piece of text referring to a data point. apply_aspect([position]) Use _aspect and _adjustable to modify the axes box or the view limits. arrow(x, y, dx, dy, **kwargs) Add an arrow to the axes. autoscale([enable, axis, tight]) Autoscale the axis view to the data (toggle). autoscale_view([tight, scalex, scaley]) Autoscale the view limits using the data limits. axhline([y, xmin, xmax]) Add a horizontal line across the axis. axhspan(ymin, ymax[, xmin, xmax]) Add a horizontal span (rectangle) across the axis. axis(*v, **kwargs) Convenience method for manipulating the x and y view limits and the aspect ratio of the plot. axvline([x, ymin, ymax]) Add a vertical line across the axes. axvspan(xmin, xmax[, ymin, ymax]) Add a vertical span (rectangle) across the axes. bar(left, height[, width, bottom]) Make a bar plot. barbs(*args, **kw) Plot a 2-D field of barbs. barh(bottom, width[, height, left]) Make a horizontal bar plot. boxplot(x[, notch, sym, vert, whis, ...]) Make a box and whisker plot. broken_barh(xranges, yrange, **kwargs) Plot horizontal bars. bxp(bxpstats[, positions, widths, vert, ...]) Drawing function for box and whisker plots. can_pan() Return True if this axes supports any pan/zoom button functionality. can_zoom() Return True if this axes supports the zoom box button functionality. change_geometry(numrows, numcols, num) change subplot geometry, e.g., from 1,1,1 to 2,2,3 cla() Clear the current axes. clabel(CS, *args, **kwargs) Label a contour plot. clear() clear the axes cohere(x, y[, NFFT, Fs, Fc, detrend, ...]) Plot the coherence between x and y. contains(mouseevent) Test whether the mouse event occured in the axes. contains_point(point) Returns True if the point (tuple of x,y) is inside the axes (the area defined by the its patch). contour(*args, **kwargs) Plot contours. contourf(*args, **kwargs) Plot contours. convert_xunits(x) For artists in an axes, if the xaxis has units support, convert_yunits(y) For artists in an axes, if the yaxis has units support, csd(x, y[, NFFT, Fs, Fc, detrend, window, ...]) Plot the cross-spectral density. drag_pan(button, key, x, y) Called when the mouse moves during a pan operation. draw(artist, renderer, *args, **kwargs) Draw everything (plot lines, axes, labels) draw_artist(a) This method can only be used after an initial draw which caches the renderer. end_pan() Called when a pan operation completes (when the mouse button errorbar(x, y[, yerr, xerr, fmt, ecolor, ...]) Plot an errorbar graph. eventplot(positions[, orientation, ...]) Plot identical parallel lines at specific positions. fill(*args, **kwargs) Plot filled polygons. fill_between(x, y1[, y2, where, interpolate]) Make filled polygons between two curves. fill_betweenx(y, x1[, x2, where]) Make filled polygons between two horizontal curves. findobj([match, include_self]) Find artist objects. format_coord(x, y) Return a format string formatting the x, y coord format_dateaxis() Pretty-formats the date axis (x-axis). format_xdata(x) Return x string formatted. format_ydata(y) Return y string formatted. get_adjustable() get_agg_filter() return filter function to be used for agg filter get_alpha() Return the alpha value used for blending - not supported on all get_anchor() get_animated() Return the artist’s animated state get_aspect() get_autoscale_on() Get whether autoscaling is applied for both axes on plot commands get_autoscalex_on() Get whether autoscaling for the x-axis is applied on plot commands get_autoscaley_on() Get whether autoscaling for the y-axis is applied on plot commands get_axes() Return the Axes instance the artist resides in, or None. get_axes_locator() return axes_locator get_axis_bgcolor() Return the axis background color get_axisbelow() Get whether axis below is true or not get_children() return a list of child artists get_clip_box() Return artist clipbox get_clip_on() Return whether artist uses clipping get_clip_path() Return artist clip path get_contains() Return the _contains test used by the artist, or None for default. get_cursor_props() Return the cursor propertiess as a (linewidth, color) get_data_ratio() Returns the aspect ratio of the raw data. get_data_ratio_log() Returns the aspect ratio of the raw data in log scale. get_datelimits() Shortcut to get_datelimits. get_datelims() Shortcut to get_datelimits. get_default_bbox_extra_artists() get_dlim() Returns the limits of the x axis as a DateArray. get_figure() Return the Figure instance the artist belongs to. get_frame_on() Get whether the axes rectangle patch is drawn get_freq() Returns the underlying frequency of the plot get_geometry() get the subplot geometry, e.g., 2,2,3 get_gid() Returns the group id get_images() return a list of Axes images contained by the Axes get_label() Get the label used for this artist in the legend. get_legend() Return the legend.Legend instance, or None if no legend is defined get_legend_handles_labels([legend_handler_map]) Return handles and labels for legend get_lines() Return a list of lines contained by the Axes get_navigate() Get whether the axes responds to navigation commands get_navigate_mode() Get the navigation toolbar button status: ‘PAN’, ‘ZOOM’, or None get_path_effects() get_picker() Return the picker object used by this artist get_position([original]) Return the a copy of the axes rectangle as a Bbox get_rasterization_zorder() Get zorder value below which artists will be rasterized get_rasterized() return True if the artist is to be rasterized get_renderer_cache() get_series() Returns the data part of the time series associated with the plot, as a (subclass of) MaskedArray. get_shared_x_axes() Return a copy of the shared axes Grouper object for x axes get_shared_y_axes() Return a copy of the shared axes Grouper object for y axes get_sketch_params() Returns the sketch parameters for the artist. get_snap() Returns the snap setting which may be: get_subplotspec() get the SubplotSpec instance associated with the subplot get_tightbbox(renderer[, call_axes_locator]) Return the tight bounding box of the axes. get_title([loc]) Get an axes title. get_transform() Return the Transform instance used by this artist. get_transformed_clip_path_and_affine() Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation. get_url() Returns the url get_visible() Return the artist’s visiblity get_window_extent(*args, **kwargs) get the axes bounding box in display space; args and get_xaxis() Return the XAxis instance get_xaxis_text1_transform(pad_points) Get the transformation used for drawing x-axis labels, which will add the given amount of padding (in points) between the axes and the label. get_xaxis_text2_transform(pad_points) Get the transformation used for drawing the secondary x-axis labels, which will add the given amount of padding (in points) between the axes and the label. get_xaxis_transform([which]) Get the transformation used for drawing x-axis labels, ticks and gridlines. get_xbound() Returns the x-axis numerical bounds where: get_xgridlines() Get the x grid lines as a list of Line2D instances get_xlabel() Get the xlabel text string. get_xlim() Get the x-axis range [left, right] get_xmajorticklabels() Get the xtick labels as a list of Text instances. get_xminorticklabels() Get the x minor tick labels as a list of matplotlib.text.Text instances. get_xscale() Return the xaxis scale string: linear, log, logit, symlog get_xticklabels([minor, which]) Get the x tick labels as a list of Text instances. get_xticklines() Get the xtick lines as a list of Line2D instances get_xticks([minor]) Return the x ticks as a list of locations get_yaxis() Return the YAxis instance get_yaxis_text1_transform(pad_points) Get the transformation used for drawing y-axis labels, which will add the given amount of padding (in points) between the axes and the label. get_yaxis_text2_transform(pad_points) Get the transformation used for drawing the secondary y-axis labels, which will add the given amount of padding (in points) between the axes and the label. get_yaxis_transform([which]) Get the transformation used for drawing y-axis labels, ticks and gridlines. get_ybound() Return y-axis numerical bounds in the form of get_ydata() get_ygridlines() Get the y grid lines as a list of Line2D instances get_ylabel() Get the ylabel text string. get_ylim() Get the y-axis range [bottom, top] get_ymajorticklabels() Get the major y tick labels as a list of Text instances. get_yminorticklabels() Get the minor y tick labels as a list of Text instances. get_yscale() Return the yaxis scale string: linear, log, logit, symlog get_yticklabels([minor, which]) Get the x tick labels as a list of Text instances. get_yticklines() Get the ytick lines as a list of Line2D instances get_yticks([minor]) Return the y ticks as a list of locations get_zorder() Return the Artist‘s zorder. grid([b, which, axis]) Turn the axes grids on or off. has_data() Return True if any artists have been added to axes. have_units() Return True if units are set on the x or y axes hexbin(x, y[, C, gridsize, bins, xscale, ...]) Make a hexagonal binning plot. hist(x[, bins, range, normed, weights, ...]) Plot a histogram. hist2d(x, y[, bins, range, normed, weights, ...]) Make a 2D histogram plot. hitlist(event) List the children of the artist which contain the mouse event event. hlines(y, xmin, xmax[, colors, linestyles, ...]) Plot horizontal lines at each y from xmin to xmax. hold([b]) Call signature: imshow(X[, cmap, norm, aspect, ...]) Display an image on the axes. in_axes(mouseevent) Return True if the given mouseevent (in display coords) invert_xaxis() Invert the x-axis. invert_yaxis() Invert the y-axis. is_figure_set() Returns True if the artist is assigned to a Figure. is_first_col() is_first_row() is_last_col() is_last_row() is_transform_set() Returns True if Artist has a transform explicitly set. ishold() return the HOLD status of the axes label_outer() set the visible property on ticklabels so xticklabels are legend(*args, **kwargs) Places a legend on the axes. locator_params([axis, tight]) Control behavior of tick locators. loglog(*args, **kwargs) Make a plot with log scaling on both the x and y axis. magnitude_spectrum(x[, Fs, Fc, window, ...]) Plot the magnitude spectrum. margins(*args, **kw) Set or retrieve autoscaling margins. matshow(Z, **kwargs) Plot a matrix or array as an image. minorticks_off() Remove minor ticks from the axes. minorticks_on() Add autoscaling minor ticks to the axes. pchanged() Fire an event when property changed, calling all of the registered callbacks. pcolor(*args, **kwargs) Create a pseudocolor plot of a 2-D array. pcolorfast(*args, **kwargs) pseudocolor plot of a 2-D array pcolormesh(*args, **kwargs) Plot a quadrilateral mesh. phase_spectrum(x[, Fs, Fc, window, pad_to, ...]) Plot the phase spectrum. pick(*args) Call signature: pickable() Return True if Artist is pickable. pie(x[, explode, labels, colors, autopct, ...]) Plot a pie chart. plot(*args, **kwargs) Plot lines and/or markers to the Axes. plot_date(x, y[, fmt, tz, xdate, ydate]) Plot with data with dates. properties() return a dictionary mapping property name -> value for all Artist props psd(x[, NFFT, Fs, Fc, detrend, window, ...]) Plot the power spectral density. quiver(*args, **kw) Plot a 2-D field of arrows. quiverkey(*args, **kw) Add a key to a quiver plot. redraw_in_frame() This method can only be used after an initial draw which caches the renderer. relim([visible_only]) Recompute the data limits based on current artists. remove() Remove the artist from the figure if possible. remove_callback(oid) Remove a callback based on its id. reset_datelimits() Reset the date range of the x axis to the date range of the underlying time series. reset_position() Make the original position the active position scatter(x, y[, s, c, marker, cmap, norm, ...]) Make a scatter plot of x vs y, where x and y are sequence like objects of the same lengths. semilogx(*args, **kwargs) Make a plot with log scaling on the x axis. semilogy(*args, **kwargs) Make a plot with log scaling on the y axis. set(**kwargs) A tkstyle set command, pass kwargs to set properties set_adjustable(adjustable) ACCEPTS: [ ‘box’ | ‘datalim’ | ‘box-forced’] set_agg_filter(filter_func) set agg_filter fuction. set_alpha(alpha) Set the alpha value used for blending - not supported on all backends. set_anchor(anchor) anchor set_animated(b) Set the artist’s animation state. set_aspect(aspect[, adjustable, anchor]) aspect set_autoscale_on(b) Set whether autoscaling is applied on plot commands set_autoscalex_on(b) Set whether autoscaling for the x-axis is applied on plot commands set_autoscaley_on(b) Set whether autoscaling for the y-axis is applied on plot commands set_axes(axes) Set the Axes instance in which the artist resides, if any. set_axes_locator(locator) set axes_locator set_axis_bgcolor(color) set the axes background color set_axis_off() turn off the axis set_axis_on() turn on the axis set_axisbelow(b) Set whether the axis ticks and gridlines are above or below most set_clip_box(clipbox) Set the artist’s clip Bbox. set_clip_on(b) Set whether artist uses clipping. set_clip_path(path[, transform]) Set the artist’s clip path, which may be: set_color_cycle(clist) Set the color cycle for any future plot commands on this Axes. set_contains(picker) Replace the contains test used by this artist. set_cursor_props(*args) Set the cursor property as: set_datelimits([start_date, end_date]) Shortcut to set_datelimits. set_datelims([start_date, end_date]) Shortcut to set_datelimits. set_dlim([start_date, end_date]) Sets the date limits of the plot to start_date and end_date. set_figure(fig) Set the class:Axes figure set_frame_on(b) Set whether the axes rectangle patch is drawn set_gid(gid) Sets the (group) id for the artist set_label(s) Set the label to s for auto legend. set_lod(on) Set Level of Detail on or off. set_navigate(b) Set whether the axes responds to navigation toolbar commands set_navigate_mode(b) Set the navigation toolbar button status; set_path_effects(path_effects) set path_effects, which should be a list of instances of set_picker(picker) Set the epsilon for picking used by this artist set_position(pos[, which]) Set the axes position with: set_rasterization_zorder(z) Set zorder value below which artists will be rasterized. set_rasterized(rasterized) Force rasterized (bitmap) drawing in vector backend output. set_series([series]) Sets the time series associated with the plot. set_sketch_params([scale, length, randomness]) Sets the sketch parameters. set_snap(snap) Sets the snap setting which may be: set_subplotspec(subplotspec) set the SubplotSpec instance associated with the subplot set_title(label[, fontdict, loc]) Set a title for the axes. set_transform(t) Set the Transform instance used by this artist. set_url(url) Sets the url for the artist set_visible(b) Set the artist’s visiblity. set_xbound([lower, upper]) Set the lower and upper numerical bounds of the x-axis. set_xlabel(xlabel[, fontdict, labelpad]) Set the label for the xaxis. set_xlim([left, right, emit, auto]) Call signature: set_xmargin(m) Set padding of X data limits prior to autoscaling. set_xscale(value, **kwargs) Call signature: set_xticklabels(labels[, fontdict, minor]) Call signature: set_xticks(ticks[, minor]) Set the x ticks with list of ticks set_ybound([lower, upper]) Set the lower and upper numerical bounds of the y-axis. set_ydata([series]) set_ylabel(ylabel[, fontdict, labelpad]) Set the label for the yaxis set_ylim([bottom, top, emit, auto]) Call signature: set_ymargin(m) Set padding of Y data limits prior to autoscaling. set_yscale(value, **kwargs) Call signature: set_yticklabels(labels[, fontdict, minor]) Call signature: set_yticks(ticks[, minor]) Set the y ticks with list of ticks set_zorder(level) Set the zorder for the artist. specgram(x[, NFFT, Fs, Fc, detrend, window, ...]) Plot a spectrogram. spy(Z[, precision, marker, markersize, ...]) Plot the sparsity pattern on a 2-D array. stackplot(x, *args, **kwargs) Draws a stacked area plot. start_pan(x, y, button) Called when a pan operation has started. stem(*args, **kwargs) Create a stem plot. step(x, y, *args, **kwargs) Make a step plot. streamplot(x, y, u, v[, density, linewidth, ...]) Draws streamlines of a vector flow. table(**kwargs) Add a table to the current axes. text(x, y, s[, fontdict, withdash]) Add text to the axes. tick_params([axis]) Change the appearance of ticks and tick labels. ticklabel_format(**kwargs) Change the ScalarFormatter used by default for linear axes. tricontour(*args, **kwargs) Draw contours on an unstructured triangular grid. tricontourf(*args, **kwargs) Draw contours on an unstructured triangular grid. tripcolor(*args, **kwargs) Create a pseudocolor plot of an unstructured triangular grid. triplot(*args, **kwargs) Draw a unstructured triangular grid as lines and/or markers. tsplot(*args, **kwargs) Plots the data parsed in argument to the current axes. twinx() Call signature: twiny() Call signature: update(props) Update the properties of this Artist from the dictionary prop. update_datalim(xys[, updatex, updatey]) Update the data lim bbox with seq of xy tups or equiv. update_datalim_bounds(bounds) Update the datalim to include the given update_datalim_numerix(x, y) Update the data lim bbox with seq of xy tups update_from(other) Copy properties from other to self. update_params() update the subplot position from fig.subplotpars violin(vpstats[, positions, vert, widths, ...]) Drawing function for violin plots. violinplot(dataset[, positions, vert, ...]) Make a violin plot. vlines(x, ymin, ymax[, colors, linestyles, ...]) Plot vertical lines. xaxis_date([tz]) Sets up x-axis ticks and labels that treat the x data as dates. xaxis_inverted() Returns True if the x-axis is inverted. xcorr(x, y[, normed, detrend, usevlines, ...]) Plot the cross correlation between x and y. yaxis_date([tz]) Sets up y-axis ticks and labels that treat the y data as dates. yaxis_inverted() Returns True if the y-axis is inverted.
TimeSeriesFigure¶
- class TimeSeriesFigure(**kwargs)¶
Based on matplotlib.figure.Figure
Create a new Figure object. All the subplots share the same time series.
The same parameters used for the creation of a standard Figure are accepted.
Parameters: series : {None, TimeSeries}, optional
Underlying time series. All the subplots of the figure will share the same series.
figsize : {None, tuple}
Size of the figure, as a tuple (width, height) in inches. If None, defaults to rc figure.figsize.
dpi : {None, int}, optional
Resolution in dots per inches. If None, defaults to rc figure.dpi
facecolor : {None, string}, optional
Background color. If None, defaults to rc figure.facecolor.
edgecolor : {None, string}, optional
Border color. If None, defaults to rc figure.edgecolor.
linewidth : {float, None}
Width of the patch edge line.
frameon : {True, False}
Whether to draw the frame around the figure.
Attributes
axes Read-only: list of axes in Figure dpi Methods
add_axes(*args, **kwargs) Add an axes at position rect [left, bottom, width, height] where all quantities are in fractions of figure width and height. add_axobserver(func) whenever the axes state change, func(self) will be called add_callback(func) Adds a callback function that will be called whenever one of the Artist‘s properties changes. add_subplot(*args, **kwargs) Adds a TimeSeriesPlot subplot to the current figure. add_tsplot(*args, **kwargs) Adds a TimeSeriesPlot subplot to the current figure. autofmt_xdate([bottom, rotation, ha]) Date ticklabels often overlap, so it is useful to rotate them and right align them. clear() Clear the figure – synonym for clf. clf([keep_observers]) Clear the figure. colorbar(mappable[, cax, ax, use_gridspec]) Create a colorbar for a ScalarMappable instance, mappable. contains(mouseevent) Test whether the mouse event occurred on the figure. convert_xunits(x) For artists in an axes, if the xaxis has units support, convert_yunits(y) For artists in an axes, if the yaxis has units support, delaxes(a) remove a from the figure and update the current axes draw(artist, renderer, *args, **kwargs) Render the figure using matplotlib.backend_bases.RendererBase instance renderer. draw_artist(a) draw matplotlib.artist.Artist instance a only – figimage(X[, xo, yo, alpha, norm, cmap, ...]) Adds a non-resampled image to the figure. findobj([match, include_self]) Find artist objects. gca(**kwargs) Get the current axes, creating one if necessary get_agg_filter() return filter function to be used for agg filter get_alpha() Return the alpha value used for blending - not supported on all get_animated() Return the artist’s animated state get_axes() get_children() get a list of artists contained in the figure get_clip_box() Return artist clipbox get_clip_on() Return whether artist uses clipping get_clip_path() Return artist clip path get_contains() Return the _contains test used by the artist, or None for default. get_default_bbox_extra_artists() get_dpi() Return the dpi as a float get_edgecolor() Get the edge color of the Figure rectangle get_facecolor() Get the face color of the Figure rectangle get_figheight() Return the figheight as a float get_figure() Return the Figure instance the artist belongs to. get_figwidth() Return the figwidth as a float get_frameon() get the boolean indicating frameon get_gid() Returns the group id get_label() Get the label used for this artist in the legend. get_path_effects() get_picker() Return the picker object used by this artist get_rasterized() return True if the artist is to be rasterized get_size_inches() Returns the current size of the figure in inches (1in == 2.54cm) as an numpy array. get_sketch_params() Returns the sketch parameters for the artist. get_snap() Returns the snap setting which may be: get_tight_layout() Return the Boolean flag, True to use :meth`tight_layout` when drawing. get_tightbbox(renderer) Return a (tight) bounding box of the figure in inches. get_transform() Return the Transform instance used by this artist. get_transformed_clip_path_and_affine() Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation. get_url() Returns the url get_visible() Return the artist’s visiblity get_window_extent(*args, **kwargs) get the figure bounding box in display space; kwargs are void get_zorder() Return the Artist‘s zorder. ginput([n, timeout, show_clicks, mouse_add, ...]) Call signature: have_units() Return True if units are set on the x or y axes hitlist(event) List the children of the artist which contain the mouse event event. hold([b]) Set the hold state. is_figure_set() Returns True if the artist is assigned to a Figure. is_transform_set() Returns True if Artist has a transform explicitly set. legend(handles, labels, *args, **kwargs) Place a legend in the figure. pchanged() Fire an event when property changed, calling all of the registered callbacks. pick(mouseevent) call signature: pickable() Return True if Artist is pickable. properties() return a dictionary mapping property name -> value for all Artist props remove() Remove the artist from the figure if possible. remove_callback(oid) Remove a callback based on its id. savefig(*args, **kwargs) Save the current figure. sca(a) Set the current axes to be a and return a set(**kwargs) A tkstyle set command, pass kwargs to set properties set_agg_filter(filter_func) set agg_filter fuction. set_alpha(alpha) Set the alpha value used for blending - not supported on all backends. set_animated(b) Set the artist’s animation state. set_axes(axes) Set the Axes instance in which the artist resides, if any. set_canvas(canvas) Set the canvas the contains the figure set_clip_box(clipbox) Set the artist’s clip Bbox. set_clip_on(b) Set whether artist uses clipping. set_clip_path(path[, transform]) Set the artist’s clip path, which may be: set_contains(picker) Replace the contains test used by this artist. set_dpi(val) Set the dots-per-inch of the figure set_edgecolor(color) Set the edge color of the Figure rectangle set_facecolor(color) Set the face color of the Figure rectangle set_figheight(val) Set the height of the figure in inches set_figure(fig) Set the Figure instance the artist belongs to. set_figwidth(val) Set the width of the figure in inches set_frameon(b) Set whether the figure frame (background) is displayed or invisible set_gid(gid) Sets the (group) id for the artist set_label(s) Set the label to s for auto legend. set_lod(on) Set Level of Detail on or off. set_path_effects(path_effects) set path_effects, which should be a list of instances of set_picker(picker) Set the epsilon for picking used by this artist set_rasterized(rasterized) Force rasterized (bitmap) drawing in vector backend output. set_size_inches(w,h[, forward]) Set the figure size in inches (1in == 2.54cm) set_sketch_params([scale, length, randomness]) Sets the sketch parameters. set_snap(snap) Sets the snap setting which may be: set_tight_layout(tight) Set whether tight_layout is used upon drawing. set_transform(t) Set the Transform instance used by this artist. set_url(url) Sets the url for the artist set_visible(b) Set the artist’s visiblity. set_zorder(level) Set the zorder for the artist. show([warn]) If using a GUI backend with pyplot, display the figure window. subplots_adjust(*args, **kwargs) Call signature: suptitle(t, **kwargs) Add a centered title to the figure. text(x, y, s, *args, **kwargs) Add text to figure. tight_layout([renderer, pad, h_pad, w_pad, rect]) Adjust subplot parameters to give specified padding. update(props) Update the properties of this Artist from the dictionary prop. update_from(other) Copy properties from other to self. waitforbuttonpress([timeout]) Call signature:
Functions¶
- add_yaxis(fsp=None, position='right', yscale=None, basey=10, subsy=None)¶
Adds a second y-axis to a TimeSeriesPlot. This function can also be used as a method.
Parameters: fsp : {None, TimeSeriesPlot}
Subplot to which the secondary y-axis is added. If None, the current subplot is selected: in that case, it should be a valid TimeSeriesPlot. When used as a TimeSeriesPlot method, this parameter points automatically to the calling subplot.
position : {string}
Position of the new axis, as either 'left' or 'right'.
yscale : {string}
Scale of the new axis, as either 'log', 'linear' or None. If None, uses the same scale as the first y axis.
basey : {integer}
Base of the logarithm for the new axis (if needed).
subsy : {sequence}
Sequence of the location of the minor ticks; None defaults to autosubs, which depend on the number of decades in the plot. Eg for base 10, subsy=(1,2,5) will put minor ticks on 1, 2, 5, 11, 12,15, 21, .... To turn off minor ticking, set subsy=[].
Raises: TypeError
If the selected subplot is not a valid TimeSeriesPlot object.
- add_tsplot(axes, *args, **kwargs)¶
Adds a TimeSeriesPlot to the current figure.
Parameters: args : var
Mandatory arguments for the creation of the subplot. These arguments should be given as nb_of_rows, nb_of_columns, plot_number, or as a single 3-digit number if the 3 previous numbers are all lower than 10.
- tsplot(series, *args, **kwargs)¶
Plots the series to the current TimeSeriesPlot. If the current plot is not a TimeSeriesPlot, a new TimeSeriesFigure is created.
Parameters: series : TimeSeries
The time series to plot
args : var
Mandatory arguments for the creation of the subplot. These arguments should be given as nb_of_rows, nb_of_columns, plot_number, or as a single 3-digit number if the 3 previous numbers are all lower than 10.
kwargs : var
Optional arguments for the creation of the subplot.
- tsfigure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, subplotpars=None, series=None, FigureClass=<class 'scikits.timeseries.lib.plotlib.TimeSeriesFigure'>)¶
Creates a new TimeSeriesFigure object.
Parameters: num : {None, int}, optional
Number of the figure. If None, a new figure is created and num is incremented.
figsize : {None, tuple}
Size of the figure, as a tuple (width, height) in inches. If None, defaults to rc figure.figsize.
dpi : {None, int}, optional
Resolution in dots per inches. If None, defaults to rc figure.dpi.
facecolor : {None, string}, optional
Background color. If None, defaults to rc figure.facecolor.
edgecolor : {None, string}, optional
Border color. If None, defaults to rc figure.edgecolor.
frameon : {True, False}
Whether to draw the frame around the figure.
subplotpars : {None, var}
A SubplotParams instance, defaults to rc
FigureClass : FigureClass
Class of the figure to create
Extensions to matplotlib¶
- add_generic_subplot(figure_instance, *args, **kwargs)¶
Generalizes the matplotlib.Figure.add_subplot method of Figure to generic subplots. The specific Subplot object class to add is given through the keywords SubplotClass or class.
Parameters: figure_instance : Figure object
Figure to which the generic subplot should be attached.
args : {var}
Miscellaneous arguments to the subplot.
kwargs : {Dictionary}
Optional keywords. The same keywords as Subplot are recognized, with the addition of:
- SubplotClass : {string} Type of subplot.
- subclass : {string} Shortcut to SubplotClass.
- any keyword required by the SubplotClass subclass.
Ticks helpers¶
- class TimeSeries_DateLocator(freq, minor_locator=False, dynamic_mode=True, base=1, quarter=1, month=1, day=1, plot_obj=None)¶
Locates the ticks along an axis controlled by a DateArray.
Parameters: freq : {var}
Valid frequency specifier.
minor_locator : {False, True}, optional
Whether the locator is for minor ticks (True) or not.
dynamic_mode : {True, False}, optional
Whether the locator should work in dynamic mode.
base : {int}, optional
quarter : {int}, optional
month : {int}, optional
day : {int}, optional
Attributes
axis Methods
__call__() Return the locations of the ticks. asmajor() Returns the locator set to major mode. asminor() Returns the locator set to minor mode. autoscale() Sets the view limits to the nearest multiples of base that contain the data. create_dummy_axis(**kwargs) pan(numsteps) Pan numticks (can be positive or negative) raise_if_exceeds(locs) raise a RuntimeError if Locator attempts to create more than refresh() refresh internal information based on current lim set_axis(axis) set_bounds(vmin, vmax) set_data_interval(vmin, vmax) set_params(**kwargs) Do nothing, and rase a warning. set_view_interval(vmin, vmax) tick_values(vmin, vmax) Return the values of the located ticks given vmin and vmax. view_limits(vmin, vmax) select a scale for the range from vmin to vmax zoom(direction) Zoom in/out on axis; if direction is >0 zoom in, else zoom out
- class TimeSeries_DateFormatter(freq, minor_locator=False, dynamic_mode=True, plot_obj=None)¶
Formats the ticks along an axis controlled by a DateArray.
Parameters: freq : {int, string}
Valid frequency specifier.
minor_locator : {False, True}
Whether the current formatter should apply to minor ticks (True) or major ticks (False).
dynamic_mode : {True, False}
Whether the formatter works in dynamic mode or not.
Attributes
axis Methods
__call__(x[, pos]) asmajor() Returns the fromatter set to major mode. asminor() Returns the formatter set to minor mode. create_dummy_axis(**kwargs) fix_minus(s) Some classes may want to replace a hyphen for minus with the proper unicode symbol (U+2212) for typographical correctness. format_data(value) format_data_short(value) return a short string version get_offset() set_axis(axis) set_bounds(vmin, vmax) set_data_interval(vmin, vmax) set_locs(locs) Sets the locations of the ticks set_view_interval(vmin, vmax)
| author: | Pierre GF Gerard-Marchant & Matt Knox |
|---|---|
| contact: | pierregm_at_uga_dot_edu - mattknow_ca_at_hotmail_dot_com |
