Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PlotBubbles #611

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Added PlotBubbles #611

wants to merge 5 commits into from

Conversation

Luc16
Copy link

@Luc16 Luc16 commented Feb 19, 2025

Summary
This PR adds support for bubble plots to ImPlot, inspired by MATLAB’s bubblechart. Existing plot functionality is unaffected.


Function signatures

IMPLOT_TMP void PlotBubbles(const char* label_id, const T* values, const T* szs, int count, double xscale=1, double xstart=0, ImPlotBubblesFlags flags=0, float min_pxsize=3, float max_pxsize=50, int offset=0, int stride=sizeof(T));

IMPLOT_TMP void PlotBubbles(const char* label_id, const T* xs, const T* ys, const T* szs, int count, ImPlotBubblesFlags flags=0, float min_pxsize=3, float max_pxsize=50, int offset=0, int stride=sizeof(T));

IMPLOT_API void PlotBubblesG(const char* label_id, ImPlotGetter3D getter, void* data, int count, ImPlotBubblesFlags flags=0, float min_pxsize=3, float max_pxsize=50);
  • min_pxsize and max_pxsize set the minimum and maximum bubble diameters (in pixels).
  • By default, marker outlines are not rendered and the fill color alpha is set to 0.5.

Example
Below is an example bubble plot (two different datasets). The bubble sizes are scaled between the specified min_pxsize and max_pxsize ([3, 50] for blue and [5, 20] for orange):

image


Feedback
Please let me know if there are any suggestions or improvements regarding:

  • The API signature or naming.
  • Default styling choices (e.g., alpha, line rendering).
  • Performance or edge-case handling.

I appreciate any comments or reviews on how to refine this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant