How to display Matlab figures on the website using python? - python

Like the Pyecharts and Echarts, the figure in Matlab can easily interact with humans. Thus, I'd like to build a data visualization platform on web using the Matlab figure. I know Matlab provide a way to do this, but it's single and boring comparing with the Pyecharts(Echarts).
In addition, I know how to exhibit static images of Matlab figures on web, so you'd better not give this suggestion.
Finally, is there any idea to show Matlab figures on web using python? Appreciation for your comments.

Related

How to create unstructured 2D meshes from CAD files in python

I'm working on a finite differences code to solve 2D problems. I want to be able to solve complex geometries written as STEP or IGES files. However I don't know how to read and mesh this kind of files.
While I know that there are free and independent meshing applications, I want my code to be self-contained. Is there a way to achieve this on python?
You might be interested in GMSH API. GMSH is well-known for a while as a free open-source mesher, and recently (by relative means), they introduced an API for C,C++, Python, and Julia.
At first, a simple usage of Top level functions GMSH::open and Mesh function GMSH::generate(2) can get you started.

Does Python have an interactive plot manipulation library similar to dygraphs?

I'm currently going through some time series analysis, and I'd like to easily implement interactive zoom and range selection.
I know dygraphs offers such features, and I'd like to know if there is a similar Library for Python?
Thanks

Draw performance profile figure in MATLAB and Python

what function should i use to draw the above performance profile of different algorithms, the running time data is from python implementation, stored in lists for different algorithm. Is there any build-in function in Python or Matlab to draw this kind of figure automatically? Thanks
You will have to store the performance of your algorithms in a list (if you are using Python) or in a matrix (Matlab) and then plot the results.
Matlab comes with several plot functions such as figure(), plot(), subplot() that you will need to draw those figures.
In Python you can use the third-party package Matplotlib. By the way, Matplotlib gives you a MatLab like environment called PyLab that tries to emulate Matlab commands.
You can make something like that in Python with Matplotlib using step and plot.
In Matlab you can use plot and stairs.
A Python function that draws these profiles which can be found, with instructions, here. After importing this function and generating a Pandas DataFrame object using your data (see instructions), the generation of the performance profile is easy.
A MATLAB script that draws performance profiles can be found here.
I make simple performance charts, like those posed in the question, via Python scripts that rely on a Python module named leather. For example, within the following gist.github.com repository:
https://gist.github.com/lhuemill/f1273291e5f5e85e4b42e5c7614e60ef
is a Python script, named permutations2x2_chart_results, which does this. By default, this script produces a chart using the SVG format. A format that is directly supported by most of the popular web browsers and that are a vector versus bitmap graphic. Vector graphics tend to be a good choice for these types of performance graphs, in that the user can zoom into any portion of the results, to obtain more detail, without pixelation.

