plotlib module

class IMTreatment.plotlib.plotlib.ButtonManager(displayers, xlabel='', ylabel='', sharecb=True, normcb=None, play_interval=2)[source]

Bases: object

activate_buttons()[source]
add_displayers(displayers)[source]
close()[source]
deactivate_buttons()[source]
goto()[source]
goto_beg(event)[source]
goto_end(event)[source]
goto_lims()[source]
keyf(event)[source]
nextf(event)[source]
playf(event)[source]
prevf(event)[source]
save()[source]
save_animation(animpath, fields='all', writer='ffmpeg', fps=24, title='', artist='IMTreatment', comment='', bitrate=-1, codec='ffv1', dpi=150)[source]

Save the button manager displays as an animation.

Parameters:
  • animpath (string) – Path where to save animation
  • fields (string or 2x1 list of numbers) – Fields interval to save. Default is ‘all’ for all the fields.
  • writer (string) – Name of the writer to use (available writers are listed in ‘matplotlib.animation.writers.list()’
  • codec (string) – One of the codec of the choosen writer (default to ‘ffv1’)
  • fps (integer) – Number of frame per second (default to 24)
  • bitrate (integer) – Video bitrate in kb/s (default to -1) Set this to -1 for letting the writter choose.
  • dpi (integer) – dpi of the video images before compression (default to 150)
  • artist, comment (title,) – Information added to the file metadata
set_lims(lim1=None, lim2=None)[source]
slid(event)[source]
timer_play()[source]
update()[source]
class IMTreatment.plotlib.plotlib.DataCursorPoints(ax, tolerance=5, offsets=(-20, 20), formatter=None, display_all=False, color=(0.76, 0.86, 0.92))[source]

Bases: object

annotate(ax)[source]

Draws and hides the annotation box for the given axis “ax”.

get_color_from_event(event)[source]
snap(x, y)[source]

Return the value in self._points closest to (x, y).

class IMTreatment.plotlib.plotlib.DataCursorTextDisplayer(displayer, i=None, precision=3)[source]

Bases: object

class IMTreatment.plotlib.plotlib.Displayer(x, y, values=None, data_type=None, sharebds=True, buffer_size=100, **kwargs)[source]

Bases: object

draw(i=None, ax=None, cb=False, remove_current=False, rescale=True)[source]
draw_multiple(inds, sharecb=False, sharex=False, sharey=False, ncol=None, nrow=None)[source]
draw_new(i=None, ax=None, cb=False, rescale=True)[source]
field_1D_default_args = {'aspect': 'equal', 'interpolation': 'nearest', 'kind': 'matrix'}
field_2D_default_args = {'aspect': 'equal', 'kind': 'quiver'}
get_data(i=None)[source]
get_data_at_point(x, y, i=None)[source]
get_global_norm()[source]
get_norm(i)[source]
points_default_args = {'kind': 'scatter'}
profile_default_args = {'kind': 'plot'}
class IMTreatment.plotlib.plotlib.Formatter(order=0, fformat='%1.1f', offset=True, mathtext=True)[source]

Bases: matplotlib.ticker.ScalarFormatter

IMTreatment.plotlib.plotlib.annotate_multiple(s, xy, xytext, *args, **kwargs)[source]
IMTreatment.plotlib.plotlib.colored_plot(x, y, z=None, log='plot', min_colors=1000, colorbar=False, color_label='', **kwargs)[source]

Plot a colored line with coordinates x and y

Parameters:
  • y (x,) – coordinates of each points
  • z (nx1 array of number, optional) – values for the color
  • log (string, optional) – Type of axis, can be ‘plot’ (default), ‘semilogx’, ‘semilogy’, ‘loglog’
  • min_colors (integer, optional) – Minimal number of different colors in the plot (default to 1000).
  • colorbar (bool) –

    .

  • color_label (string, optional) – Colorbar label if color is an array.
  • kwargs (dict, optional) – list of arguments to pass to the common plot (see matplotlib documentation).
IMTreatment.plotlib.plotlib.get_color_cycles()[source]
IMTreatment.plotlib.plotlib.get_color_gradient(cmap='jet', number=10)[source]

Return a gradient of color for plot uses.

IMTreatment.plotlib.plotlib.is_sorted(data)[source]
IMTreatment.plotlib.plotlib.make_cmap(colors, position=None, name='my_cmap')[source]

Return a color map cnstructed with the geiven colors and positions.

Parameters:
  • colors (Nx1 list of 3x1 tuple) – Each color wanted on the colormap. each value must be between 0 and 1.
  • positions (Nx1 list of number, optional) – Relative position of each color on the colorbar. default is an uniform repartition of the given colors.
  • name (string, optional) – Name for the color map
IMTreatment.plotlib.plotlib.make_discrete_cmap(interv_centers, cmap=None)[source]

Create a discrete map, with intervals centered on the given values.

IMTreatment.plotlib.plotlib.make_segments(x, y)[source]

Create list of line segments from x and y coordinates, in the correct format for LineCollection: an array of the form numlines x (points per line) x 2 (x and y) array

IMTreatment.plotlib.plotlib.mark_axe(txt, ax=None, loc=2, pad=0.3, borderpad=0.0, font_props=None, frameon=True)[source]
IMTreatment.plotlib.plotlib.save_animation(animpath, fig=None, fields='all', writer='ffmpeg', fps=24, title='', artist='IMTreatment', comment='', bitrate=-1, codec='ffv1', dpi=150)[source]

Save the current button manager displays as an animation.

Parameters:
  • animpath (string) – Path where to save animation
  • fig (Figure instance) – Figure to save the animation from (if None, get the current one)
  • fields (string or 2x1 list of numbers) – Fields interval to save. Default is ‘all’ for all the fields.
  • writer (string) – Name of the writer to use (available writers are listed in ‘matplotlib.animation.writers.list()’
  • codec (string) – One of the codec of the choosen writer (default to ‘ffv1’)
  • fps (integer) – Number of frame per second (default to 24)
  • bitrate (integer) – Video bitrate in kb/s (default to -1) Set this to -1 for letting the writter choose.
  • dpi (integer) – dpi of the video images before compression (default to 150)
  • artist, comment (title,) – Information added to the file metadata
IMTreatment.plotlib.plotlib.use_perso_style()[source]

Change matplotlib default style to something nicer