1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-10-09 23:57:26 -04:00

rename plotting functions, add PlotScatter

This commit is contained in:
Evan Pezent 2020-05-16 08:43:24 -05:00
parent b783185acc
commit c4e9d64600
2 changed files with 4 additions and 2 deletions

View File

@ -854,7 +854,9 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons
// BB AND HOVER ----------------------------------------------------------- // BB AND HOVER -----------------------------------------------------------
// frame // frame
const ImVec2 frame_size = ImGui::CalcItemSize(size, 100, 100); const float default_w = ImGui::CalcItemWidth();
const float default_h = default_w * 0.75f;
const ImVec2 frame_size = ImGui::CalcItemSize(size, default_w, default_w);
gp.BB_Frame = ImRect(Window->DC.CursorPos, Window->DC.CursorPos + frame_size); gp.BB_Frame = ImRect(Window->DC.CursorPos, Window->DC.CursorPos + frame_size);
ImGui::ItemSize(gp.BB_Frame); ImGui::ItemSize(gp.BB_Frame);
if (!ImGui::ItemAdd(gp.BB_Frame, 0, &gp.BB_Frame)) { if (!ImGui::ItemAdd(gp.BB_Frame, 0, &gp.BB_Frame)) {

View File

@ -152,7 +152,7 @@ void ShowDemoWindow(bool* p_open) {
xs2[i] = i * 0.1f; xs2[i] = i * 0.1f;
ys2[i] = xs2[i] * xs2[i]; ys2[i] = xs2[i] * xs2[i];
} }
if (ImPlot::BeginPlot("Line Plot", "x", "f(x)", ImVec2(-1,300))) { if (ImPlot::BeginPlot("Line Plot", "x", "f(x)", ImVec2(0,0))) {
ImPlot::PlotLine("sin(50*x)", xs1, ys1, 1001); ImPlot::PlotLine("sin(50*x)", xs1, ys1, 1001);
ImPlot::PushStyleVar(ImPlotStyleVar_Marker, ImPlotMarker_Circle); ImPlot::PushStyleVar(ImPlotStyleVar_Marker, ImPlotMarker_Circle);
ImPlot::PlotLine("x^2", xs2, ys2, 11); ImPlot::PlotLine("x^2", xs2, ys2, 11);