Comments (17)
Any comments about this issue ? It'd be nice to know your ideas on further developments in this area (if any)
from implot.
Hi @sergeyn , sorry for the slow reply and not addressing open PRs. I've been busy with other work and hope I can get to them soon.
Regarding this issue, I think this falls under the need to (optionally) downsample user data. For example, see the documentation for pyqtgraph:
downsampleMethod | ‘subsample’: Downsample by taking the first of N samples. This method is fastest and least accurate. ‘mean’: Downsample by taking the mean of N samples. ‘peak’: Downsample by drawing a saw wave that follows the min and max of the original data. This method produces the best visual representation of the data but is slower. |
from implot.
But I'm not sure how exactly does this addresses the issue. The problem is that points at the same place from neighbor line segments don't end up at the same spot. With dense rendering like I do problem just becomes obvious, it will not go away if you perform a reduction, unless you reduce everything to one line of course.
I mean that something like this: https://github.com/mattdesl/extrude-polyline needs to get implemented to properly draw connected segments.
from implot.
Well, downsampling reduces the chance that you have many points hitting a single pixel, I suppose.
Regarding connected segments: If I'm not mistaken, this is what ImGui's AddPolyline
does by default (I can't remember for sure, perhaps I'm wrong). Can you swap out ImPlot's implementation with a call to this function and see if it improves?
from implot.
Will try , thanks. I'm honestly not that familiar imgui internals yet. Another way I am thinking about is to push actual line strips to gpu. This would reduce amount of data generated and you get thin connected lines without much effort.
The default line rendering you have is for performance reasons, correct ? I could further significantly optimize line rendering but I don't feel like investing time into a method which doesn't produce accurate result.
from implot.
I agree that we could get optimizations by bypassing ImGui and going straight to the GPU, but I'm hesitant to support that right now since it would be a massive undertaking to handle all the potential backends (we'd essentially have to provide an implementation for every example backend ImGui does).
from implot.
@sergeyn , could you post some screenshots of what exactly is happening here. I'm curious.
from implot.
from implot.
@sergeyn , I'm testing your PR. Can you provide the code for the plot above?
from implot.
[](void*, int idx) {
float r = 0.9f; // outer radius
float a = 0; // inner radius
float b = 0.05f; // incerement per rev
float n = (r - a) / b; // number of revolutions
double th = 2 * n * M_PI; // angle
float Th = float(th * idx / (1000000 - 1));
return ImVec2(0.5f+(a + b*Th / (2.0f * (float) M_PI))*cosf(Th), 0.5f + (a + b*Th / (2.0f * (float)M_PI))*sinf(Th));
}, nullptr, 1000000);```
Note that when plot completely gets culled away, you may see garbage on screen (same as you have in your master currently), which is fixed by [this](https://github.com/ocornut/imgui/pull/3232) PR. It's not a problem of plot rendering.
from implot.
Fixed in #41
from implot.
May I ask how exactly is this fixed ?
As you can see on the image - here almost every other pixel is missing.
from implot.
Apologies, I misremembered the issue. I thought this one was related to the spiral truncating.
Yes, this does seem to still be an issue. As I said before, I think the best solution for this is to down sample the data with the user's permission.
from implot.
from implot.
Out of curiosity, what sort of data are you trying to plot where this is a real issue?
from implot.
time series with possibility for extreme zoom-outs. I simple want them to look nice.
from implot.
I'm closing this issue because:
- We are never going to support mitered edges...the cost is just too high
- Downsampling, as you said, should NOT be default, and it's actually quite simple to implement using the existing offsetting and striding features. An example of this can be seen in the new
Time Formatting
demo, where 31,622,400 points are dynamically downsampled and plotted:
from implot.
Related Issues (20)
- How to independently use `ShowDatePicker` and `ShowTimePicker` to select date/time? [Almost solved]
- How can I rotate x labels?
- How to change the interval between tick lables in an axis in plot lines?
- Show values of points in mouse position
- How to set the height of a plot? HOT 1
- Add items to context menu HOT 7
- Unable to see all elements of the legend if graph is small
- Scaling implots
- save figure HOT 2
- Question: undeclared identifiers and executable configuration.
- Crash when rendering shaded plots with no data point [v0.16] HOT 1
- `Constrains` should scroll rather than zoom if possible. HOT 3
- Show custom label format only for cursor position in plot
- Implot demo error: MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 1>C:\Users\PvPSwagHD\source\repos\imgui\x64\Debug\imgui.exe
- PlotBarGroups show exact values of items
- New release to work with ImGui v1.90
- Cannot scroll/zoom primary axis when linked to secondary
- Constructors and Functions of structs don't have the IMPLOT_API macro
- IsAnnotationHovered() or equivalent
- LNK2019: unresolved external symbol "void __cdecl ImPlot::PlotBarGroups<double [1]>(...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from implot.