Looking for library/tool to visualise multi-dimensional data [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I'm using Python in an attempt to analyse a large chunk of empiric measurements. In essence, I've two functions transforming the empiric data which also takes 3 'count' parameters - and returns a sequence of floats in each configuration. I'm expecting (hoping) to see some interesting patterns emerge when appropriate parameters are selected. I anticipate that the patterns might be relative between sequences returned for each function - and/or relate to patterns of some kind in the parameters. In case it's relevant, the 3 'count' parameters roughly correspond to:
A 'window size' on the underlying data over which summary statistics are calculated
A number of consecutive windows used to compute a single summary statistic (i.e. the trade-off between greater spatial or greater temporal accuracy)
An 'minimum age' - an offset into history of the underlying data.
The summary statistics (which generate the resulting sequences of floats for each parameter configuration) are non-trivial but will be independently sensitive to all three parameters.
I'm interested in visualisation techniques - suited to RAD/ad-hoc enquiry that will help me experiment with this multi-dimensional data.
So far, I've tinkered with MatPlotLib but find being restricted generating two graphs of 2/3 dimensions in the style of batch processing makes investigation very tedious. Ideally, I'd find a tool that would allow me to visualise more than two dimensions... perhaps allowing me to switch real-time between dimensions in an interactive GUI.
I'd really appreciate hints from any visualisation gurus as to suitable tools I should investigate - ideally to integrate with my existing Python functions - or in other languages. I'd especially like to hear any anecdotes of success with similar visualisation problems.
EDIT to add: One possible approach I'm considering is to use animation on 2 or 3D plots (to capture another dimension... leaving 1 or 2 for manual selection)... though I've found no good tools to help me achieve this, yet.
RGL is a visualization device system for R, using OpenGL as the rendering backend. An rgl device at its core is a real-time 3D engine written in C++. It provides an interactive viewpoint navigation facility (mouse + wheel support) and an R programming interface.
GGobi is an open source visualization program for exploring high-dimensional data. It provides highly dynamic and interactive graphics such as tours, as well as familiar graphics such as the scatterplot, barchart and parallel coordinates plots. Plots are interactive and linked with brushing and identification.
There's a tutorial that covers both of the above systems here.
RPy is a very simple, yet robust, Python interface to the R Programming Language. It can manage all kinds of R objects and can execute arbitrary R functions (including the graphic functions). All errors from the R language are converted to Python exceptions. Any module installed for the R system can be used from within Python.
You might want to look at outputting SVG with animation, in which case this question might interest you. I suspect the animation aspects will require a lot of work on your part. Another option is maybe visualizing the data as a graph, although I'm don't know enough about your data to know whether this would be useful to you. If it is, cytoscape is python scriptable
If all you want is an animated surface, then gnuplot can do it. A quick intro on it can be found here, or from the gnuplot FAQ. More detail can obviously be found in the gnuplot docs.
You could try guiqwt. It's aimed for 2D graphs, but targets more specifically interactive plots (as opposed to Matplotlib, although it can handle some degree of interaction too). From the guiqwt documentation:
Overview
Based on PyQwt (plotting widgets for PyQt4 graphical user interfaces)
and on the scientific modules NumPy and SciPy, guiqwt is a Python
library providing efficient 2D data-plotting features (curve/image
visualization and related tools) for interactive computing and
signal/image processing application development.
Performances
The most popular Python module for data plotting is currently
matplotlib, an open-source library providing a lot of plot types and
an API (the pylab interface) which is very close to MATLAB’s plotting
interface.
guiqwt plotting features are quite limited in terms of plot types
compared to matplotlib. However the currently implemented plot types
are much more efficient. For example, the guiqwt image showing
function (guiqwt.pyplot.imshow()) do not make any copy of the
displayed data, hence allowing to show images which are much larger
than with its matplotlib‘s counterpart. In other terms, when showing a
30-MB image (16-bits unsigned integers for example) with guiqwt, no
additional memory is wasted to display the image (except for the
offscreen image of course which depends on the window size) whereas
matplotlib takes more than 600-MB of additional memory (the original
array is duplicated four times using 64-bits float data types).
(I haven't tried it, so I can't comment on these claims.)
Okay, now that I understand your data I can definitely suggest a method of visualisation. A coloured 3D surface density plot. Use a0, a1 and a2 as standard x,y,z axes, use a3 as the time axis, and plot different colours over a monochromatic range (or cold to hot). That way the only thing that needs an interactive slider is a3.
As far as tools to do this are concerned
I don't know whether gnuplot can do colour density plots, if it can this is your best bet. Generate an set of gifs across domain of a3, use imagemagick to make a single animated gif out of them, then use an animated .gif editor that allows you to move back and forth between frames
Again, with matplotlib, I'm not certain whether it is possible to do colour density plots
SVG can definitely do everything you need to do, including the animation aspects, but as I've said before, is going to be a lot of hard work.
Sounds like Mayavi might fit your needs. It is written in Python, can be used interactively and supports 3D graphs and animations. You can have a look at this tutorial to see if it fits your needs.
I have done an interactive 3D visualization with animation in Python using the older version 1 of mayavi, see this page.
Edit
Unfortunately, most Mayavi examples show off too much advanced functionality. Here are two examples that demonstrate more basic applications. If these two do not fit your needs, then Mayavi may not be a good choice in your case. My understanding is that you have arrays of floats that you want to visualize.
Example 1
Here is a specific example from the older page on what you can do with a 3D array of floats: 3D data example. This example shows the use of isocontour surfaces, one solid cut plane through the data and another cut plane with isocontour lines. You can interactively move the cut planes around or choose different visualization tools. (In my case I had added another dimension and an animation that presented the data as 3D-cube slices through the hypercube.)
Example 2
Here is another example of what a more "conventional" plot with Mayavi could look like: Fourier transform example. This is quite similar to what the many other plotting libraries do.
Go download a free trial of Tableau (www.tableausofware.com). It will encode your data on X, Y, size, color and shape, and you can create small multiples any other dimensions you have -- i.e. you can look at lots of dimensions at once. You can try lots and lots of visualizations very rapidly. There is free training on the company website.
Disclaimer: I work for them.
The simplest visualization for 3+dimensions is bubble chart or motion chart. On top of the x and y axis you can use the bubble size and the bubble color for the extra dimensions.
Google visualization (http://code.google.com/apis/chart/interactive/docs/gallery/motionchart.html) and its google spreadsheet interactive mode give a simple interface to play with which of the dimensions is on which of the axis/size/color.
It is not aimed at handling too many data points, but you can use it to identify patterns on samples of the data with ease.

Renderer for 3D model (points/lines) in Python

I have a 3d model that consists of points, lines and balls in space. For debugging, it would be nice to render these objects in real time and rotateable.
What are my easiest options to achieve this in python?
Since I know nothing about graphical programming, I'd like to write as litte boilerplate code as possible.
The easiest way to get 3d graphics on screen in python is VPython, though if your model is stored in a CAD file format, you'll need some other library to load the data. With just VPython, you will either need to hard-code the model or implement your own loader.
Two options I'd consider myself (depends what you're trying to do in the end):
Blender has fairly amazing Python integration. Simple example here. As I understand it, Blender's own file save format is executable python which prods the Blender Python API to reconstruct the scene. There's also a mechanism for introducing gamey logic into the Blender world but I know even little about it. Blender does have a crazy steep learning curve though.
Get into OpenGL using the Python OpenGL bindings. "Simple" example.
If you're more interested in creating the models, go with the former; if you're more interested in the rendering of them, go with the latter.
The first thing that springs to mind is processing which is an easy to use visualization toolkit. Although you actually implement your visualizations in java, a quick google found this which lets you write your sketches in python instead.

Categories

Resources