Skip to content

plot functions in implot library don't support pandas integer indexes #467

@po2xel

Description

@po2xel

Hi there, thanks for this wonderful library. I've been using it for two months.
I found out that the plot functions in implot library don't support pandas integer indexes. Here is an example:

# df is a pandas dataframe
implt.plot_scatter('default##default', xs=df.index.to_numpy(), ys=df.values)
implt.plot_scatter('dtype##dtype', xs=df.index.to_numpy(dtype=float), ys=df.values)

The plotted result is attached. The index of all the scatters are 0 when using the default to_numpy(), which converts the pandas index to an integer numpy array.

Image

implot library's plot functions are templated, which support different index data types. Is it possible to support different index data types in imgui_bundle?

// 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, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_TMP void PlotScatter(const char* label_id, const T* xs, const T* ys, int count, const ImPlotSpec& spec=ImPlotSpec());
IMPLOT_API void PlotScatterG(const char* label_id, ImPlotGetter getter, void* data, int count, const ImPlotSpec& spec=ImPlotSpec());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions