currentscape.plotting¶
Plotting-related functions.
Functions
|
Adjust Subplots. |
|
Apply labels, ticks, xlim and ylim to current / ion concentration plots. |
|
Produce a black line meant to distinguish between 2 plots in log scales. |
Configure matplotlib rcParams. |
|
|
Get colormap according to input, and add black then white colors at the end. |
|
Get colors from colormap, depending on maximum number of colors. |
|
Get colors and hatches and lines lists from color indexes list. |
|
Return the total number of rows cumulated by all the subplots. |
|
Plot x labels and x ticklabels. |
Remove ticks (but not ytick label) and frame. |
|
Remove all ticks (including ytick label) and top & bottom frames. |
|
|
Save figure in output according to config file. |
|
Select color of the ith element when not using patterns. |
|
Set text as label on the y axis. |
|
Show vertical gridlines corresponding to the x ticks. |
|
Plot currentscape using bars instead of imshow. |
|
Plot currentscape using fill_between. |
- currentscape.plotting.adjust(adjust_left, adjust_right, adjust_top, adjust_bottom)[source]¶
Adjust Subplots.
- Parameters:
adjust_left (float or None) – position of the left edge of the subplots, None to use matplotlib default
adjust_right (float or None) – position of the right edge of the subplots, None ot use matplotlib default
adjust_top (float or None) – position of the top edge of the subplots, None to use matplotlib default
adjust_bottom (float or None) – position of the bottom edge of the subplots, None to use matplotlib default
- currentscape.plotting.apply_labels_ticks_and_lims(ax, c, xticks, xlim, ylim, positive=True, config_key='current')[source]¶
Apply labels, ticks, xlim and ylim to current / ion concentration plots.
- Parameters:
ax (matplotlib.axes) – currentscape axis
c (dict) – config
xticks (list) – tick positions on the x axis
xlim (list of 2 floats) – limits of x axis
ylim (list of 2 floats) – limits of y axis (can be different from ylim from config)
positive (bool) – True for positive data, False for negative data
config_key (str) – key for getting data from config. Should be ‘current’ or ‘ions’
- currentscape.plotting.black_line_log_scale(ax, ylim, xlim, bl_thickness)[source]¶
Produce a black line meant to distinguish between 2 plots in log scales.
The black line is plotted at the bottom of the upper plot. This is a trick to avoid frames masking some of the data.
- Parameters:
ax (matplotlib.axes) – currentscape axis
ylim (list of 2 floats) – limits of the y axis
xlim (list of 2 floats) – limits of the x axis
bl_thickness (float) – thickness of the black line separating the two plots, in percentage of the y axis size
Returns ylim, because the bottom y limit is changing by adding the black line.
- currentscape.plotting.configure_mpl_rcParams(c)[source]¶
Configure matplotlib rcParams.
- Parameters:
c (dict) – config
- currentscape.plotting.get_colormap(cmap, n_colors, use_patterns, N_curr, N_ion)[source]¶
Get colormap according to input, and add black then white colors at the end.
The black color is used to create a black line separating currentscapes plots, and the white color is used when there is no data (e.g. no inward or outward current).
- Parameters:
cmap (str) – colormap name
n_colors (int) – number of colors to extract IF use_patterns and n_colors>N_curr
use_patterns (bool) – True if currentscape plot uses bars and mixes color and pattern
N_curr (int) – number of currents
N_ion (int) – number of ion concentrations
- currentscape.plotting.get_colors(cmap, n_col)[source]¶
Get colors from colormap, depending on maximum number of colors.
- Parameters:
cmap (str) – colormap name
n_col (int) – number of colors to extract
- Returns:
a list of matplotlib colors launch_warning (bool): True to warn that colormap lacks colors
- currentscape.plotting.get_colors_hatches_lines_lists(c, curr_idxs, cmap, mapper=None)[source]¶
Get colors and hatches and lines lists from color indexes list.
- Parameters:
c (dict) – config
curr_idxs (ndarray of ints or int) – list of indexes of currents
cmap (matplotlib.colors.Colormap) – colormap
mapper (int) – number used to mix colors and patterns
- currentscape.plotting.get_rows_tot(c, ions)[source]¶
Return the total number of rows cumulated by all the subplots.
- Parameters:
c (dict) – config
ions (IonConcentrations) – ion concentration dataset
- currentscape.plotting.plot_x_labels(ax, c, xticks)[source]¶
Plot x labels and x ticklabels.
- Parameters:
ax (matplotlib.axes) – axis
c (dict) – config
xticks (list) – tick positions on the x axis
- currentscape.plotting.remove_ticks_and_frame(ax)[source]¶
Remove ticks (but not ytick label) and frame.
- Parameters:
ax (matplotlib.axes) – axis
- currentscape.plotting.remove_ticks_and_frame_for_bar_plot(ax)[source]¶
Remove all ticks (including ytick label) and top & bottom frames.
- Parameters:
ax (matplotlib.axes) – axis
- currentscape.plotting.save_figure(fig, c)[source]¶
Save figure in output according to config file.
- Parameters:
fig (matplotlib.figure.Figure) – figure
c (dict) – config
- currentscape.plotting.select_color(cmap, i, N_col)[source]¶
Select color of the ith element when not using patterns.
There is a +2 in the formula to account for the black and white in colormap.
- Parameters:
cmap (matplotlib.colors.Colormap) – colormap
i (int) – index of element (current/ion)
N_col (int) – total number of elements
- currentscape.plotting.set_label(ax, x, y, label, textsize)[source]¶
Set text as label on the y axis.
- Parameters:
ax (matplotlib.axes) – axis
x (float) – x position of the label
y (float) – y position of the label
label (str) – text to be displayed as label
textsize (int) – text size in pixels
- currentscape.plotting.show_xgridlines(ax, c, xticks, ylim=None)[source]¶
Show vertical gridlines corresponding to the x ticks.
- Parameters:
ax (matplotlib.axes) – axis
c (dict) – config
xticks (list) – tick positions on the x axis
ylim (list of 2 floats) – limits of y axis
- currentscape.plotting.stackplot_with_bars(ax, cnorm, inames, cmap, c, N_curr, mapper=None, top_to_bottom=True)[source]¶
Plot currentscape using bars instead of imshow.
That way, hatches (patterns) can be used.
- Parameters:
ax (matplotlib.axes) – currentscape axis
cnorm (DataSet) – object containing data (e.g. currents data and idxs)
inames (ndarray of ints) – indexes to new name order (new_names = names[inames])
cmap (matplotlib.colors.Colormap) – colormap
c (dict) – config
N_curr (int) – total number of currents
mapper (int) – number used to mix colors and patterns
top_to_bottom (bool) – if True, plot from top to bottom. if False, plot from bottom to top
Returns the size modified by sum chunks (reduced x resolution)
- currentscape.plotting.stackplot_with_fill_between(ax, cnorm, inames, cmap, c, N_curr, mapper=None, top_to_bottom=True)[source]¶
Plot currentscape using fill_between.
- Parameters:
ax (matplotlib.axes) – currentscape axis
cnorm (DataSet) – object containing data (e.g. currents data and idxs)
inames (ndarray of ints) – indexes to new name order (new_names = names[inames])
cmap (matplotlib.colors.Colormap) – colormap
c (dict) – config
N_curr (int) – total number of currents
mapper (int) – number used to mix colors and patterns
top_to_bottom (bool) – if True, plot from top to bottom. if False, plot from bottom to top