How can I get a plot with errorbars in Pandas? - python

I have a set of data held in a dataframe, with another dataframe with the associated errors. I would want to plot this with seaborn, but I can't seem to find a way to do this. I can get a scatterplot, but not with errorbars.
I would want something like This
Which was produced with Matplotlib. Although if I can't plot the lines that is ok as well. I am able to get a basic scatterplot with the sns.scatterplot() method, but can't find any way to add the errorbars to it. Does anyone know how to do this in seaborn?
Thanks

Related

Bokeh line chart is plotting weird

I am trying to plot chart in my data science project. And I want to plot chart in this way
which is produced by Matplotlib library. And now I want to plot in the same way. But it gives me this way in bokeh.
My data for this in the form of python list and it is as below:
ages = [45.0,50.0,55.0,40.0,60.0,35.0,65.0,30.0,70.0,25.0,75.0,20.0,80.0,85.0,15.0,90.0,10.0,0.0]
ageCounter = [4466,4270,3824,3576,3240,2850,2527,2358,1968,1544,981,655,419,149,132,80,17,2]
Is there any thing I am missing.
Thanks in advance.
You need to sort the arrays together by age. Bokeh plots the points in the order you pass them in. The data above is out of order which explains the "zigzag".

Plotting individual colormap row with distinct colorbar and visualizing them

I am trying to create colorbar from matplotlib for each data row i.e. each datarow heatmap is defined by its individual colormap. The sample is as shown in this picture.
I tried to solve this problem by merging colormaps, but I can only merge the different colorbars into one.
I did googling for this kind of problem as well as read the documentation from matplotlib but could not find any reliable document for this kind of problem. Is there any procedure to solve this kind of problem. I am currently stuck in the middle of nowhere by this problem.

Multiple tick locators on single axis of a plot in matplotlib

I've done some searching around, and cannot easily find a solution this problem. Effectively, I want to have multiple tick locators on a single axis such that I can do something like in the plot below.
Note how the x-axis starts off logarithmic, but becomes linear once 500 is reached. I figured one possible solution was to simply divide the data into two portions, plot it on two graphs, each with their own locators, and then put the graphs right next to each other so they're seamless, but that seems very unpythonic. Anyone have a better solution?
I suspect the following URL might be of use:
http://matplotlib.org/examples/axes_grid/parasite_simple2.html (click on the plot to have the python code)
If you need some specialized graphs, it's always a good idea to have a look at the Matplotlib gallery:
http://matplotlib.org/gallery.html
EDIT: It is possible to make custom ticks on the X-axis:
http://matplotlib.org/examples/ticks_and_spines/ticklabels_demo_rotation.html
You may find an implementation of this scale by Jesús Torrado here.

How to return a histogram and a scatterplot using matplot lib?

I need to return both a histogram and a scatterplot in one function using matplotlib, but when I try to create the histogram after creating the scatterplot, it appears that the scatterplot gets overridden. Just wondering if anyone has any advice on this issue? Is there a way to return two plots at once if they share an x-axis?
For instance, there is paragraph included in this link http://matplotlib.org/users/pyplot_tutorial.html about how to have 2 subplots. But I'm not sure how to do that with plt.hist() and plt.plot().
Since the histogram fills the bars it is probably better to do it first then the scatter plot.

Plotting graphs with error ribbons in python

for a while I've been trying to come up with a good way to graphically represent a data series along with its estimated error.
Recently I saw some graphs where the data was plotted as a line, with a background 'ribbon' filling the area between the lines plotting data +/- sigma.
Is there a name for this type of graph, and is there any python toolkit which has the capability to make such plots?
A simple way to fake it with matplotlib would also be useful - right now I'm just plotting three lines, but I don't know how to fill the area between them.
I would use the fill_between method. Look at the Our Favorite Recipes section of the manual for matplotlib for some good examples. They have one that looks like this:
and another that looks like this:

Categories