From 43a9236963aea7e280fb405ba902eb66a97f924c Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Fri, 13 Sep 2024 13:50:01 +0200 Subject: [PATCH] Improve imscope's scatterplot - Reduce point size to 1 pixel - call ImPlot::PlotScatter as many times as needed --- openair1/PHY/TOOLS/imscope/imscope.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/TOOLS/imscope/imscope.cpp b/openair1/PHY/TOOLS/imscope/imscope.cpp index c216156777..bba22402a3 100644 --- a/openair1/PHY/TOOLS/imscope/imscope.cpp +++ b/openair1/PHY/TOOLS/imscope/imscope.cpp @@ -279,8 +279,17 @@ class IQHist { } } else if (plot_type == 1) { if (ImPlot::BeginPlot(label.c_str(), {(float)ImGui::GetWindowWidth() * 0.3f, (float)ImGui::GetWindowWidth() * 0.3f})) { - // Limit the amount of data plotted with scatterplot (issue with vertices/draw call) - ImPlot::PlotScatter(label.c_str(), iq_data->real.data(), iq_data->imag.data(), std::min(16000, iq_data->len)); + int points_drawn = 0; + while (points_drawn < iq_data->len) { + // Limit the amount of data plotted with PlotScatter call (issue with vertices/draw call) + int points_to_draw = std::min(iq_data->len - points_drawn, 16000); + ImPlot::SetNextMarkerStyle(ImPlotMarker_Circle, 1, IMPLOT_AUTO_COL, 1); + ImPlot::PlotScatter(label.c_str(), + iq_data->real.data() + points_drawn, + iq_data->imag.data() + points_drawn, + points_to_draw); + points_drawn += points_to_draw; + } ImPlot::EndPlot(); } } else if (plot_type == 2) {