The idea is quite simple: I want to create a bar chart with matplotlib using data of a table that is being generated before.
I expect a chart like this one:
http://matplotlib.sourceforge.net/examples/pylab_examples/table_demo.html
But Im wondering how to do this just by using data out of a dbf table instead.
It seems to be somehow possible but even this example I didn't get to work:
http://www.packtpub.com/article/plotting-data-using-matplotlib-part2?utm_source=js_matplotlib_abr3_1009&utm_medium=content&utm_campaign=janice
As I am a beginner with matplotlib I would like to learn this using a functioning example.
1) Are there any examples or code snipplets around to look at that any of you could recommend?
2) What data format would be best for this task (my tool generates dbf, but it's probably not a big deal to convert either to csv or Excel)
There is dbfpy which allows you reading from a DBF file. But I suggest using a CSV file and numpy.loadtxt if possible, because it should be much faster.
Related
Does anyone know how I can export a plotly sunburst plot as a standalone file which can keep all the functionalities, like annotation while hovering and expansion by click?
Visualizing a hierarchical data with plotly.sunburst in python is a beautiful and beneficial way of presenting it in the best order, while you are able to hover the values to see the annotation, click on each parent section to collapse and expand the child values, etc.. But to present the visualized data (plot) independently without having to open the Python notebook, needs the plot to be saved and exported in a standalone file format that allows keeping every functionality available.
Does anyone know how to do this? and what file format can give this luxury to us?
Thanks
Saving to an HTML file will do the trick:
doc
I have several groups of data and I want to have a table to both visualize them and summarize some important features. What I want is something like the following:
The data are known and it is easy to get these features. But how to have a table (or whatever widget, as long as it shows like a table) to include both the small chart like a thumbnail (plotted by matplotlib)?
Is there a way I can use any Python GUI library (e.g., tkinter) to make it? I would appreciate any help! Thank you!
This image is created in Excel :(
We should be able to control the size of the chart so that it can "fit" the font of the text (data).
The borderlines are preferred but not required.
This is something you could use pyside/pyqt for. In pyqt all text labels can also be set as images, so you can just save your images from matplotlib and load them in PYQT. PYQT has an editor that generates your front end code, so I would recommend just downloading it and playing a bit with the editor. But PYQT is only good if you want a live GUI.
If you want to generate a file, just use excel like you are already doing with openpyxl (https://openpyxl.readthedocs.io/en/stable/)? I use it for a lot of my reports. With PIL you can add images from matplotlib.
Using maptplotlib I have created 9 graphs which are combined in to a single pdf using the command savefig. However I need to be able to show the statistical analysis below each plot with .describe(). What would be the best way to do this?
Pandas has the possibility to include a table with a plot. See the table kwarg to pandas.DataFrame.plot. See the docs: http://pandas.pydata.org/pandas-docs/dev/visualization.html#visualization-table
There are multiple possibilities:
http://pbpython.com/pdf-reports.html
http://gael-varoquaux.info/computers/pyreport/
https://github.com/JanSchulz/knitpy
For the last, have a look at https://github.com/JanSchulz/knitpy/tree/master/examples, the docx, pdf and html versions were generated from the .pymd source. The example includes both pandas.DataFrames and matplotlib figures.
Disclaimer: I'm the author of knitpy
I have got graph which need to analyzed and report an Error.As of Now I had a data in Excel data.So I have used xlsxwriter to Create graph.But I need to analyze graph.
1.Solid red line was created using xlsxwriter using excel data and was very easy to implement.
In later Enhancement,
2.In Ideal condition,The formula provided to us, we will have dotted red line. So we need to determine difference and report an error.
So First approach was, write a data in Excel sheet using formula and compare data into Excel sheet and report an error.
But we also need to represent into graph also and we will have upcoming task also in which we require graph (basically 2D and line graph) I have googled and found matplotlib which generally use for create graph. So I have very basic question,
Can anyone suggest me library which can be used for this scenario. it will be great if I have input any standard graph library(cover Line grpah) So I can put effort to familiarize with them. it will save lot of effort of us. we generally create graph for circuit analysis.
Language : Python
Environment : Linux
Library : Should be open source
I know, it is very open ended question.But I thought Let have a opinion who has used graph in Python
or is it possible to create below like diagram using matplotlib
I am using matplotlib and a modified version of this example to generate plots in pdf files. So I am plotting each plot on a single page and the results are just fine.
Now I would like to list all the data used in the plots in a rather long table. This table should be placed below the last plot (so not each plot should get its own table).
Is there a way to plot LaTeX like tables in a pdf file using matplotlib?
In principle, you can place almost any TeX stuff onto a plot using something like plt.text(1,2,r'$a^2+b^2=42$'). For aligning equations things like eqnarray work as well, like this. Just don't forget to use raw strings, for otherwise python can misinterpret TeX commands which start with backslashes.
Unless using a plot to write text, I think it is save to say, that it is not possible to only write a table to a matplotlib pdf output file.
Currently I am using tex to write the table and pyPdf to merge the two results. I think this is the cleanest solution to the problem.