Skip to content

Commit 43d4df6

Browse files
committed
a few more docs
1 parent 388d1fb commit 43d4df6

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

cpp/source/basics/interactive_UIs_and_animation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ We will not reproduce the ImGui documentation here, visit the ImGui github page
189189

190190
![callback ui demo]([[url.prefix]]/media/imgui_py_demo.png)
191191

192+
193+
### 2D Plots with ImPlot
194+
195+
Polyscope also provides [ImPlot](https://github.com/epezent/implot) for creating little inline 2D plots like line plots, scatter plots, and histograms in the UI panes. As with ImGui, please see ImPlot's pages for documentation.
196+
192197
## Mouse Interactions
193198

194199
You can implement custom mouse behaviors on clicks and other actions within your per-frame callback function. `ImGui` exposes the state of the mouse and whether a click occurred via `ImGui::GetIO()`.

cpp/source/features/screenshots.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ struct ScreenshotOptions {
4545
- If `transparentBG` is `true`, the background will be rendered as transparent, and set as transparency alpha in the saved image if the file format supports it.
4646
- If `includeUI` is `true`, the screenshot will be captured with the ImGui UI elements (panels, buttons, etc) visible.
4747

48+
!!! warning "includeUI may not match"
49+
50+
The screenshot `includeUI` setting is imperfect, the UI will be visible, but may be in a different state compared to what you see in your own window. This is a known bug, and we hope to fix it in future version.
51+
52+
4853
???+ func "`#!cpp void screenshot(const ScreenshotOptions& options)`"
4954

5055
##### numbered screenshot

py/source/basics/interactive_UIs_and_animation.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,23 @@ The Polyscope python package includes bindings to a significant subset of ImGui
188188

189189
These bindings are not yet exhaustively documented, but they follow the naming conventions of ImGui as closely as possible for simplicity. Documentation of ImGui functions and parameters lives [here](https://github.com/ocornut/imgui/blob/master/imgui.h), and you can find the list of bound functions, types, and enums [here](https://github.com/nmwsharp/polyscope-py/blob/master/src/cpp/imgui.cpp). Common usage should be covered by the example below.
190190

191+
### 2D Plots with ImPlot
192+
193+
Polyscope also provides [ImPlot](https://github.com/epezent/implot) for creating little inline 2D plots like line plots, scatter plots, and histograms in the UI panes. As with ImGui, please see ImPlot's pages for documentation.
194+
195+
Bindings are defined in the `polyscope.implot` submodule, and again attempt to follow the original ImPlot naming exactly. Many but not all functions are bound, please file an issue for any missed functionality.
196+
197+
### Sample Custom UI
198+
191199
**Example:** Create the following UI in a Python callback
192200

193201
![callback ui demo]([[url.prefix]]/media/imgui_py_demo.png)
194202

195203
```python
196204
import polyscope as ps
197205
import polyscope.imgui as psim
206+
import polyscope.implot as psimplot
207+
import numpy as np
198208

199209
# A bunch of parameters which we will manipulate via the UI defined below.
200210
# There is nothing special about these variables, you could manipulate any other
@@ -336,6 +346,13 @@ def callback():
336346
psim.PopItemWidth()
337347

338348

349+
# Add a plot
350+
if psimplot.BeginPlot("test line plot"):
351+
psimplot.PlotLine("line plot", np.random.rand(10))
352+
psimplot.PlotInfLines("horizontal lines", np.random.rand(3), psimplot.ImPlotInfLinesFlags_Horizontal)
353+
psimplot.EndPlot()
354+
355+
339356
ps.init()
340357
ps.set_user_callback(callback)
341358
ps.show()

py/source/features/screenshots.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ ps.screenshot()
3030
img = ps.screenshot_to_buffer()
3131
```
3232

33+
!!! warning "include_UI may not match"
34+
35+
The screenshot `include_UI=True` setting is imperfect, the UI will be visible, but may be in a different state compared to what you see in your own window. This is a known bug, and we hope to fix it in future version.
36+
3337
???+ func "`#!python screenshot(filename=None, transparent_bg=True, include_UI=False)`"
3438

3539
Saves a screenshot to the path given as `filename`, with format inferred from the file extension.

0 commit comments

Comments
 (0)