I want to visualize some measurement values in realtime. I think - although not finally sure - I can do this with PyChart. The surrounding application is based on PyQt.
Now I', wondering how I can put the chart drawn using PyChart into some qt widget, may be a QGraphicWidget?
Could someone give me a bit advise?
Cheers,
Wolfgang
I have learned to do this by following the instructions of Eli Benderski.
It is answered here on this site in this thread
Demo Code is here
This uses matplotlib instead of PyChart. Usage of matplotlib is well documented here.
Matplotlib allows you to interact with the plot canvas as well as importing a Navigation Tool Bar.
Hope this is helpful.
Related
I'm looking for a toolbar for matplotlib figure that contains more options than the basic one, which is automatically set in pyqt environment.
I already know how to add my own button, but I'm looking for a more advanced Toolbar already coded, that I can used directly.
In Matlab, for instance, it is possible to add points in the panel, or a text directly on the figure from the figure itself.
Outside of the one you're using, I don't think so. Try bokeh. Depending on your environment, ipywidgets may work too.
Hope that helps!
Is there any way of getting interactive tooltips in a matplotlib plot? For instance, I wanted to get this scatter plot with hovering tooltips (http://mpld3.github.io/examples/scatter_tooltip.html) functionality in my python application, because they are really useful for visualizations. Unfortunately, I do not want to show this in a browser, but integrated in my own python application, is there any way to do this?
Matplotlib can only create static images and animations. If you want something interactive, then the only way you're going to achieve this is by using a module that outputs javascript. I would suggest reading about bokeh.
It is well developed and gaining a lot of traction in the python world as being a good option for creating interactive plots. Here's an example of bokeh's hovertool capability.
Unfortunately, I do not want to show this in a browser, but integrated in my own python application
I'm not sure what your "own python application" is but you're not going to have a fun time making an interactive plot outside of a browser. I would highly suggest going a webapp route using bokeh if interactivity is truly important to you.
I'd like to know if a matplotlib chart be interactive, ie when you right click on a graph bar, a context menu opens, then you click one of the menu items and change the value of y value or you drag the top edge of the bar with mouse and it becomes taller etc,
In other words, can a matplotlib chart act like a GUI?
yep, though I should warn you: matplotlib isn't the best choice for interactive tasks. Depends on your tasks you may face performance or UX issues..
Take a look at the Chaco. It was designed for the creation of complex interactive plots.
Yes.
Matplotlib is based on Tkinter, so you can do all sorts GUI related things with it. For an example of how you can embed matplotlib in a Tkinter GUI see here:
http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html
Similarly for the functionality you are describing, you require plots that know when they've been clicked on (or mouse-overed) and that you can add callback events to. For that, the first place to look would be picker events:
http://matplotlib.org/examples/event_handling/pick_event_demo.html
As an alternative to some of the other ideas I would propose the Ipython notebook. For me it is the easiest way to do some of the things your asking about without having to get into Tkinter etc.
From Ipython 2.* onward there are interactive widgets allowing you to interact with the kernel from a GUI. I am not an expert in any sense so it is probably best explain by Fernando Perez himself.
Here is an example of interaction when solving the Lorenz differential equation demonstrating a chaotic system. This is accessible in the example of the ipython directory.
I have been searching how to embed an interactive matplotlib widget (like this one: http://matplotlib.org/examples/widgets/slider_demo.html) in a webpage. The final aim is to make an educational page.
I hope I am not duplicating the question. What google finds is always how to embed the plot as a still-shot, in an image format.
I thought I can do something with ipython notebook or plotly or gjango. But I got confused.
Is it possible at all for intractive plots?
I appreciate your guides to which direction I should think and work on.
Thank you.
In summer 2015, I'm facing a similar task: embed interactive widgets that change their underlying data when the slider is moved. This is very similar to interactive IPython widgets which are interactive when run on a local machine. Examples of what I want can be found jakevdp's blog.
To summarize work done so far:
ipywidgets-static converts interactive IPython widgets to static HTML. However, this library is no longer maintained. Development has moved to ipython/ipywidgets.
IPython is working on ipython/ipywidgets. They have a Github issue to make these widgets static and to be embedded in a standalone HTML file.
HoloViews provides some interactive slider options that can be embedded in a static HTML file (using IPython's nbconvert)
Bokeh plots that rely on interactive sliders require a server.
plot.ly doesn't support sliders/etc. I believe this is true based off this blog post.
mpld3 converts between matplotlib and d3. I believe this library supports panning and zooming, not sliders/interactivity. Here's a related Github issue
There's also blog post titled "Scientific Python in the browser: it's coming!". This post was dated 2014-3-31.
For me, the two most attractive options are ipywidgets and HoloViews but I'm looking forward to when IPython provides static interactive widgets. I expect to see solid support for static interactive widgets quickly and in less that 5 years/2020 (and in 2 years/2017?).
As of Early April 2014 the answer is yes. Based on the work going on in this space, I expect the quality and quantity of such libraries to continue to improve very quickly.
IPython 2.0, specifically the notebook, supports interactive controls, which was covered in some detail by Brian Granger in his talk IPython - The Attributes of Software and How They Affect Our Work (see from 32:25 onward for the bits you're interested in)
There are some amazing projects being worked on at the moment that combine server and client side code for the next generation of python visualisation libraries. At the moment this includes the work on MPLD3 and the ipywidgets library. There are some great interactive plots on Jake Vanderplas' blog Pythonic Perambulations that show demonstrate this.
I am looking for a Python GUI library that I can rewrite the rendering / drawing.
It has to support basic widgets (buttons, combo boxes, list boxes, text editors, scrolls,), layout management, event handling
The thing that I am looking for is to use my custom Direct3D and OpenGL renderer for all of the GUI's drawing / rendering.
edit suggested by S.Lott: I need to use this GUI for a 3D editor, since I have to drag and drop a lot of things from the GUI elements to the 3d render area, I wanted to use a GUI system that renders with Direct3D (preffered) or OpenGL. It also has to have a nice look. It is difficult to achieve this with GUI's like WPF, since WPF does not have a handle. Also it needs to be absolutly free for commercial use.
edit: I would also like to use the rendering context I initialized for the 3d part in my application
I don't know what are you working at, so maybe this is not what you're looking for, but:
Have you considered using Blender + its Game Engine?
It supports Python scripting, and provides some APIs to create "standard" GUIs too, while allowing you to do a lot of cool stuff with 3d models. This could be especially useful if your application does a lot of 3d models manipulation..
Then you can "compile" it (it just builds the all-in-one package containing all the dependencies, in a way similar to what py2exe does) for any platform you need.
You can use Qt Scene Framework with OpenGL rendering. There are many examples on Nokia site.
The best Python GUI toolkit is wxPython (also known as wxWidgets).
This is not merely my opinion, see also: wxPython quotes
wxPython is the best and most mature
cross-platform GUI toolkit, given a
number of constraints. The only reason
wxPython isn't the standard Python GUI
toolkit is that Tkinter was there
first. -- Guido van Rossum
I can't say how easy or hard it would be to add your own renderer.
There are OpenGL bindings in Python that will get you 3D rendering. Personally, I'd use wxpython as your 'gui' manager and use the bindings to do opengl for the rest. Wx has the necessary demos (check the wxpython demos installation) and information in their GLCanvas demos.
Another sample code is here too.
You might find PyClutter useful.