Documentation
Submodules
- phenigraph.objet.C1: str = '#6307ba'
Violet / Purple
- phenigraph.objet.C10: str = '#c6403c'
Rouge pastel / Pastel red
- phenigraph.objet.C11: str = '#d39d5d'
Beige
- phenigraph.objet.C12: str = '#25355d'
Bleu / Blue
- phenigraph.objet.C13: str = '#fcc100'
Jaune / Yellow
- phenigraph.objet.C14: str = '#7ab5fa'
Bleu ciel / Light blue
- phenigraph.objet.C15: str = '#fc2700'
Orange foncé / Dark orange
- phenigraph.objet.C16: str = '#0fc88f'
Bleu-Vert / Blue-Green
- phenigraph.objet.C17: str = '#a8173b'
Rouge cerise / Red
- phenigraph.objet.C18: str = '#1812c4'
Bleu foncé / Dark blue
- phenigraph.objet.C19: str = '#000000'
Noir / Black
- phenigraph.objet.C2: str = '#16b5fa'
Cyan
- phenigraph.objet.C20: str = '#707070'
Gris / Grey
- phenigraph.objet.C3: str = '#2ad500'
Vert clair / Light green
- phenigraph.objet.C4: str = '#145507'
vert foncé / Dark green
- phenigraph.objet.C5: str = '#ff8e00'
Orange
- phenigraph.objet.C6: str = '#cb0d17'
Rouge / Red
- phenigraph.objet.C7: str = '#5694b2'
Bleu pastel / Pastel blue
- phenigraph.objet.C8: str = '#569a57'
Vert pastel / Pastel green
- phenigraph.objet.C9: str = '#b986b9'
Lavande
- phenigraph.objet.Ctrensp: tuple = (0, 0, 0, 0)
completely transparent color (to use for hiding curves for exemple)
- class phenigraph.objet.Graphique(filename: str = '', directory: str = '', set_phenigraph_style: bool = True)[source]
Bases:
object
The purpose of this object is to make it easier to create and manipulate graphs It contains all the variables required to plot a graph on an axis It can be used to display the graph, save it as a .png file and save it using a .npy format in order to avoid having to easily regenerate the graph in a reproducible way.
————————Handling procedures—————————-
- To initialise a Graphique :
For a new Graphique:
`gr=Graphique()`
- To open a Graphique with name
`n`
in directory`f`
: (
`n`
and`f`
are two strings, by default`f`
is the current working directory) e.g.`f="../Images/Graphics"`
and`n="test_graphique"`
. (the`.npz`
extension is not mandatory) : -`gr=Graphique(n)`
if`n`
is in the current directory -`gr=Graphique(n, f)`
otherwise
- To open a Graphique with name
- To save a Graphique :
- Assign a name to the graphic, without using an extension :
`gr.filename = "new_name"`
The default name is graph_without_name. If you want to save several Graphiques in the same folder it is therefore important to give them a name (not automatically)
- If necessary, assign a directory for saving:
`gr.directory=‘new_directory’`
By default, the location is the current working directory.
- To save the object :
`gr.save()`
- To save the figure :
- Assign an extension if necessary (by default the extension is svg).
Possible extensions are those available via the matplotlib library: ‘png’, ‘pdf’, ‘svg’, etc.
`gr.ext=".new_extension"`
`gr.save_figure()`
- To show the Graphique :
`gr.show()`
- To add a line (equivalent to plt.plot) :
`gr.line(x, y, **args)`
with x and y the list(s)/ndarray to plot and
`**args`
are all the ather arguments of plt.plot() Can be repeated as many times as required- To add a histogram :
`gr.histogram(values, weight=[], normalisation=True, statistic=‘sum’, bins=10, range=None, **args)`
:
- where
values is the array, the list of values to classify
weights is a list giving a possible weight for each value
normalisation indicates whether the histogram should be normalised
The other arguments are the same as
`plt.hist()`
Can be repeated as many times as necessary
- To add an image :
`gr.image(array,x_axis,y_axis,**args)`
- where :
`array`
represents the image to be displayed`axis_x`
and`axis_y`
give the graduations of the image axes`**args`
all the other possible arguments for displaying an image
- To add contours :
`gr.contours(self, contours=np.array([[]]), x_axe=None, y_axe=None, **args)`
:
- where
`**args`
gives the possible arguments for`plt.contours()`
To add level lines to an image complete
`**args`
, leaving the other arguments by default
- To add a polygon (coloured area delimited by a list of points) :
`gr.polygon(ind,alpha0=0.7, facecolor=‘C3’,**args)`
with
`ind`
an array/list of dimension (n,2) where n is the number of points.`ind[:,0]`
corresponds to the abscissas of the points and`ind[:1]`
corresponds to the to the ordinates. Can be repeated as many times as necessaryTo display several Graphique in one, use a Multigraph
- config_ax(axis: str = 'bl', **kwargs) None [source]
Additionals configurations for ax
Parameters
- axisstr, optional, {“bl”, “tl”, “br”, “tr”, “all”}, default=”bl”
- The positions of x-y axis to config:
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
“all” will configurate aull axis
- kwargs
Keywords available (see matplotlib documentation): -
`sharex`
,`sharey`
Axes, optional The x- or y-axis isshared with the x- or y-axis in the input Axes. Note that it is not possible to unshare axes. -`frameonbool`
: default=True Whether the Axes frame is visible. -`box_aspect`
: float, optional Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details. -`forward_navigation_events`
: bool or “auto”, default: “auto” Control whether pan/zoom events are passed through to Axes below this one. “auto” is True for axes with an invisible patch and False otherwise. - Other optional keyword arguments: – adjustable {‘box’, ‘datalim’} – agg_filter : a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image – alpha : scalar or None – anchor : (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} – animated : bool – aspect : {‘auto’, ‘equal’} or float – autoscale_on : bool – autoscalex_on – autoscaley_on – axes_locator : Callable[[Axes, Renderer], Bbox] – axisbelow : bool or ‘line’ – box_aspect : float or None – clip_on : bool – facecolor or fc : color – figure : Figure – forward_navigation_events : bool or “auto” – frame_on : bool – gid : str – in_layout : bool – label : object – mouseover : bool – navigate : bool – navigate_mode – picker : None or bool or float – position : [left, bottom, width, height] – rasterization_zorder : float or None – rasterized : bool – sketch_params : (scale: float, length: float, randomness: float) – snap : bool or None – subplotspec – title : str – url : str – visible : bool – xbound : (lower: float, upper: float) – xlabel : str – xlim : (left: float, right: float) – xmargin : float greater than -0.5 – xscale – xticklabels – xticks – ybound : (lower: float, upper: float) – ylabel : str – ylim : (bottom: float, top: float) – ymargin : float greater than -0.5 – yscale – yticklabels – yticks – zorder : float
Returns
None
See Also
- matplotlib.axes.set
The function used with kwargs
- config_colorbar(index_colorbar: int = 9223372036854775807, ticks: list | ndarray | None = None, **kwargs) None [source]
Colorbar additianal parameter
Parameters
- index_colorbarint, optional
The index of the colorbar (default the parameters are added for all colorbars)
- tickslist[float] | array_like
The colorbar’s ticks. If None, ticks are determined automatically from the input.
- kwargs
the parameter dictionary
Returns
None
- config_enrg_fig(**kwargs) None [source]
Additionals parameters for the Figure saving
Parameters
kwargs
- figsize 2-tuple of floats, default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Figure dimension (width, height) in inches.
- dpi float, default: rcParams[“figure.dpi”] (default: 100.0)
Dots per inch.
- facecolor default: rcParams[“figure.facecolor”] (default: ‘white’)
The figure patch facecolor.
- edgecolor default: rcParams[“figure.edgecolor”] (default: ‘white’)
The figure patch edge color.
- linewidth float
The linewidth of the frame (i.e. the edge linewidth of the figure patch).
- frameon bool, default: rcParams[“figure.frameon”] (default: True)
If False, suppress drawing the figure background patch.
layout {‘onstrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}, default: None
- The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations
(labels, ticks, etc). Note that layout managers can have significant performance penalties.
- ‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes
decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
- ‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the
subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
‘none’: Do not use a layout engine.
- A LayoutEngine instance. Builtin layout classes are ConstrainedLayoutEngine and TightLayoutEngine,
- more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to
provide their own layout engine.
- If not given, fall back to using the parameters tight_layout and constrained_layout, including their
config defaults rcParams[“figure.autolayout”] (default: False) and rcParams[“figure.constrained_layout.use”] (default: False).
alpha scalar or None
animated bool
clip_on bool
constrained_layout unknown
constrained_layout_pads unknown
dpi float
edgecolor color
facecolor color
figheight float
figwidth float
frameon bool
gid str
in_layout bool
label object
layout_engine {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}
linewidth number
mouseover bool
picker None or bool or float
rasterized bool
size_inches (float, float) or float
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tight_layout unknown
transform Transform
url str
visible bool
zorder float
Returns
None
See Also
matplotlib.figure.Figure.savefig
- config_fig(**kwargs) None [source]
Additionnals parameters to configure the Figure
Parameters
- kwargs
- figsize2tuple of floats, default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Figure dimension (width, height) in inches.
- dpi float, default: rcParams[“figure.dpi”] (default: 100.0)
Dots per inch.
- facecolor default: rcParams[“figure.facecolor”] (default: ‘white’)
The figure patch facecolor.
- edgecolor default: rcParams[“figure.edgecolor”] (default: ‘white’)
The figure patch edge color.
- linewidthfloat
The linewidth of the frame (i.e. the edge linewidth of the figure patch).
- frameonbool, default: rcParams[“figure.frameon”] (default: True)
If False, suppress drawing the figure background patch.
layout {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}, default: None
- The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations
(labels, ticks, etc). Note that layout managers can have significant performance penalties.
‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
- ‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between
fixed-aspect-ratio Axes. Best for simple grids of Axes.
‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
‘none’: Do not use a layout engine.
A LayoutEngine instance. Builtin layout classes are ConstrainedLayoutEngine and TightLayoutEngine, more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to provide their own layout engine.
If not given, fall back to using the parameters tight_layout and constrained_layout, including their config defaults rcParams[“figure.autolayout”] (default: False) and rcParams[“figure.constrained_layout.use”] (default: False).
alpha scalar or None
animated bool
clip_on bool
constrained_layout unknown
constrained_layout_pads unknown
dpi float
edgecolor color
facecolor color
figheight float
figwidth float
frameon bool
gid str
in_layout bool
layout_engine {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}
linewidth number
mouseover bool
picker None or bool or float or callable
rasterized bool
size_inches (float, float) or float
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tight_layout
url str
visible bool
zorder float
Returns
None
See Also
matplotlib.pyplot.Figure
- config_font(**kwargs) None [source]
Global font parameter
Parameters
- kwargs
‘family’ : ‘fantasy’,’monospace’,’sans-serif’,’serif’,’cursive’ ‘styles’ : ‘normal’, ‘italic’, ‘oblique’ ‘size’ : numerical value ‘variants’ : ‘normal’, ‘small-caps’ ‘weight’ : ‘light’, ‘normal’, ‘medium’, ‘semibold’, ‘bold’, ‘heavy’, ‘black’
Returns
- config_labels_contours(**kwargs) None [source]
Additionals configurations for the contours labels
Parameters
kwargs
- fontsize str or float, default: rcParams[“font.size”] (default: 10.0)
Size in points or relative size e.g., ‘smaller’, ‘x-large’. See plt.Text.set_size for accepted string values.
- colorscolor or colors or None, default: None
The label colors:
If None, the color of each label matches the color of the corresponding contour.
If one string color, e.g., colors = ‘r’ or colors = ‘red’, all labels will be plotted in this color.
- If a tuple of colors (string, float, RGB, etc), different labels will be plotted in different
colors in the order specified.
- inline: bool, default: True
If True the underlying contour is removed where the label is placed.
- inline_spacing: float, default: 5
Space in pixels to leave on each side of label when placing inline. This spacing will be exact for labels at locations where the contour is straight, less so for labels on curved contours.
- fmt: str, optional
How the levels are formatted: it is interpreted as a %-style format string. The default is to use a standard ScalarFormatter.
- manual: bool or iterable, default: False
If True, contour labels will be placed manually using mouse clicks. Click the first button near a contour to add a label, click the second button (or potentially both mouse buttons at once) to finish adding labels. The third button can be used to remove the last label added, but only if labels are not inline. Alternatively, the keyboard can be used to select label locations (enter to end label placement, delete or backspace act like the third mouse button, and any other key will select a label location). manual can also be an iterable object of (x, y) tuples. Contour labels will be created as if mouse is clicked at each (x, y) position.
- rightside_up: bool, default: True
If True, label rotations will always be plus or minus 90 degrees from level.
- use_clabel: text :bool, default: False
If True, use Text.set_transform_rotates_text to ensure that label rotation is updated whenever the Axes aspect changes.
- zorder: float or None, default: (2 + contour.get_zorder())
zorder of the contour labels.
Returns
None
See Also
matplotlib.axes.Axes.clabel
- config_legende(**kwargs) None [source]
To set additionals parameters for the legend plotting
Parameters
- kwargs
additionals parameters for the legend (see https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.legend.html)
- locstr default: rcParams[“legend.loc”] (default: ‘best’) The location of the legend.
The strings ‘upper left’, ‘upper right’, ‘lower left’, ‘lower right’ place the legend at the corresponding corner of the axes. The strings ‘upper center’, ‘lower center’, ‘center left’, ‘center right’ place the legend at the center of the corresponding edge of the axes. The string ‘center’ places the legend at the center of the axes. The string ‘best’ places the legend at the location, among the nine locations defined so far, with the minimum overlap with other drawn artists. This option can be quite slow for plots with large amounts of data; your plotting speed may benefit from providing a specific location. The location can also be a 2-tuple giving the coordinates of the lower-left corner of the legend in axes coordinates (in which case bbox_to_anchor will be ignored). For back-compatibility, ‘center right’ (but no other location) can also be spelled ‘right’, and each “string” location can also be given as a numeric value:
- bbox_to_anchorBboxBase, 2-tuple, or 4-tuple of floats
Box that is used to position the legend in conjunction with loc. Defaults to axes.bbox (if called as a method to Axes.legend) or figure.bbox (if Figure.legend). This argument allows arbitrary placement of the legend. Bbox coordinates are interpreted in the coordinate system given by bbox_transform, with the default transform Axes or Figure coordinates, depending on which legend is called. If a 4-tuple or BboxBase is given, then it specifies the bbox (x, y, width, height) that the legend is placed in. To put the legend in the best location in the bottom right quadrant of the Axes (or figure):
- loc=’best’, bbox_to_anchor=(0.5, 0., 0.5, 0.5)
A 2-tuple (x, y) places the corner of the legend specified by loc at x, y. For example, to put the legend’s upper right-hand corner in the center of the Axes (or figure) the following keywords can be used: loc=’upper right’, bbox_to_anchor=(0.5, 0.5)
- ncolsint, default: 1
The number of columns that the legend has. For backward compatibility, the spelling ncol is also supported but it is discouraged. If both are given, ncols takes precedence.
- fontsizeint or {‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’}
The font size of the legend. If the value is numeric the size will be the absolute font size in points. String values are relative to the current default font size. This argument is only used if prop is not specified.
- labelcolorstr or list, default: rcParams[“legend.labelcolor”] (default: ‘None’)
The color of the text in the legend. Either a valid color string (for example, ‘red’), or a list of color strings. The labelcolor can also be made to match the color of the line or marker using ‘linecolor’, ‘markerfacecolor’ (or ‘mfc’), or ‘markeredgecolor’ (or ‘mec’). Labelcolor can be set globally using rcParams[“legend.labelcolor”] (default: ‘None’). If None, use rcParams[“text.color”] (default: ‘black’).
- numpointsint, default: rcParams[“legend.numpoints”] (default: 1)
The number of marker points in the legend when creating a legend entry for a Line2D (line).
- scatterpointsint, default: rcParams[“legend.scatterpoints”] (default: 1)
The number of marker points in the legend when creating a legend entry for a PathCollection (scatter plot).
- scatteryoffsetsiterable of floats, default: [0.375, 0.5, 0.3125]
The vertical offset (relative to the font size) for the markers created for a scatter plot legend entry. 0.0 is at the base the legend text, and 1.0 is at the top. To draw all markers at the same height, set to [0.5].
- markerscalefloat, default: rcParams[“legend.markerscale”] (default: 1.0)
The relative size of legend markers compared to the originally drawn ones.
- markerfirstbool, default: True If True, legend marker is placed to the left of the legend label.
If False, legend marker is placed to the right of the legend label.
- reversebool, default: False If True, the legend labels are displayed in reverse order from the input.
If False, the legend labels are displayed in the same order as the input. Added in version 3.7.
- frameonbool, default: rcParams[“legend.frameon”] (default: True)
Whether the legend should be drawn on a patch (frame).
- fancyboxbool, default: rcParams[“legend.fancybox”] (default: True)
Whether round edges should be enabled around the FancyBboxPatch which makes up the legend’s background.
- shadowNone, bool or dict, default: rcParams[“legend.shadow”] (default: False)
Whether to draw a shadow behind the legend. The shadow can be configured using Patch keywords. Customization via rcParams[“legend.shadow”] (default: False) is currently not supported.
- framealpha float, default: rcParams[“legend.framealpha”] (default: 0.8)
The alpha transparency of the legend’s background. If shadow is activated and framealpha is None, the default value is ignored.
- facecolor “inherit” or color, default: rcParams[“legend.facecolor”] (default: ‘inherit’)
The legend’s background color. If “inherit”, use rcParams[“axes.facecolor”] (default: ‘white’).
- edgecolor “inherit” or color, default: rcParams[“legend.edgecolor”] (default: ‘0.8’)
The legend’s background patch edge color. If “inherit”, use rcParams[“axes.edgecolor”] (default: ‘black’).
- mode{“expand”, None}
If mode is set to “expand” the legend will be horizontally expanded to fill the Axes area (or bbox_to_anchor if defines the legend’s size).
- bbox_transformNone or Transform The transform for the bounding box (bbox_to_anchor).
For a value of None (default) the Axes’ transAxes transform will be used.
titlestr or None : The legend’s title. Default is no title (None).
- title_fontpropertiesNone or FontProperties or dict
The font properties of the legend’s title. If None (default), the title_fontsize argument will be used if present; if title_fontsize is also None, the current rcParams[“legend.title_fontsize”] (default: None) will be used.
- title_fontsize int or {‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’},
default: rcParams[“legend.title_fontsize”] (default: None) The font size of the legend’s title. Note: This cannot be combined with title_fontproperties. If you want to set the fontsize alongside other font properties, use the size parameter in title_fontproperties.
- alignment{‘center’, ‘left’, ‘right’}, default: ‘center’
The alignment of the legend title and the box of entries. The entries are aligned as a single block, so that markers always lined up.
- borderpad float, default: rcParams[“legend.borderpad”] (default: 0.4)
The fractional whitespace inside the legend border, in font-size units.
- labelspacing float, default: rcParams[“legend.labelspacing”] (default: 0.5)
The vertical space between the legend entries, in font-size units.
- handlelength float, default: rcParams[“legend.handlelength”] (default: 2.0)
The length of the legend handles, in font-size units.
- handleheight float, default: rcParams[“legend.handleheight”] (default: 0.7)
The height of the legend handles, in font-size units.
- handletextpad float, default: rcParams[“legend.handletextpad”] (default: 0.8)
The pad between the legend handle and text, in font-size units.
- borderaxespad float, default: rcParams[“legend.borderaxespad”] (default: 0.5)
The pad between the Axes and legend border, in font-size units.
- columnspacing float, default: rcParams[“legend.columnspacing”] (default: 2.0)
The spacing between columns, in font-size units.
- draggablebool, default: False
Whether the legend can be dragged with the mouse.
Returns
None
See Also
matplotlib.pyplot.legend
- config_line(index_line: int = 9223372036854775807, hide: bool = False, **kwargs) None [source]
Colorbar additianal parameter
Parameters
- index_lineint, optional
The index of the line (default the parameters are added for all liness)
- hidebool, optional, default: False
To hide the line(s)
- kwargs
the parameter dictionary
Returns
None
- config_spines(spine: str | list[str] | ndarray[str] = 'all', axis: str = 'bl', **kwargs) None [source]
Additionals configurations for ax
Parameters
- spinestr, optional, {“top”, “bottom”, “left”, “right”, “all”}:
The spine to be configurated
- axisstr, optional, {“bl”, “tl”, “br”, “tr”, “all”}, default=”bl”
- The positions of x-y axis to config:
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
“all” will configurate aull axis
- kwargs
Keywords available (see matplotlib documentation): -
`sharex`
,`sharey`
Axes, optional The x- or y-axis isshared with the x- or y-axis in the input Axes. Note that it is not possible to unshare axes. -`frameonbool`
: default=True Whether the Axes frame is visible. -`box_aspect`
: float, optional Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details. -`forward_navigation_events`
: bool or “auto”, default: “auto” Control whether pan/zoom events are passed through to Axes below this one. “auto” is True for axes with an invisible patch and False otherwise. - Other optional keyword arguments: – adjustable {‘box’, ‘datalim’} – agg_filter : a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image – alpha : scalar or None – anchor : (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} – animated : bool – aspect : {‘auto’, ‘equal’} or float – autoscale_on : bool – autoscalex_on – autoscaley_on – axes_locator : Callable[[Axes, Renderer], Bbox] – axisbelow : bool or ‘line’ – box_aspect : float or None – clip_on : bool – facecolor or fc : color – figure : Figure – forward_navigation_events : bool or “auto” – frame_on : bool – gid : str – in_layout : bool – label : object – mouseover : bool – navigate : bool – navigate_mode – picker : None or bool or float – position : [left, bottom, width, height] – rasterization_zorder : float or None – rasterized : bool – sketch_params : (scale: float, length: float, randomness: float) – snap : bool or None – subplotspec – title : str – url : str – visible : bool – xbound : (lower: float, upper: float) – xlabel : str – xlim : (left: float, right: float) – xmargin : float greater than -0.5 – xscale – xticklabels – xticks – ybound : (lower: float, upper: float) – ylabel : str – ylim : (bottom: float, top: float) – ymargin : float greater than -0.5 – yscale – yticklabels – yticks – zorder : float
Returns
None
See Also
- matplotlib.axes.set
The function used with kwargs
- config_ticks(axis: str = 'bl', direction: str = 'both', **kwargs) None [source]
Additionals configurations for ax
Parameters
- axisstr, optional, {“bl”, “tl”, “br”, “tr”, “all”}, default=”bl”
- The positions of x-y axis to config:
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
“all” will configurate aull axis
- directionstr, optional, {“x”, “y”, “both”}, default=”both”:
The axis direction where ticks are configurated
- kwargs
Keywords available (see matplotlib documentation): -
`sharex`
,`sharey`
Axes, optional The x- or y-axis isshared with the x- or y-axis in the input Axes. Note that it is not possible to unshare axes. -`frameonbool`
: default=True Whether the Axes frame is visible. -`box_aspect`
: float, optional Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details. -`forward_navigation_events`
: bool or “auto”, default: “auto” Control whether pan/zoom events are passed through to Axes below this one. “auto” is True for axes with an invisible patch and False otherwise. - Other optional keyword arguments: – adjustable {‘box’, ‘datalim’} – agg_filter : a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image – alpha : scalar or None – anchor : (float, float) or {‘C’, ‘SW’, ‘S’, ‘SE’, ‘E’, ‘NE’, …} – animated : bool – aspect : {‘auto’, ‘equal’} or float – autoscale_on : bool – autoscalex_on – autoscaley_on – axes_locator : Callable[[Axes, Renderer], Bbox] – axisbelow : bool or ‘line’ – box_aspect : float or None – clip_on : bool – facecolor or fc : color – figure : Figure – forward_navigation_events : bool or “auto” – frame_on : bool – gid : str – in_layout : bool – label : object – mouseover : bool – navigate : bool – navigate_mode – picker : None or bool or float – position : [left, bottom, width, height] – rasterization_zorder : float or None – rasterized : bool – sketch_params : (scale: float, length: float, randomness: float) – snap : bool or None – subplotspec – title : str – url : str – visible : bool – xbound : (lower: float, upper: float) – xlabel : str – xlim : (left: float, right: float) – xmargin : float greater than -0.5 – xscale – xticklabels – xticks – ybound : (lower: float, upper: float) – ylabel : str – ylim : (bottom: float, top: float) – ymargin : float greater than -0.5 – yscale – yticklabels – yticks – zorder : float
Returns
None
See Also
- matplotlib.axes.set
The function used with kwargs
- contours(levels: int | ndarray | list | None = None, array_contours: ndarray | None = None, x_axe: list | ndarray | None = None, y_axe: list | ndarray | None = None, labels: list | ndarray | None = None, labels_mask: ndarray | None = None, axis_config: str = 'bl', **kwargs)[source]
Plot the level lines associated to self.array_image or array_contours
Parameters
- levelsint | array_like | list, optional
Number (or list of) levels to plot
- array_contoursarray_like, optional, default=self.arry_image
If not None, the reference array to determine the level
- x_axearray_like | list, optional
the x-axes coordinate (for the array if array_contour is not None)
- y_axearray_like | list, optional
the y-axes coordinate (for the array if array_contour is not None)
- labelsarray_like | list, optional
the labels of each level line
- labels_maskarray_like | list, optional
the mask of levels line to show the labels
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
additional arguments
Returns
None
See Also
- matplotlib.pyplot.contour
Used to plot the levels lines
- Graphique.image
To plot an image, this image can be used as a reference for the levels lines
- customized_cmap(values: list[float64] | ndarray | tuple, colors: list | ndarray | tuple | None = None, ticks: list | ndarray[float64] | None = None, ticks_labels: list | ndarray[str] | None = None, **kwargs) None [source]
Parameters
- valueslist[np.float64] | np.ndarray | tuple
The values of the colormap’s color intervals if len(values)==2, the interval is automatically defined as a linear subdivision of the interval between values[0] and values[1] of size 255
- colorslist | np.ndarray | tuple, optional
The associated colors, if None, a linear variation beteween C1 and C2 is bild
- tickslist | np.ndarray[np.float64], optional
Array of ticks for the colorbar If None, ticks are determined automatically from the input.
- ticks_labelslist | np.ndarray[str], optional
Array of labels for the ticks.
- kwargs
- Additional arguments for the colorbar :
- location: str, {‘right’, ‘top’, ‘bottom’, ‘left’}
Indicate where the colorbar should be plotted
- scale: str, {‘linear’, ‘log’, ‘symlog’}
The scale of the colorbar
ticks: list | array_like
- format: str
ticks’ format
- label: str
The label to plot along the colorbar
- size: float, default=0.01
relative width of the colorbar
- fraction: float, default=1
relative hight of the colorbar
- space_between: float, default=0.01
relative space between colorsbars (and the plot)
Returns
None
Examples
>>> x = np.linspace(0, 10, 1000) >>> alpha = np.linspace(1, 5, 10) >>> colors = linear_color_interpolation(np.arange(len(alpha)), col_min=C1, col_max=C2) >>> gr = Graphique() >>> gr.logy(x, [x**a for a in alpha], color=colors) >>> gr.customized_cmap(alpha, colors) >>> gr.show()
- errorbar(x: list | ndarray, y: list | ndarray, err_y: list | ndarray, err_x: list | ndarray | None = None, marker: str = '', scale: str = '', hide: bool = False, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to plt.errorbar
Parameters
- xlist | array_like
Abscissa
- ylist | array_like
Ordinate
- err_ylist | array_like
Error associated with y
- err_xlist | array_like
Error associated with x
- markerlist[str] | array_like[str], str, optional, default=””
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- scalestr, optional, default=”linear”
The scales of (x, y) axis : - default : “” (linear scale for both x and y) - polar : polar projection : X=r and Y=theta - loglog, logx, logy : Logarithmic scale for both, x or y axis - symloglog, symlogx, symlogy : Logarithmic scale for both, x or y axis with positive and négative values
- hide: bool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
Additional argument to plot() function like linestyle, color….
Returns
None
- errorplot(x: list | ndarray, y: list | ndarray, err_y: list | ndarray, marker: str = '', scale: str = '', hide: bool = False, axis_config: str = 'bl', alpha_error: float64 = np.float64(0.5), color_errors: str | float64 | None = None, **kwargs) None [source]
Equivalent to plt.errorbar but the error is not represented by errorbars but by a uniform-colored polygon
Parameters
- xlist | array_like
Abscissa
- ylist | array_like
Ordinate
- err_ylist | array_like
Error associated with y
- markerlist[str] | array_like[str], str, optional, default=””
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- scalestr, optional, default=”linear”
The scales of (x, y) axis : - default : “” (linear scale for both x and y) - polar : polar projection : X=r and Y=theta - loglog, logx, logy : Logarithmic scale for both, x or y axis - symloglog, symlogx, symlogy : Logarithmic scale for both, x or y axis with positive and négative values
- hide: bool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- alpha_errorfloat, optional, default=0.5
The trensparency parameter of the shaded area that represant errors
- color_errorsstr, optional
Color of the shaded area that represant error, default is the markers colors
- kwargs
Additional argument to plot() function like linestyle, color….
Returns
None
- histogram(values: ndarray, weights: ndarray | None = None, normalization: bool = True, statistic: str = 'sum', bins: int = 10, stat_args: dict | None = None, **kwargs) None [source]
Plot the histogram of values
Parameters
- valuesarray_like
The values to histogramed
- weightsarray_like, optional
The weights to be applied to values
- normalizationbool, optional, default=True
If the histogram is normalized or not
- statisticstr, optional, default=”sum”
The statistic to compute. The following statistics are available
‘mean’: compute the mean of values for points within each bin. Empty bins will be represented by NaN.
‘std’: compute the standard deviation within each bin. This is implicitly calculated with ddof=0.
‘median’: compute the median of values for points within each bin. Empty bins will be represented by NaN.
- ‘count’: compute the count of points within each bin. This is identical to an unweighted histogram. values array is not
referenced.
‘sum’: compute the sum of values for points within each bin. This is identical to a weighted histogram.
‘min’: compute the minimum of values for points within each bin. Empty bins will be represented by NaN.
‘max’: compute the maximum of values for point within each bin. Empty bins will be represented by NaN.
- binsint, optional, default=10
Number of bins in the histogram
- stat_args, dict, optional
Additionals argument for sp.binned_statistic
- kwargs
Additionals argument for plt.bars
Returns
None
See also
scipy.stats.binned_statistic
- image(array_image: ndarray, x_axe: list | ndarray | None = None, y_axe: list | ndarray | None = None, colorscale: str = 'linear', cmap: str = 'default', colorbar_ticks: list | ndarray | None = None, colorbar_label: str = '', kwargs_colorbar: dict | None = None, colorbar_index: int = 9223372036854775807, color_min: str | tuple | None = None, color_max: str | tuple | None = None, vmin: float64 = -inf, vmax: float64 = inf, axis_config: str = 'bl', **kwargs) None [source]
Plot the array image through plt.pcolor or plt.imshow for 3 color images
Parameters
- array_imagenp.ndarray
The matrix (2D, or 3D for colored images (the color is on the third axis)) to be plotted
- x_axelist | np.ndarray, optional, default=np.arange(0,array_image.shape[0])
The x-axes coordinate (for the array), only for 2d array_image
- y_axelist | np.ndarray, optional, default=np.arange(0,array_image.shape[1])
The y-axes coordinate (for the array), only for 2d array_image
- colorscalestr, optional, default=”linear”, {“linear”, “log”, “symlog”}
The scale for the colorbar
- cmapstr, optional, default=”default”
The colormap, default a linear color interpolation between two colors CX
- colorbar_tickslist | array_like, optional
The colorbar’s ticks
- colorbar_labelstr, optional, default=””
The colorbar’s label
- kwargs_colorbardict, optional
Additional arguments for the colorbar :
- location: str, {‘right’, ‘top’, ‘bottom’, ‘left’}
Indicate where the colorbar should be plotted
- scale: str, {‘linear’, ‘log’, ‘symlog’}
The scale of the colorbar
ticks: list | array_like
- format: str
ticks’ format
- label: str
The label to plot along the colorbar
- size: float, default=0.01
relative width of the colorbar
- fraction: float, default=1
relative hight of the colorbar
- space_between: float, default=0.01
relative space between colorsbars (and the plot)
- colorbar_indexint, optional
The index of a previouly defined colorbar, to use insted of building a new one, all the others colorbar are ignored if provided
- vminnp.float64, optional, defaultthe minimum of array_image
The minimum value for the colorbar
- vmaxnp.float64, optional, defaultthe maximum of array_image
The maximum value for the colorbar
- color_minstr | tuple, optional
The color associated with the minimum value for a default cmap
- color_maxstr | tuple, optional
The color associated with the maximum value for a default cmap
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
Additionals arguments for pcolor
Returns
None
See Also
- matplotlib.pyplot.pcolor
Use to plot 2d array images
- matplotlib.pyplot.imshow
Use to plot 3-colors images
- Graphique.contours
To draw levels lines onto the image
- line(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list | ndarray[str] = '', share_colorbar: bool | int = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, hide: bool = False, cmap: str = 'default', color_min: str | tuple | None = None, color_max: str | tuple | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to plt.plot
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, int optional, default=False
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions. If is an integer, the integer refers to the index of a customized cmap
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- cmapstr, optional, default=’default’
The colormap style if needed, the default colorbar is a linear variation between color_min and color_max If there are not provided, the color will be chosen automatically
- color_minstr | tuple, optional
The color associated with the minimum value for a default cmap
- color_maxstr | tuple, optional
The color associated with the maximum value for a default cmap
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`self.line(x,[y1,y2], *args)`
is equivalent to`plt.plot(x, y1, *args) plt.plot(x, y2, *args)`
- if y1 and y2 have not the same size:
`self.line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.line((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`plt.plot(x, y1, marker=".", label="Curve1") plt.plot(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.linspace(0, 10, 1000) >>> alpha = np.linspace(1, 5, 10) >>> colors = g.linear_color_interpolation(np.arange(len(alpha)), col_min=C1, col_max=C2) >>> gr = g.Graphique() >>> gr.line(x, [x*a for a in alpha], color=colors) >>> gr.customized_cmap(alpha, colors) >>> gr.show()
- load_dict(values_to_load: dict) None [source]
Load a Graphique contained in a dictionary
Parameters
- values_to_load: dict
The dictionary that contain all the necessery informations to build a Graphique. Should be produced by another Graphique via Graphique.to_dict()
Returns
None
See Also
Graphique.to_dict()
- loglog(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to self.line with a logarithmique scale for both x and y-axis:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.line : Build line(s) for the Graphique Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`self.line(x,[y1,y2], *args)`
is equivalent to`plt.plot(x, y1, *args) plt.plot(x, y2, *args)`
- if y1 and y2 have not the same size:
`self.line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.line((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"]`
is equivalent to`plt.plot(x, y1, marker=".", label="Curve1") plt.plot(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.linspace(0, 10, 1000) >>> alpha = np.linspace(1, 5, 10) >>> colors = g.linear_color_interpolation(np.arange(len(alpha)), col_min=C1, col_max=C2) >>> gr = g.Graphique() >>> gr.loglog(x, [x*a for a in alpha], color=colors) >>> gr.customized_cmap(alpha, colors) >>> gr.show()
- logx(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to self.line with a logarithmique scale for x-axis:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
if y is in two dimensions, the second dimension is plotted :
`self.line(x,[y1,y2], *args)`
is equivalent to`plt.plot(x, y1, *args) plt.plot(x, y2, *args)`
- if y1 and y2 have not the same size:
`self.line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.line((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`plt.plot(x, y1, marker=".", label="Curve1") plt.plot(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.logspace(-10, 10, 1000) >>> gr = Graphique() >>> gr.logx(x, np.arctan(x)) >>> gr.show()
- logy(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to
`self.line`
with a logarithmique scale for y-axis:Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
if y is in two dimensions, the second dimension is plotted :
`self.line(x,[y1,y2], *args)`
is equivalent to`plt.plot(x, y1, *args) plt.plot(x, y2, *args)`
- if y1 and y2 have not the same size:
`self.line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.line((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`plt.plot(x, y1, marker=".", label="Curve1") plt.plot(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.logspace(-10, 10, 1000) >>> gr = Graphique() >>> gr.logy(x, np.arctan(x)) >>> gr.show()
- plot(in_Multigraph: bool = False) None [source]
Plot all the Graphique’s elements
Parameters
- in_Multigraph: bool, optional, default=False
If the Graphique is plotted in a Multigraph, it deactivate globals parameters such as the police or the style.
Returns
None
- point(xp: float | float64, yp: float | float64, marker: str = 'o', hide: bool = False, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to Graphique.line([xp],[yp],**args)
Parameters
- xp: float | np.double
Abscissa
- yp: float | np.double
Ordinate
- marker: str, optional, default=”o”
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
Additional argument to plot() function like linestyle, color….
Returns
None
- polar(r: list | ndarray, theta: list | ndarray, z: list | ndarray | None = None, marker: str = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs: dict) None [source]
Equivalent to self.line in polar projection
Parameters
- rlist | array_like
Radius
- thetalist | array_like
Angle(s)
- zlist | array_like, optional
z-axis (represented by a colorscale)
- marker:list[str] | array_like, str, optional, default=””
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- share_colorbarbool, optional, default=True
If True(default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_z: str, optional, {“linear”, “log”, “symlog”}, default=”linear”
The scale of the z-axis (linear (default), log, symplog)
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar: dict
Extra arguments for the colorbar (if z is not None)
- kwargs
Additional argument to plot() function like linestyle, color…
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
Returns
None
Notes
The order of first and second arguments is opposit to the matplotlib one : The first argument is the radius, then the angle
- polygon(ind, alpha: float | float64 = 0.7, facecolor: str = 'C3', plot_borders: bool = True, axis_config: str = 'bl', **kwargs) None [source]
Plot a uniformly colored polygon
Parameters
- ind
2-dimensional array/list of the coordinate of the polygon characteristics points ind[:, 0] point’s abscissas ind[:, 1] point’s ordinate
- alpha
transparency (between 0 and 1, default 0.7)
- facecolor
Polygon’s color
- plot_borders
If True (default) plot a line at the polygon’s border
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
Extras arguments for matplotlib.patches.PathPatch
Returns
None
See Also
- matplotlib.patches.PathPatch
Use to draw the polygon
- save(filename: str = 'graph_without_name', directory: str | None = None) None [source]
Save the Graphique in self.directory (default the current working directory) in npz compressed format.
Parameters
- filename: str, optinal, default=”graph_without_name”
The name of the .npz file (default: “graph_without_name”)
- directory: str, optional, default=”./”
Graphique’s directory (default self.directory (default : the curent working directory))
Returns
None
- save_figure(**args) None [source]
Save the image product by the Graphique’s plotting, not the Graphique itself. The image is saved on the Graphiqu’s format (default .png)
Parameters
- args
Additionals parameters for the Figure saving see https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.savefig.html#matplotlib.figure.Figure.savefig
- figsize 2-tuple of floats, default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Figure dimension (width, height) in inches.
- dpi float, default: rcParams[“figure.dpi”] (default: 100.0)
Dots per inch.
- facecolor default: rcParams[“figure.facecolor”] (default: ‘white’)
The figure patch facecolor.
- edgecolor default: rcParams[“figure.edgecolor”] (default: ‘white’)
The figure patch edge color.
- linewidth float
The linewidth of the frame (i.e. the edge linewidth of the figure patch).
- frameon bool, default: rcParams[“figure.frameon”] (default: True)
If False, suppress drawing the figure background patch.
layout {‘onstrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}, default: None
- The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations
(labels, ticks, etc). Note that layout managers can have significant performance penalties.
- ‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes
decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
- ‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the
subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
‘none’: Do not use a layout engine.
- A LayoutEngine instance. Builtin layout classes are ConstrainedLayoutEngine and TightLayoutEngine,
- more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to
provide their own layout engine.
- If not given, fall back to using the parameters tight_layout and constrained_layout, including their
config defaults rcParams[“figure.autolayout”] (default: False) and rcParams[“figure.constrained_layout.use”] (default: False).
alpha scalar or None
animated bool
clip_on bool
constrained_layout unknown
constrained_layout_pads unknown
dpi float
edgecolor color
facecolor color
figheight float
figwidth float
frameon bool
gid str
in_layout bool
label object
layout_engine {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}
linewidth number
mouseover bool
picker None or bool or float
rasterized bool
size_inches (float, float) or float
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tight_layout unknown
transform Transform
url str
visible bool
zorder float
Returns
None
- set_indexs_plot_lines(indexs=list | numpy.ndarray | str) None [source]
Set the order in which the lines are plotted. If the index size is smaller than the lists of x/y lines then some of them will not be plotted.
Parameters
- indexslist | np.ndarray | str
List lines’ indexs to plot. The plotting order is the order of index. If index==”default”, then all the lines will be plotted in the order in which they were saved
Returns
None
- set_style_phenigraph() None [source]
This method add a trensparent grey background for the axis self.ax and a trensparent background for the rest of the Figure. The top and right border (spine) of the axis are remouved The linewidth of the left and below border (where the defaults x and -y axis are) are set to 2 The ticks size and width are increase too Returns ——-
- symloglog(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to self.line with a logarithmique scale for both x and y-axis Both the negative and positive parts of y are represanted:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`self.symloglog(x,[y1,y2], *args)`
is equivalent to`ax=plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(xscale="symlog", yscale="symlog")`
- if y1 and y2 have not the same size:
`self.line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.symploglog((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`ax=plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(xscale="symlog", yscale="symlog")`
Examples
>>> x = np.linspace(-10, 10, 1000) >>> gr = g.Graphique() >>> gr.symloglog(x, np.tan(x)) >>> gr.show()
- symlogx(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to self.line with a logarithmique scale for both x-axis (both negative and positive part are represanted):
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`self.line(x,[y1,y2], *args)`
is equivalent to`plt.plot(x, y1, *args) plt.plot(x, y2, *args)`
- if y1 and y2 have not the same size:
`self.line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.line((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`plt.plot(x, y1, marker=".", label="Curve1") plt.plot(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.append(-np.logspace(10, -10, 1000), np.logspace(-10, 10, 1000)) >>> gr = Graphique() >>> gr.symlogx(x, np.arctan(x)) >>> gr.show()
- symlogy(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', hide: bool = False, kwargs_colorbar: dict | None = None, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to
`self.line`
with a logarithmique scale for y-axis (both positive and negative part are represanted):Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
None
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`self.symlogy(x,[y1,y2], *args)`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(yscale="symplog")`
- if y1 and y2 have not the same size:
`self.symlogy([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`self.symplogy((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`ax=plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(yscale="symlog")`
Examples
>>> x = np.linspace(0,np.pi,1000) >>> gr = g.Graphique() >>> gr.symlogy(x, np.tan(x)) >>> gr.show()
- text(x: list | ndarray, y: list | ndarray, s: list | ndarray, axis_config: str = 'bl', **kwargs) None [source]
Equivalent to
`plt.text`
Parameters
- x: list | np.ndarray
Abscissa(s)
- y: list | np.ndarray
Ordinate(s)
- s: list | np.ndarray
Texts to plot
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
Additional argument to
`plot()`
function like linestyle, color…. To rotate the text one can use the ‘rotation’ parameter with the angle in degrees orthe “vertical” “horizontal” keyword.
Returns
None
- class phenigraph.objet.Multigraph(nrows: int = 1, ncols: int = 1, filename: str = '', directory: str = '')[source]
Bases:
object
To plot multiples Graphiques in a single Figure
- add_graphique(coord: int | list[int, tuple], graph: Graphique | None = None, sharex: int | list[int, tuple] | None = None, sharey: int | list[int, tuple] | None = None, **kwargs)[source]
To add a new Graphique in the Multigraph at the coordinates defined by coord. This Graphique can cover several slots
Parameters
- coordint | list[int, tuple]
the Graphique’s coordinates : if self.nrows or nself.ncols =1 it can be an int, either a list of int : [index_rows, index_cols]. If this Graphique extend on severals slots, coord should be on this form : [(index_rows_min, index_rows_max), (index_cols_min, index_cols_min)]
- graphGraphique, optional, defaultan empty Graphique
The Graphique to add, default a new empty Graphique is created
- sharexint | list[int, tuple], optional
Coordinates of the Graphique to wich the x axis is shared if needed. The corresponding Graphique should already be in the Multigraph. If the new Graphique is on multiples slots then the Graphique to which the coordinates are shared should occupy the same number of raw.
- shareyint | list[int, tuple], optional
Coordinates of the Graphique to wich the y axis is shared if needed. The corresponding Graphique should already be in the Multigraph. If the new Graphique is on multiples slots then the Graphique to which the coordinates are shared should occupy the same number of cols
- kwargs
Extra-parameters for plt.subplot
Returns
None
- config_enrg_fig(**kwargs) None [source]
Additionals parameters for the Figure saving see https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.savefig.html#matplotlib.figure.Figure.savefig
Parameters
- kwargs
- figsize 2-tuple of floats, default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Figure dimension (width, height) in inches.
- dpi float, default: rcParams[“figure.dpi”] (default: 100.0)
Dots per inch.
- facecolor default: rcParams[“figure.facecolor”] (default: ‘white’)
The figure patch facecolor.
- edgecolor default: rcParams[“figure.edgecolor”] (default: ‘white’)
The figure patch edge color.
- linewidth float
The linewidth of the frame (i.e. the edge linewidth of the figure patch).
- frameon bool, default: rcParams[“figure.frameon”] (default: True)
If False, suppress drawing the figure background patch.
layout {‘onstrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}, default: None
- The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations
(labels, ticks, etc). Note that layout managers can have significant performance penalties.
- – ‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes
decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
—‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
- – ‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the
subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
‘none’: Do not use a layout engine.
- A LayoutEngine instance. Builtin layout classes are ConstrainedLayoutEngine and TightLayoutEngine,
- more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to
provide their own layout engine.
- If not given, fall back to using the parameters tight_layout and constrained_layout, including their
config defaults rcParams[“figure.autolayout”] (default: False) and rcParams[“figure.constrained_layout.use”] (default: False).
alpha scalar or None
animated bool
clip_on bool
constrained_layout unknown
constrained_layout_pads unknown
dpi float
edgecolor color
facecolor color
figheight float
figwidth float
frameon bool
gid str
in_layout bool
label object
layout_engine {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}
linewidth number
mouseover bool
picker None or bool or float
rasterized bool
size_inches (float, float) or float
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tight_layout unknown
transform Transform
url str
visible bool
zorder float
Returns
None
- config_fig(**kwargs) None [source]
Additionals parameters for the Figure saving
Parameters
kwargs
- igsize 2-tuple of floats, default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Figure dimension (width, height) in inches.
- dpi float, default: rcParams[“figure.dpi”] (default: 100.0)
Dots per inch.
- facecolor default: rcParams[“figure.facecolor”] (default: ‘white’)
The figure patch facecolor.
- edgecolor default: rcParams[“figure.edgecolor”] (default: ‘white’)
The figure patch edge color.
- linewidth float
The linewidth of the frame (i.e. the edge linewidth of the figure patch).
- frameon bool, default: rcParams[“figure.frameon”] (default: True)
If False, suppress drawing the figure background patch.
layout {‘onstrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}, default: None
- The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations
(labels, ticks, etc). Note that layout managers can have significant performance penalties.
- ‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes
decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
- ‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the
subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
‘none’: Do not use a layout engine.
- A LayoutEngine instance. Builtin layout classes are ConstrainedLayoutEngine and TightLayoutEngine,
- more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to
provide their own layout engine.
- If not given, fall back to using the parameters tight_layout and constrained_layout, including their
config defaults rcParams[“figure.autolayout”] (default: False) and rcParams[“figure.constrained_layout.use”] (default: False).
alpha scalar or None
animated bool
clip_on bool
constrained_layout unknown
constrained_layout_pads unknown
dpi float
edgecolor color
facecolor color
figheight float
figwidth float
frameon bool
gid str
in_layout bool
label object
layout_engine {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}
linewidth number
mouseover bool
picker None or bool or float
rasterized bool
size_inches (float, float) or float
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tight_layout unknown
transform Transform
url str
visible bool
zorder float
Returns
None
See Also
matplotlib.figure.Figure.savefig
- config_font(**dico) None [source]
Global font parameter
Parameters
- kwargs
‘family’ : ‘fantasy’,’monospace’,’sans-serif’,’serif’,’cursive’ ‘styles’ : ‘normal’, ‘italic’, ‘oblique’ ‘size’ : valeur numérique ‘variants’ : ‘normal’, ‘small-caps’ ‘weight’ : ‘light’, ‘normal’, ‘medium’, ‘semibold’, ‘bold’, ‘heavy’, ‘black’
Returns
None
- config_grid_spec(**dico) None [source]
Additionals parameters for the grid_spec
Parameters
dico
- left, right, top, bottomfloat, optionalExtent of the subplots as a fraction of figure width or height.
Left cannot be larger than right, and bottom cannot be larger than top. If not given, the values will be inferred from a figure or rcParams at draw time. See also GridSpec.get_subplot_params.
- wspace float, optional :
The amount of width reserved for space between subplots, expressed as a fraction of the average axis width. If not given, the values will be inferred from a figure or rcParams when necessary. See also GridSpec.get_subplot_params.
- hspace float, optional :
The amount of height reserved for space between subplots, expressed as a fraction of the average axis height. If not given, the values will be inferred from a figure or rcParams when necessary. See also GridSpec.get_subplot_params.
- width_ratios array-like of length ncols, optional :
Defines the relative widths of the columns. Each column gets a relative width of width_ratios[i] / sum(width_ratios). If not given, all columns will have the same width.
- height_ratios array-like of length nrows, optional
Defines the relative heights of the rows. Each row gets a relative height of height_ratios[i] / sum(height_ratios). If not given, all rows will have the same height.
Returns
None
See Also
matplotlib.gridspec.GridSpec
- load_dict(values_to_load: dict) None [source]
load a Graphix contain in a dictionary
Parameters
- values_to_loaddict
Dictionary containing all the information needed to build a Multigraph. This dictionary is produced by Multigraph.to_dict()
Returns
None
See Also
- Multigraph.to_dict
Produce a dictionary that can be used to build a new Multigraph
- plot() None [source]
Plot all the Multigraph’s elements
Parameters
- in_Multigraph: bool, optional, default=False
If the Graphique is plotted in a Multigraph, it deactivate globals parameters such as the police or the style.
Returns
None
- save(filename: str = 'mgraph_without_name', directory: str | None = None) None [source]
Save the Multi.graph in self.directory (default the current working directory) in npz compressed format.
Parameters
- filename: str, optinal, default=”mgraph_without_name”
The name of the .npz file (default: “mgraph_without_name”)
- directory: str, optional, default=”./”
Graphique’s directory (default self.directory (default : the curent working directory))
Returns
None
- save_figure(**args) None [source]
Save the image product by the Multigraph’s plotting, not the Multigraph itself. The image is saved on the Multigraph’s format (default .png)
Parameters
- args
Additionals parameters for the Figure saving see https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.savefig.html#matplotlib.figure.Figure.savefig
- igsize 2-tuple of floats, default: rcParams[“figure.figsize”] (default: [6.4, 4.8])
Figure dimension (width, height) in inches.
- dpi float, default: rcParams[“figure.dpi”] (default: 100.0)
Dots per inch.
- facecolor default: rcParams[“figure.facecolor”] (default: ‘white’)
The figure patch facecolor.
- edgecolor default: rcParams[“figure.edgecolor”] (default: ‘white’)
The figure patch edge color.
- linewidth float
The linewidth of the frame (i.e. the edge linewidth of the figure patch).
- frameon bool, default: rcParams[“figure.frameon”] (default: True)
If False, suppress drawing the figure background patch.
layout {‘onstrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}, default: None
- The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations
(labels, ticks, etc). Note that layout managers can have significant performance penalties.
- ‘constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes
decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
‘compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
- ‘tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the
subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
‘none’: Do not use a layout engine.
- A LayoutEngine instance. Builtin layout classes are ConstrainedLayoutEngine and TightLayoutEngine,
- more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to
provide their own layout engine.
- If not given, fall back to using the parameters tight_layout and constrained_layout, including their
config defaults rcParams[“figure.autolayout”] (default: False) and rcParams[“figure.constrained_layout.use”] (default: False).
alpha scalar or None
animated bool
clip_on bool
constrained_layout unknown
constrained_layout_pads unknown
dpi float
edgecolor color
facecolor color
figheight float
figwidth float
frameon bool
gid str
in_layout bool
label object
layout_engine {‘constrained’, ‘compressed’, ‘tight’, ‘none’, LayoutEngine, None}
linewidth number
mouseover bool
picker None or bool or float
rasterized bool
size_inches (float, float) or float
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
tight_layout unknown
transform Transform
url str
visible bool
zorder float
Returns
None
- phenigraph.objet.colored_line(x, y, c, ax, **lc_kwargs)[source]
This function is adapted from https://matplotlib.org/stable/gallery/lines_bars_and_markers/multicolored_line.html Plot a line with a color specified along the line by a third value.
It does this by creating a collection of line segments. Each line segment is made up of two straight lines each connecting the current (x, y) point to the midpoints of the lines connecting the current point with its two neighbors. This creates a smooth line with no gaps between the line segments.
Parameters
- x, yarray-like
The horizontal and vertical coordinates of the data points.
- carray-like
The color values, which should be the same size as x and y.
- axAxes
Axis object on which to plot the colored line.
- lc_kwargs
Any additional arguments to pass to matplotlib.collections.LineCollection constructor. This should not include the array keyword argument because that is set to the color argument. If provided, it will be overridden.
Returns
- matplotlib.collections.LineCollection
The generated line collection representing the colored line.
- phenigraph.objet.dict_to_list(dic: dict) list [source]
Return the irregular list (A list with list of differents sizes or with dictionary(s)) transformed by the list_to_dict function
Parameters
- dic: dict
The dic to be converted
Returns
- list
The original list
- phenigraph.objet.dict_to_ndarray_dict(dic: dict, separator: str = '-.-') dict [source]
Turn a dictionary containing list, ndarray, str, float, int or even others dic into a dic in the right form to be saved by np.save_compressed
Parameters
- dic: dict
The dictionary to be transformed
- separator: str, optional, default=”-.-”
The string to be added between dictionary’s keys if there are recursives
Returns
- dict
The new dictionary
- phenigraph.objet.errorbar(x: list | ndarray, y: list | ndarray, err_y: list | ndarray, marker: str = '', scale: str = '', show: bool = True, hide: bool = False, axis_config: str = 'bl', set_phenigraph_style: bool = True, **kwargs: dict) Graphique [source]
Equivalent to plt.errorbar
Parameters
- xlist | array_like
Abscissa
- ylist | array_like
Ordinate
- err_ylist | array_like
Error associated with y
- err_xlist | array_like
Error associated with x
- markerlist[str] | array_like[str], str, optional, default=””
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- scalestr, optional, default=”linear”
The scales of (x, y) axis : - default : “” (linear scale for both x and y) - polar : polar projection : X=r and Y=theta - loglog, logx, logy : Logarithmic scale for both, x or y axis - symloglog, symlogx, symlogy : Logarithmic scale for both, x or y axis with positive and négative values
- showbool, optional, default = True
To show the Graphique
- hide: bool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Whether to set or not the phenigraph style to the Graphique
- kwargs
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
- phenigraph.objet.errorplot(x: list | ndarray, y: list | ndarray, err_y: list | ndarray, marker: str = '', scale: str = '', show: bool = True, hide: bool = False, axis_config: str = 'bl', set_phenigraph_style: bool = True, **kwargs: dict) Graphique [source]
Equivalent to plt.errorbar but the error is not represented by errorbars but by a uniform-colored polygon
Parameters
- xlist | array_like
Abscissa
- ylist | array_like
Ordinate
- err_ylist | array_like
Error associated with y
- markerlist[str] | array_like[str], str, optional, default=””
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- scalestr, optional, default=”linear”
The scales of (x, y) axis : - default : “” (linear scale for both x and y) - polar : polar projection : X=r and Y=theta - loglog, logx, logy : Logarithmic scale for both, x or y axis - symloglog, symlogx, symlogy : Logarithmic scale for both, x or y axis with positive and négative values
- showbool, optional, default = True
To show the Graphique
- hide: bool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
- phenigraph.objet.get_regular_list(x: ndarray | list, types: ndarray) list [source]
Recover the original list converted by test_list_regular (if the list is regular (the result is not None))
Parameters
- x: np.ndarray | list
The converted array
- types: np.ndarray
The types of each list’s element (result of ‘test_list_regular’)
Returns
- dict
the original list
- phenigraph.objet.histogram(values: ndarray, weights: ndarray | None = None, normalization: bool = True, statistic: str = 'sum', bins: int = 10, show: bool = True, set_phenigraph_style: bool = True, **args) Graphique [source]
Plot the histogram of values
Parameters
- valuesarray_like
The values to histogramed
- weightsarray_like, optional
The weights to be applied to values
- normalizationbool, optional, default=True
If the histogram is normalized or not
- statisticstr, optional, default=”sum”
The statistic to compute (default is ‘sum’). The following statistics are available:
‘mean’: compute the mean of values for points within each bin. Empty bins will be represented by NaN.
‘std’: compute the standard deviation within each bin. This is implicitly calculated with ddof=0.
‘median’: compute the median of values for points within each bin. Empty bins will be represented by NaN.
- ‘count’: compute the count of points within each bin. This is identical to an unweighted histogram. values array is not
referenced.
‘sum’: compute the sum of values for points within each bin. This is identical to a weighted histogram.
‘min’: compute the minimum of values for points within each bin. Empty bins will be represented by NaN.
‘max’: compute the maximum of values for point within each bin. Empty bins will be represented by NaN.
- binsint, optional, default=10
Number of bins in the histogram
- stat_args, dict, optional
Additionals argument for sp.binned_statistic
- showbool, optional, default = True
To show the Graphique
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs
Additionals argument for plt.bars
Returns
- Graphique
The new Graphique
See also
scipy.stats.binned_statistic
- phenigraph.objet.image(array_image: ndarray, x_axe: list | ndarray | None = None, y_axe: list | ndarray | None = None, colorscale: str = 'linear', cmap: str = 'default', colorbar_ticks: list | ndarray | None = None, colorbar_label: str = '', kwargs_colorbar: dict | None = None, colorbar_index: int = 9223372036854775807, color_min: str | tuple | None = None, color_max: str | tuple | None = None, vmin: float64 = -inf, vmax: float64 = inf, axis_config: str = 'bl', show: bool = True, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Plot the array image through plt.pcolor or plt.imshow for 3 color images
Parameters
- array_imagenp.ndarray
The matrix (2D, or 3D for colored images (the color is on the third axis)) to be plotted
- x_axelist | np.ndarray, optional, default=np.arange(0,array_image.shape[0])
The x-axes coordinate (for the array), only for 2d array_image
- y_axelist | np.ndarray, optional, default=np.arange(0,array_image.shape[1])
The y-axes coordinate (for the array), only for 2d array_image
- colorscalestr, optional, default=”linear”, {“linear”, “log”, “symlog”}
The scale for the colorbar
- cmapstr, optional, default=”default”
The colormap, default a linear color interpolation between two colors CX
- colorbar_tickslist | array_like, optional
The colorbar’s ticks
- colorbar_labelstr, optional, default=””
The colorbar’s label
- kwargs_colorbardict, optional
Additional arguments for the colorbar :
- location: str, {‘right’, ‘top’, ‘bottom’, ‘left’}
Indicate where the colorbar should be plotted
- scale: str, {‘linear’, ‘log’, ‘symlog’}
The scale of the colorbar
ticks: list | array_like
- format: str
ticks’ format
- label: str
The label to plot along the colorbar
- size: float, default=0.01
relative width of the colorbar
- fraction: float, default=1
relative hight of the colorbar
- space_between: float, default=0.01
relative space between colorsbars (and the plot)
- colorbar_indexint, optional
The index of a previouly defined colorbar, to use insted of building a new one, all the others colorbar are ignored if provided
- vminnp.float64, optional, defaultthe minimum of array_image
The minimum value for the colorbar
- vmaxnp.float64, optional, defaultthe maximum of array_image
The maximum value for the colorbar
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- showbool, optional, default = True
To show the Graphique
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs
Additionals arguments for pcolor
Returns
None
See Also
- matplotlib.pyplot.pcolor
Use to plot 2d array images
- matplotlib.pyplot.imshow
Use to plot 3-colors images
- Graphique.contours
To draw levels lines onto the image
- phenigraph.objet.level_surface(x: ndarray | list, y: ndarray | list, vals: ndarray | list, npix_x: int = 400, npix_y: int = 400, logx: bool = False, logy: bool = False, method: str = 'cubic', log_vals: bool = False, axis_config: str = 'bl', show: bool = True, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Returns an image representing the 2d contour line associated with the points points defined by x, y, vals
Parameters
- xnp.ndarray | list
list of size n and dimension 1 containing the abscissa of the points
- ynp.ndarray | list
list of size n and dimension 1 containing the odrides of the points
- valsnp.ndarray | list
list of size n and dimension 1 containing point values to be interpolated and displayed
- npix_xint, optional, default = 400
number of image pixels on x axis
- npix_yint, optional, default = 400
number of image pixels on y axis
- logxbool, optional, default = False
indicates whether the x axis is logarithmically subdivided or not
- logybool, optional, default = False
indicates whether the y axis is logarithmically subdivided or not
- methodstr, optional, default = “cubic
interplotation method: ‘nearest’, ‘linear’ where by default ‘cubic’. See doc scipy.interpolate.griddata
- log_valsbool, optional, default = False
indicates whether values are displayed (and extrapolated) on a logarithmic scale or not. on a logarithmic scale
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- showbool, optional, default = True
To show the Graphique (default=True)
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs
dictionaries of complementary arguments to images
Returns
- Graphique
The new Graphique
- phenigraph.objet.line(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, show: bool = True, hide: bool = False, axis_config: str = 'bl', set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to plt.plot
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbaroptional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The coresponding new Graphique
See Also
Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`self.line(x,[y1,y2], *args)`
is equivalent to`plt.plot(x, y1, *args) plt.plot(x, y2, *args)`
- if y1 and y2 have not the same size:
`line([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`line((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to :`plt.plot(x, y1, marker=".", label="Curve1") plt.plot(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.linspace(0, 10, 1000) >>> alpha = np.linspace(1, 5, 10) >>> colors = linear_color_interpolation(np.arange(len(alpha)), col_min=C1, col_max=C2) >>> gr = line(x, [x*a for a in alpha], color=colors) >>> gr.customized_cmap(alpha, colors) >>> gr.show()
- phenigraph.objet.linear_color_interpolation(val: float64 | float | list[float64 | float] | ndarray[float64 | float], val_min: float64 = -inf, val_max: float64 = inf, col_min: str | tuple = '#6307ba', col_max: str = '#16b5fa') str | list[str] | ndarray[str] [source]
Return a color/list of colors which is linearly interpolated between the two extremal colors col_min and col_max
Parameters
- val: np.float64 | float | list[np.float64 | float] | np.ndarray[np.float64 | float],
the value to be interpolated
- val_min: np.float64, default = min(val)
the minimal value
- val_max: np.float64, default = max(val)
the maximal value
- col_min: str | tuple, optional, default=C1=#6307ba (purple)
color associated with the minimal value (in hexadecimal or rgba)
- col_max: str | tuple, optional, default=C2=#16b5fa (cyan)
color associated with the maximal value (in hexadecimal or rgba)
Returns
- str | list[str] | np.ndarray[str]
the interpolated color(s) in hex
- phenigraph.objet.list_to_dict(x: list, separator: str = '-.-') dict [source]
Parameters
- x: list
the list to be converted
- separator: str, optinal, default=”-.-”
The string to be added between dictionary’s keys if there are recursives
Returns
- dict
the dictionary containing the list
- phenigraph.objet.loglog(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to line with a logarithmique scale for both x and y-axis:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new graphique
See Also
Graphique.line : Build line(s) for the Graphique Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`loglog(x,[y1,y2], *args)`
is equivalent to`plt.loglog(x, y1, *args) plt.loglog(x, y2, *args)`
- if y1 and y2 have not the same size:
`loglog([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`loglog((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`plt.loglog(x, y1, marker=".", label="Curve1") plt.loglog(x, y2, marker=".", label="Curve2")`
Examples
>>> x = np.linspace(0, 10, 1000) >>> alpha = np.linspace(1, 5, 10) >>> colors = linear_color_interpolation(np.arange(len(alpha)), col_min=C1, col_max=C2) >>> gr: Graphique = loglog(x, [x*a for a in alpha], color=colors) >>> gr.customized_cmap(alpha, colors) >>> gr.show()
- phenigraph.objet.logx(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to line with a logarithmique scale for x-axis:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`logx(x,[y1,y2], *args)`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(scale="log")`
- if y1 and y2 have not the same size:
`logx([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`logx((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(xscale="log")`
Examples
>>> x = np.logspace(-10, 10, 1000) >>> gr = Graphique() >>> gr.logx(x, np.arctan(x)) >>> gr.show()
- phenigraph.objet.logy(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to line with a logarithmique scale for y-axis:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`logy(x,[y1,y2], *args)`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(yscale="log")`
- if y1 and y2 have not the same size:
`logy([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`logy((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"]`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(yscale="log")`
Examples
>>> x = np.logspace(-10, 10, 1000) >>> gr = logy(x, np.arctan(x)) >>> gr.show()
- phenigraph.objet.ndarray_dict_to_dict(dic: dict) dict [source]
Return the original dictionary get from the dict_to_ndarray_dict
Parameters
- dic, dict
the dictionary to be converted
Returns
- dict
the original dictionary
- phenigraph.objet.polar(r: list | ndarray, theta: list | ndarray, z: list | ndarray | None = None, marker: str = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, **kwargs: dict) Graphique [source]
Equivalent to line in polar projection
Parameters
- rlist | array_like
Radius
- thetalist | array_like
Angle(s)
- zlist | array_like, optional
z-axis (represented by a colorscale)
- marker:list[str] | array_like, str, optional, default=””
The marker (ex “.”, “,”, “o”, “v”…) see matplotlib documentation for all the possibility
- share_colorbarbool, optional, default=True
If True(default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_z: str, optional, {“linear”, “log”, “symlog”}, default=”linear”
The scale of the z-axis (linear (default), log, symplog)
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar: dict
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- kwargs
Additional argument to plot() function like linestyle, color…
Returns
- Graphique
The new Graphique
Notes
The order of first and second arguments is opposit to the matplotlib one : The first argument is the radius, then the angle
- phenigraph.objet.symloglog(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to line with a logarithmique scale for both x and y-axis Both the negative and positive parts of y are represanted:
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`symloglog(x,[y1,y2], *args)`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(xscale="symlog", yscale="symlog")`
- if y1 and y2 have not the same size:
`symloglog([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`symloglog((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(xscale="symlog", yscale="symlog")`
Examples
>>> x = np.linspace(-10, 10, 1000) >>> gr = symloglog(x, np.tan(x)) >>> gr.show()
- phenigraph.objet.symlogx(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to line with a logarithmique scale for both x-axis (both negative and positive part are represanted):
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logx : Graphique.line in log coordinate for x axis and linear for y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogy : Similar to Graphique.logy but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`symlogx(x,[y1,y2], *args)`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(xscale="symlog")`
- if y1 and y2 have not the same size:
`symlogx([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`symlogx((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(xscale="symlog")`
Examples
>>> x = np.append(-np.logspace(10, -10, 1000), np.logspace(-10, 10, 1000)) >>> gr = Graphique() >>> gr.symlogx(x, np.arctan(x)) >>> gr.show()
- phenigraph.objet.symlogy(x: ndarray | list, y: list | ndarray | None = None, z: list | ndarray | None = None, marker: str | list = '', share_colorbar: bool = False, scale_z: str = 'linear', kwargs_colorbar: dict | None = None, axis_config: str = 'bl', show: bool = True, hide: bool = False, set_phenigraph_style: bool = True, **kwargs) Graphique [source]
Equivalent to line with a logarithmique scale for y-axis (both positive and negative part are represanted):
Parameters
- xarray_like | list
Abscissa(s)
- yarray_like | list, optional
Ordinate(s), if None x became the ordinate and the abscissa is arange(len(x))
- zarray_like | list, optional
z-axis (represented by a colorscale)
- markerstr | list[str] | array_like[str], optional, default=””
The marker ex “.”, “,”, “o”, “v”… (see matplotlib documentation)
- share_colorbarbool, optional, default=True
If True (default) and z is not None, only one colorscale is used even if z is in two dimensions
- scale_zstr, {‘linear’, ‘log’, ‘symlog’}, optional, default=’linear’
The scale of the z-axis
- showbool, optional, default = True
To show the Graphique
- hidebool, optional, default=False
If True then the new line(s) is/are not plotted with the Graphique. To plot them, then change the plot order with self.set_indexs_plot_lines
- kwargs_colorbar, optional
Extra arguments for the colorbar (if z is not None)
- axis_configstr, optional, {“bl”, “tl”, “br”, “tr”}, default=”bl”
- The positions of x-y axis :
“bl” is x-axis on the bottom, y-axis on the left (default).
“tl” is x-axis on the top, y-axis on the left.
“br” is x-axis on the bottom, y-axis on the right.
“tr” is x-axis on the top, y-axis on the right.
- set_phenigraph_stylebool, optional=True, default=True
Wheather to set or not the phenigraph style to the Graphique
- kwargs, optional
Additional argument to plot() function like linestyle, color….
Returns
- Graphique
The new Graphique
See Also
Graphique.line : Build line(s) for the Graphique Graphique.loglog : Graphique.line in log coordinate for boths x and y axis Graphique.logy : Graphique.line in log coordinate for y axis and linear for x axis Graphique.point : To plot a single point Graphique.errorbar : To plot a line with errorbars Graphique.errorplot : To plot a line with errorbars represanted as filled area Graphique.polar : To plot a line in polar coordinates Graphique.symloglog : Similar to Graphique.loglog but boths negatives and positives values are represanted Graphique.symlogx : Similar to Graphique.logx but boths negatives and positives values are represanted
Notes
This function has a small improuvment compared with plt.plot :
- if y is in two dimensions, the second dimension is plotted :
`symlogy(x,[y1,y2], *args)`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, *args) ax.plot(x, y2, *args) ax.set(yscale="symlog")`
- if y1 and y2 have not the same size:
`symlogy([x1,x2],[y1, y2], *args)`
- If others arguments are list of the same size of x and y, they are also split :
`symlogy((x1, x2], [y1, y2], marker=".", label=["Curve1", "Curve2"])`
is equivalent to`ax = plt.subplot() ax.plot(x, y1, marker=".", label="Curve1") ax.plot(x, y2, marker=".", label="Curve2") ax.set(yscale="symlog")`
Examples
>>> x = np.linspace(0,np.pi,1000) >>> gr = gr.symlogy(x, np.tan(x)) >>> gr.show()
- phenigraph.objet.test_list_regular(x: list) list | None [source]
If x is a list of lists, this function test if there size is equals. If there are, then it returns a list of string of the same dimensions of x. Then x could be turned into a ndarray and turned back after
Parameters
- x: list
the list to be tested
Returns
the type list or None