Load PLY vertex color with Qt3D - qt

I am trying to load a PLY mesh file, with per vertex color data, using Qt3D. After some research it seems not so straightforward: QML load and display .ply mesh with color attributes
Another option I tried was to use VTK but it lacks support for Qt Quick.
I am trying to create a PLY file previewer. Is there any simple way to do this using Qt Quick?

Related

R: importing and saving SVG graphics

I have a complex task: to merge existing SVG image with barplots in R. I want to save the output file as a vector graphics as well. So I create the layout, in one of the subplots I create the barplot and now:
How can I load an existing SVG from the hard drive and then put it into the plot? I have tried grimport and grimport2 libraries but they fail to read my SVG. How should I prepare it? It is a simple sketch made in Inkscape, should I save it in any special way?
I'd prefer to use a library that is supported by Anaconda Cloud.
EDIT:
I menaged to read the .ps file with grimport and convert it to a picture object - it was crashing previously because I had a text box with non-standard font in the SVG and the library could not ready that properly (some encoding problems).
Now I am just looking for a way to put the Picture object on the layout, just as if I would use plot(runif(10), runif(10)) to have a scatterplot
grid.picture(picture_object[-1],x=x_coord,y=y_coord)
With the variables x_coord and y_coord I can manipulate the position of the image.

Is there a way to create interactive plots (a la D3) in IPython notebooks?

I found those two answers:
Animated graphs in ipython notebook ,
How to grab matplotlib plot as html in ipython notebook?
But they don't address interactivity. I would like to display a plot with 2-3 curves and let the user hover those curves to receive more details or control the parameters that are used to generate those curves from a combo-box
check the following answer at iPython: Manipulate-like command.
as well as the two following directions:
IPython interact/ive as motivated in IPython - The Attributes ofSoftware and How They Affect Our Work - Brian Granger near 32m:12s; and available at IPython's github
Altair provides a powerful and succinct syntax, based on vega-lite; see the gallery
MPLD3: Bringing Matplotlib to the Browser
I don't believe the standard matplotlib plots are capable of the interactivity you want. Chaco can do interactive graphs, but not in an ipython notebook, AFAICT. Your best bet is probably Bokeh. It outputs to Javascript/HTML, can do interactive graphs, and has an example of using it from ipython.
You may want to check out Plotly. They render interactive D3 plots inside IPython Notebooks (examples here. You can export as static images as well, and zoom, hover, pan, and see text on the hover. Interactivity is one of the pitches they're emphasizing. For more, you can also use IPython widgets inside the Notebook, which gives you more control and options. For example:
Like #AFoglia, I'm going to suggest other libraries that might be what you're looking for: Tangle, Mathematica Notebooks, IPython / Bokeh, RactiveJS, or ReactJS.
Another solution might be the Charts library. It enables you to use the excellent Highcharts javascript library to make beautiful and interactive plots out of the box.
Some features:
Vector plots which you can download in .png, .jpg and .svg formats so you will never run into resolution problems.
Interactive charts (zoom, slide, hover over points, ...)
Usable in an IPython notebook
Explore hundreds of data structures at the same time using the asynchronous plotting capabilities.
Disclaimer: I'm the developer of the library
You can run javascript straight from IPython notebooks (%%html and %%javascript), so it should be possible to run D3 code. Check this video. The exact way in which this would be implemented is not set in stone yet, as this is a feature for IPython 2.0. There are many hacks available as of now, as well as projects that try to port some characteristics of D3 to Python (such as bokeh and python-nvd3).
I have not yet tested any of these. My own bias would be to try the example below first, which is static, but uses D3 directly (so it should theoretically work for interactive plots):
gist
notebook
Other answeres here seem to be outdated. IPython 2.0 has support for interactive widgets. Read the docs including some examples, but note that the nbviewer.ipython.org does not show the interactive widgets. Copy & pasting the examples to try.jupyter.org works.

pyqt qstatemachine graphical representation

I am working on implementing a graphical representation of a state machine I already have. My question is, how can I generate a graphical representation using PyQT? so more clearly, I want a window to pop up with the fsm of the states and the transition shown.
Is this possible without manually drawing each state or building my own state drawing library?
Thanks.
Take a look at Graphviz, this is a suite of graph layout tools and libraries and it used by many other programs for drawing graphs such as Doxygen and KCacheGrind.
You can use it either as a library, to link against; or write out a file, call the executable to process it and read the file back in. This second (file write/process/read) method is the most commonly used.
To do this you:
Write out the graph (your FSM) in dot format (a simple text format).
Call dot (one of the graphviz tools) with the output format as dot, this will append the layout information to the file
Read the dot file back in and use the position information
There are several libraries for doing this including for Python, see pydot.

Interactive Graph in Qt

I want to make interactive graph like this using Qt and C++ : http://jsxgraph.uni-bayreuth.de/wiki/index.php/Cubic_spline_interpolation
Any leads on how to do that ?
EDIT :
Okay, I've already tried my hands on the QGraphicsView class and qwt library. However, I find no easy way to introduce interactive-ness. Is there an easy way to do that ?
Start with the QGraphicsview framework and the diagram example

Qt and exporting vector images

I am using QPainter to draw some graphs on the screen and save these graphs as a raster images.
Is it possible to use the same logic I used for rasterizing these graphs to have them exported to vector images that I can use in a PDF?
You can use a QSvgGenerator as a "backend" to your QPainter, and you'll get an SVG document out of it. (The documentation has an example for how to do that.)
I don't know if you can use that directly in PDFs, but there are converters out there if you need a different vector graphics format.

Resources