Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
How would I make seaborn and bokeh plots to look professionally for a scientific paper:
Can someone advise on some common practices when creating publication level figures in python?
As #brentertainer pointed out in his comment, seaborn is a effectively a wrapper around matplotlib and with matplotlib you can do virtually anything. Here is a nice library, which can guide you and provide some overview on what is possible. One of the most important things to be comfortable with is the axes object, which you can modify to your specific use case (see example below). From seaborn there should be a way to access the axes object (and other matplotlib structures) to modify it to your delight.
I do almost all my publication figures with matplotlib, with some minor modifications, informed by the style rules of Edward Tufte. I use the following function, that I compiled/ aggregated from several stack overflow questions and tutorials. (I will do some research so give sources for this on monday). The function (in my case used for bar charts) takes an axes object and modifies it to remove some unneeded lines etc.
def tuftefy(ax):
"""Remove spines and tick position markers to reduce ink."""
#
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["left"].set_visible(False)
ax.spines["bottom"].set_visible(True)
ax.spines["bottom"].set_color('grey')
ax.grid(color="w", alpha=0.5)
ax.get_yaxis().grid(True)
ax.get_xaxis().grid(False)
However, this is a rough example of what you can do. Your main focus should be: What do I want to communicate with my figure. Pick a figure type that serves this purpose best (for example via the matplotlib example library and/ or your domain knowledge) and apply a style that supports it.
I would use matplotlib. A non-python package that many physics journals like is gnuplot. I would review the submission procedure for the journals you are aiming for also :)
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
why create figure() and calling add_axes() while plotting instead of a straight forward plot() in matplotlib. Is there any benefits to using the former approach?
As explained in matplotlib blog, the benefits of OO approach are scalability and control. The functional interface (pyplot) was build to reproduce MATLAB's method of generating figures, which is a very popular propetary programing language in engeenering departments. Pyplot works as a state-based interface, where the states are figures that can be changed by methods.
On the other hand, in the OO approach Figure are just the top level container (object) that holds many elements called Artists. This garantee whole control of the elements showed in the final Figure, like tick values, markers, grid, and so on.
To get in touch with more detailed information on this subject, i recommend that you take a look at the following links:
The Lifecycle of a Plot:
https://matplotlib.org/matplotblog/posts/pyplot-vs-object-oriented-interface/
Matplotlib Guide from Real Python:
https://realpython.com/python-matplotlib-guide/
This is used for Sub Plots wehn you have more than one plot or graphs.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
When we plot in python we generally use plt.~ not the specific name of the object, why?
and What if I want to plot a separate graph in one code?
This is maybe not really a question of programming, but one about culture.
The pyplot API is modelled after the plotting functions in MATLAB, and therefore, it has a lot of imperative style as heritage.
However, that API is a bit clumsy at times, as you suggest. It is recommended to instead use the object oriented API: Read more in the official docs: https://matplotlib.org/api/index.html?highlight=pylab
PS.
One can also take note that there is a deprecated API called pylab as well, which is even more similar to the MATLAB environment. You can find examples of it when looking at really old tutorials on numpy and matplotlib, but it is generally phased out.... It is further described in the above linked documentation.
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 4 years ago.
Improve this question
I have to make two data analysis reports using descriptive statistics, making plenty of informative plots etc.
Problem is, I'm not sure what tools should I use? I started preparing one report in Jupyter Notebook using pandas, scipy.stats and matplotlib with intention to convert it somehow to pdf later on, so I can have report without code. After hour or two I realized it might not be the best idea. I even had problem with making good description of categorical data, since pandas describe() had limited functionality on this type of data.
Could you suggest me some tools that would be best in this case? I want to prepare aesthetic, informative report. It's my first time doing data analysis including preparing report.
Your report doesn't require code, as you said. So why not just type up your report on Word and include the relevant tables and plots? You can produce plots on python using matplotlib (seaborn for aesthetic plots). And as for the statistics, you do not only have to use what pandas offers. Depending on the kind of data, for example, you can use scipy and apply those functions on columns of your dataframe to generate insights.
Also check out this data analysis and visualization software called Tableau. You can quickly create some beautiful and insightful plots using this; however, there is a learning curve.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Does anybody know if there's a way to make circos-style plots with matplotlib python package, or any other python library? They don't have to be as nice looking as the example.
As far as I know, there is no direct functionality for this. If I were to create this functionality, I would use polar plots as the starting point, then I would create a transformation to convert data positions along the circular axis to polar coordinates.
Yann's idea is great.And more, circos is developed by Perl with GD and other modules, and then output SVG (or png). Python can also do this if you want to create new wheel :)
As I know if you wanna circos style images (circular style) by matplotlib, you'd better write raw python code directly :
learn basic SVG grammar
use python to generate the basic layout
design your image elements
computing and transforming your data coordinates; you'd better think it in polar coordinates (I did the same things but without open source.)
output your elements.
If you like, join circos's google group to discuss: http://groups.google.com/group/circos-data-visualization
It seems that Biopython's module GenomeDiagram has similar functionality, although it is designed for plotting genomic data, but not any data, as in circos, and the output won't be that nice.
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 5 years ago.
Improve this question
I'm using Python to process CSV files filled with data that I want to run calculations on, and then graph. I'm looking for a library to use that I can send processed CSV information to, or a dict of some sort, and then choose different graphing styles with.
Does anyone have any recommendations?
I'm personally using matplotlib and am very happy with it.
Matplotlib and Gnuplot.py are popular choices. I've used both.
For client-side charts Open Flash Chart or Google Charts Tools.
I've been using matplotlib for about 3 years now to plot experimental data. Before I was using Excel and that was just a pain. I've been happy with matplotlib ever since. It's great and very powerful.
There is pychart or PyCha, both of which I have not used but have been considering myself.
It depends on the kind of graph you want,
most of the time, i'm using matplotlib but sometimespydot is good.
The various layout algorithms are good for me when dealing with huge graphs