I want to generate compound charts (e.g: Bar+line) from my database using python.
How can i do this ?
Thanks in Advance
You might want to look up Matplotlib.
This is extremely simple to do using matplotlib using the plot and bar methods:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar
The matplotlib gallery is usually a good place to start for examples of working code:
http://matplotlib.sourceforge.net/gallery.html
Pretty easy to do with pygooglechart -
You can basically follow the bar chart examples that ship with the software and then use the add_data_line method to make the lines on top of the bar chart
If you are rendering to a web browser, you might also consider jQuery and Flot using python-flot-utils. If you want static images, the other two answers are correct. Matplotlib is excellent.
Related
I have a Data Science related project. I need to visualize my variables. I can do it using bar charts and scatterplots, but I have been asked to make a diagram like this. The problem is, I don't even know where to begin or what packages to use. If someone can guide me, It will be great. I must use Python.
The diagram I need to make
You may want to try one of the Python Graphwiz adaptations:
https://github.com/xflr6/graphviz
http://pygraphviz.github.io/
I'm using matplotlib and python to make an animated scatter plot with points as 'balls' that bounce around, just like this:
https://jakevdp.github.io/downloads/videos/particle_box.mp4
It is interactive at runtime (with sliders to change velocity, attraction, etc), simulating on the go.
I would like to then publish it with the interactivity and all in html.
Problem: I don't know of a way to publish matplotlib interactivity to html directly.
So can I do it in python? Or is there a better way?
Which library (or program, if different from python) would you recommend as the simplest and fastest for this kind of project? I don't need "pretty" customizations and all that, I just need easy calculations and simulations (python) to then plot in a few easy lines of code (matplotlib). I do need to change the dots (balls) colors though.
I have looked at mpld3 that should wrap matplotlib around D3js. But I don't know anything about js and it is not very straightforward, so it would take me a bit to learn.
I have also looked at plotly, but it doesn't seem to have the same customization of the animation I need.
I have looked at Dash with plotly, but it would be a whole new environment to learn, and definitely overkill.
So the questions are: is there a way to output matplotlib interactive animations to html that I haven't found?
If not, what tools would you use to accomplish this project within a fast timeframe and shallow learning curve, based on my beginner/low intermediate python and matplotlib skill level?
Thank you!
I saw it was possible to make an interactive histogram with svg on the matplotlib's documentation.
Would it be possible to do this for a standard plot as for time series for example ?
Yes, it is. I have tried the example and it can produced interactive SVG. You may need to open it on browser.
The other way is using https://pypi.org/project/drawSvg/.
I am trying to achieve a Boxplot with hover tool tip in Python
I have tried bokeh.charts and bkcharts which are deprecated and no module is found for the same.
I even tried mpld3, but all I got was Scatter plot with the tooltip,
I even tried the bokeh box plot https://docs.bokeh.org/en/latest/docs/gallery/boxplot.html from here but it is very complex and making use of unnecessary groupby column.
If anyone has boxplot with hover tool tip in python than please help.
Similar functionality can be achieved very easily in R so why not in Python???
did you try plotly?
This example may help.
You may have to add JS code so I'm aware this may not be what you need. Switch to tab "Python & R" and look at the Python code. There are comments there.
I am a graduate student with only limited knowledge of the Python programming language. I am currently working on creating a streaming visualization of EEG data. I am able to generate the individual topographical figures using matplotlib, but cannot find a way of dynamically updating a single plot in the output at specific intervals.
Is there some way of taking a list of Figure objects and dynamically displaying each one in turn after some interval in python 2.7? Perhaps using a Graphics object similar to the ones found in Java's Swing? Or would it be better simply to save my plots as images and use JavaScript to display them as desired?
Thank you in advance for any help or suggestions you may offer.
If you want to make an animation with Python, then there are plenty of ways. For example:
https://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/
http://matplotlib.org/examples/animation/double_pendulum_animated.html
http://matplotlib.org/examples/animation/dynamic_image2.html