Skip to content

Commit

Permalink
implot binding: restore offset param (but not stride)
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Apr 17, 2024
1 parent 607e9f4 commit 4316732
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 103 deletions.
64 changes: 47 additions & 17 deletions bindings/imgui_bundle/implot/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1377,69 +1377,83 @@ def set_next_axes_to_fit() -> None:
# Plots a standard 2D line plot.
# IMPLOT_TMP void PlotLine(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotLineFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_line(label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, flags: LineFlags = 0) -> None:
def plot_line(
label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, flags: LineFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotLine(const char* label_id, const T* xs, const T* ys, int count, ImPlotLineFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_line(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: LineFlags = 0) -> None:
def plot_line(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: LineFlags = 0, offset: int = 0) -> None:
pass

# Plots a standard 2D scatter plot. Default marker is ImPlotMarker_Circle.
# IMPLOT_TMP void PlotScatter(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotScatterFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_scatter(
label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, flags: ScatterFlags = 0
label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, flags: ScatterFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, ImPlotScatterFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_scatter(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: ScatterFlags = 0) -> None:
def plot_scatter(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: ScatterFlags = 0, offset: int = 0) -> None:
pass

# Plots a a stairstep graph. The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]
# IMPLOT_TMP void PlotStairs(const char* label_id, const T* values, int count, double xscale=1, double xstart=0, ImPlotStairsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_stairs(
label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, flags: StairsFlags = 0
label_id: str, values: np.ndarray, xscale: float = 1, xstart: float = 0, flags: StairsFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotStairs(const char* label_id, const T* xs, const T* ys, int count, ImPlotStairsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_stairs(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: StairsFlags = 0) -> None:
def plot_stairs(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: StairsFlags = 0, offset: int = 0) -> None:
pass

# Plots a shaded (filled) region between two lines, or a line and a horizontal reference. Set yref to +/-INFINITY for infinite fill extents.
# IMPLOT_TMP void PlotShaded(const char* label_id, const T* values, int count, double yref=0, double xscale=1, double xstart=0, ImPlotShadedFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_shaded(
label_id: str, values: np.ndarray, yref: float = 0, xscale: float = 1, xstart: float = 0, flags: ShadedFlags = 0
label_id: str,
values: np.ndarray,
yref: float = 0,
xscale: float = 1,
xstart: float = 0,
flags: ShadedFlags = 0,
offset: int = 0,
) -> None:
pass

# IMPLOT_TMP void PlotShaded(const char* label_id, const T* xs, const T* ys, int count, double yref=0, ImPlotShadedFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_shaded(label_id: str, xs: np.ndarray, ys: np.ndarray, yref: float = 0, flags: ShadedFlags = 0) -> None:
def plot_shaded(
label_id: str, xs: np.ndarray, ys: np.ndarray, yref: float = 0, flags: ShadedFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotShaded(const char* label_id, const T* xs, const T* ys1, const T* ys2, int count, ImPlotShadedFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_shaded(label_id: str, xs: np.ndarray, ys1: np.ndarray, ys2: np.ndarray, flags: ShadedFlags = 0) -> None:
def plot_shaded(
label_id: str, xs: np.ndarray, ys1: np.ndarray, ys2: np.ndarray, flags: ShadedFlags = 0, offset: int = 0
) -> None:
pass

# Plots a bar graph. Vertical by default. #bar_size and #shift are in plot units.
# IMPLOT_TMP void PlotBars(const char* label_id, const T* values, int count, double bar_size=0.67, double shift=0, ImPlotBarsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_bars(
label_id: str, values: np.ndarray, bar_size: float = 0.67, shift: float = 0, flags: BarsFlags = 0
label_id: str, values: np.ndarray, bar_size: float = 0.67, shift: float = 0, flags: BarsFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotBars(const char* label_id, const T* xs, const T* ys, int count, double bar_size, ImPlotBarsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_bars(label_id: str, xs: np.ndarray, ys: np.ndarray, bar_size: float, flags: BarsFlags = 0) -> None:
def plot_bars(
label_id: str, xs: np.ndarray, ys: np.ndarray, bar_size: float, flags: BarsFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotBarGroups(const char* const label_ids[], const T* values, int item_count, int group_count, double group_size=0.67, double shift=0, ImPlotBarGroupsFlags flags=0); /* original C++ signature */
Expand All @@ -1457,31 +1471,47 @@ def plot_bar_groups(
# Plots vertical error bar. The label_id should be the same as the label_id of the associated line or bar plot.
# IMPLOT_TMP void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* err, int count, ImPlotErrorBarsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_error_bars(label_id: str, xs: np.ndarray, ys: np.ndarray, err: np.ndarray, flags: ErrorBarsFlags = 0) -> None:
def plot_error_bars(
label_id: str, xs: np.ndarray, ys: np.ndarray, err: np.ndarray, flags: ErrorBarsFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotErrorBars(const char* label_id, const T* xs, const T* ys, const T* neg, const T* pos, int count, ImPlotErrorBarsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_error_bars(
label_id: str, xs: np.ndarray, ys: np.ndarray, neg: np.ndarray, pos: np.ndarray, flags: ErrorBarsFlags = 0
label_id: str,
xs: np.ndarray,
ys: np.ndarray,
neg: np.ndarray,
pos: np.ndarray,
flags: ErrorBarsFlags = 0,
offset: int = 0,
) -> None:
pass

# Plots stems. Vertical by default.
# IMPLOT_TMP void PlotStems(const char* label_id, const T* values, int count, double ref=0, double scale=1, double start=0, ImPlotStemsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_stems(
label_id: str, values: np.ndarray, ref: float = 0, scale: float = 1, start: float = 0, flags: StemsFlags = 0
label_id: str,
values: np.ndarray,
ref: float = 0,
scale: float = 1,
start: float = 0,
flags: StemsFlags = 0,
offset: int = 0,
) -> None:
pass

# IMPLOT_TMP void PlotStems(const char* label_id, const T* xs, const T* ys, int count, double ref=0, ImPlotStemsFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
@overload
def plot_stems(label_id: str, xs: np.ndarray, ys: np.ndarray, ref: float = 0, flags: StemsFlags = 0) -> None:
def plot_stems(
label_id: str, xs: np.ndarray, ys: np.ndarray, ref: float = 0, flags: StemsFlags = 0, offset: int = 0
) -> None:
pass

# IMPLOT_TMP void PlotInfLines(const char* label_id, const T* values, int count, ImPlotInfLinesFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
def plot_inf_lines(label_id: str, values: np.ndarray, flags: InfLinesFlags = 0) -> None:
def plot_inf_lines(label_id: str, values: np.ndarray, flags: InfLinesFlags = 0, offset: int = 0) -> None:
"""Plots infinite vertical or horizontal lines (e.g. for references or asymptotes)."""
pass

Expand Down Expand Up @@ -1531,7 +1561,7 @@ def plot_histogram2_d(

# Plots digital data. Digital plots do not respond to y drag or zoom, and are always referenced to the bottom of the plot.
# IMPLOT_TMP void PlotDigital(const char* label_id, const T* xs, const T* ys, int count, ImPlotDigitalFlags flags=0, int offset=0, int stride=sizeof(T)); /* original C++ signature */
def plot_digital(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: DigitalFlags = 0) -> None:
def plot_digital(label_id: str, xs: np.ndarray, ys: np.ndarray, flags: DigitalFlags = 0, offset: int = 0) -> None:
pass

# IMPLOT_API void PlotImage(const char* label_id, ImTextureID user_texture_id, const ImPlotPoint& bounds_min, const ImPlotPoint& bounds_max, const ImVec2& uv0=ImVec2(0,0), const ImVec2& uv1=ImVec2(1,1), const ImVec4& tint_col=ImVec4(1,1,1,1), ImPlotImageFlags flags=0); /* original C++ signature */
Expand Down
2 changes: 1 addition & 1 deletion external/implot/bindings/litgen_options_implot.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ def litgen_options_implot() -> LitgenOptions:
]
)

options.fn_params_exclude_names__regex += "|^stride$|^offset$"
options.fn_params_exclude_names__regex += "|^stride$"

return options
Loading

0 comments on commit 4316732

Please sign in to comment.