ograph package
Subpackages
Submodules
ograph.oconfig module
ograph.ofig module
Custom plotting library.
- ograph.ofig.fig2(xlims: Tuple[float, float] | None = None, ylims: Tuple[float, float] | None = None, arg: None | tuple[float, float, float, float] = None, **kwargs: Any) Tuple[Figure, Axes][source]
Create then return a figure with a 2-dimensional axis.
Invoke
pyplot.figure()to create figure, then invokepyplot.axes()to create anAxes. Return both objects in a tuple.- Parameters:
arg –
Noneor 4-tuple.None: A new full window Axes is added usingsubplot(**kwargs).4-tuple of floats rect =
(left, bottom, width, height): Add a new Axes with dimensions rect in normalized (0, 1) units, usingFigure.add_axes()on the current figure.
xlims – Size of figure along the X axis
ylims – Size of figure along the Y axis
*args – Positional arguments to pass to
pyplot.axes()*kwargs – Keyword arguments to pass to
pyplot.axes()
- ograph.ofig.fig3(xlims: Tuple[float, float] | None = None, ylims: Tuple[float, float] | None = None, zlims: Tuple[float, float] | None = None, arg: None | tuple[float, float, float, float] = None, **kwargs: Any) Tuple[Figure, Axes3D][source]
Create then return a figure with a 3-dimensional axis.
Invoke
pyplot.figure()to create figure, then invokepyplot.axes()to create anAxes3D. Return both objects in a tuple.- Parameters:
arg –
Noneor 4-tuple.None: A new full window Axes is added usingsubplot(**kwargs).4-tuple of floats rect =
(left, bottom, width, height): Add a new Axes with dimensions rect in normalized (0, 1) units, usingFigure.add_axes()on the current figure.
xlims – Size of figure along the X axis
ylims – Size of figure along the Y axis
ylims – Size of figure along the Y axis
*kwargs – Keyword arguments to pass to
pyplot.axes()
ograph.ofunc module
ograph.oplot module
- exception ograph.oplot.DimensionError[source]
Bases:
ValueErrorRaised when the dimension of a figure does not agree with the plot.
When this happens, something is going seriously wrong.
- ograph.oplot.ensure_axes_dimension(axes: Axes | Axes3D, dim: int) None[source]
Assert if the given axes is of the specified dimension.
- Raises:
DimensionError – if
dimdoes not agree with the dimension ofaxes:.
- ograph.oplot.view_rotate(h_rotate: float, v_rotate: float) None[source]
Rotate the current Axes3D.
@param h_rotate the degree to rotate vertically @param v_rotate the degree to rotate horizontally
- ograph.oplot.view_axis_pos(pos: str | None) None[source]
Position labels and ticks of the current Axes3D.
- Parameters:
pos – The position, one of
'lower','upper','default','both','none', andNone.
- ograph.oplot.high_res() None[source]
Set figures to render in higher resolution.
Set runtime configuration
figure.dpito 200.- Effect:
Change runtime configurations.
- ograph.oplot.low_res() None[source]
Set figures to render in the default resolution.
Set runtime configuration
figure.dpito 100, the default value.- Effect:
Change runtime configurations.
- ograph.oplot.annotate(title: str, xlabel: str, ylabel: str, zlabel: str | None = None) None[source]
Annotate the current figure.
Set
title,xlabel, andylabelof the current axes. Also set runtime configurations that style annotations.To reset the parameters, call:
matplotlib.rcParams.update(matplotlib.rcParamsDefault)- Parameters:
title – Title of the figure
xlabel – Labels for the x axis
ylabel – Labels for the y axis
zlabel – Labels for the z axis
- Effect:
Plot to the current active figure. Change runtime configurations.
- ograph.oplot.heatmap(data: ndarray[tuple[Any, Any], dtype[float64]] | Sequence[Sequence[float]], xlabels: Sequence[str] | None = None, ylabels: Sequence[str] | None = None) None[source]
Plot a matrix to the current active axis as a heatmap.
- Parameters:
data – A Numpy matrix.
xlabels – labels for cells along the x axis.
ylabels – labels for cells along the x axis.
- Effects:
Plot at the current active axis.
- ograph.oplot.chull(shape: ndarray[tuple[Any, Any], dtype[float64]] | Sequence[Sequence[float]] | ndarray[tuple[Any, Any, Any], dtype[float64]] | Sequence[Sequence[Sequence[float]]]) None[source]
Plot a convex hull to the current active axes.
Detect the shape of points by inspecting the first in the sequence.
- Parameters:
shape – A sequence of 2- or 3-dimensional points.
- Effects:
Plot at the current active axis.
- ograph.oplot.arrow(start: ndarray[tuple[Any], dtype[float64]] | Sequence[float], end: ndarray[tuple[Any], dtype[float64]] | Sequence[float], *args: Any, **kwargs: Any) None[source]
Plot an arrow to the current Axes or Axes3D.
- Parameters:
start – The starting point of the arrow.
end – The ending point of the arrow.
- ograph.oplot.plot(fun: Callable[[float], float], x_range: tuple[float, float], density: int = 1000, *args: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], **kwargs: Any) None[source]
Plot a contour map to the current Axes or Axes3D.
- Parameters:
fun – The function to plot.
x_range – A tuple of the beginning and end of the x axis.
density – the number of points sampled over each axis.
- ograph.oplot.contour(fun: Callable[[float, float], float], x_range: tuple[float, float], y_range: tuple[float, float], density: int = 100, levels: int = 50, cmap: str = 'viridis', colorbar: bool = True, alpha: float = 0.5) None[source]
Plot a contour map to the current Axes or Axes3D.
- Parameters:
fun – The function to plot.
x_range – A tuple of the beginning and end of the x axis.
y_range – A tuple of the beginning and end of the y axis.
density – the number of points sampled over each axis.
levels – The number of contour lines.
cmap – The colour map used by the contour map.
colorbar – If True, draw the colour bar.
- ograph.oplot.wireframe(fun: Callable[[float, float], float], x_range: tuple[float, float], y_range: tuple[float, float], density: int = 100, cmap: str = 'viridis', alpha: float = 0.9, **kwargs: dict[str, Any]) Line3DCollection[source]
Plot a wireframe map to the current Axes or Axes3D.
- Parameters:
fun – The function to plot.
x_range – A tuple of the beginning and end of the x axis.
y_range – A tuple of the beginning and end of the y axis.
density – the number of points sampled over each axis.
cmap – The colour map used by the contour map.
alpha – Alpha value (transparency) of the frame.
- ograph.oplot.surface(fun: Callable[[float, float], float], x_range: tuple[float, float], y_range: tuple[float, float], density: int = 100, cmap: str = 'viridis', colorbar: bool = True, alpha: float = 0.9) Line3DCollection[source]
- ograph.oplot.splatter(fun: Callable[[float], float], x_range: tuple[float, float], density: int = 30, plot_links: bool = False, *, edge_args: dict[str, Any] = {}, node_args: dict[str, Any] = {}, fill_args: dict[str, Any] = {}) None[source]