Posts

Showing posts with the label matplotlib

Making boxplot with custom statistical values for the boxes

Image
We will see here how to draw boxplots, using Matplotlib, when we have a set of values that represent the box statistics, such as median, mean, minimum, maximum, first quartile, and third quartile. In some case we may also have confidence interval of the median values. We will use the .bxp attribute of the plot axes in pyplot.subplots . We begin first by importing the necessary packages to draw the boxplots, namely, NumPy and Matplotlib . import numpy as np import matplotlib.pyplot as plt The data Let’s take an example of a data. Show in the table below is the data which can be read from a excel or csv file into a pandas dataframe ( df ). df label whislo q1 med mean q3 whishi cilo cihi 0 A 8 26 56 49 96 116 54 62 1 B 7 21 53 45 96 122 51 59 2 C 10 22 57 54 101 120 55 63 3 D 9 26 54 50 98 116 52 60 Convert data into list of dictionaries For making the plot...

How to plot product concentrations in different strains using python?

Image
The most common type of graphs that we, as experimental biologists make, are bar graphs. When we want to compare: - the amount of a product secreted by different conditions or cells - The enzyme activity in different conditions or cells or similar cases when we want to compare the value of an observation at different conditions we typically plot a bar graph. Also, with replicates of experiments we plot the mean and standard deviations of the experiment. Excel is perhaps the quickest way to draw a single such graph but in case you want to make similar graphs for several observation or plot two or more such graphs in one figure as subplots, using python may be a better choice unless we want to spend time in adjusting ech graph into a powerpoint slide of in inkscape to make a collage. Here we will see how to plot these kind of graphs using python. We will use numpy , pandas and matplotlib packages to do this. We will take an example of observations depicting the concentration (g/l) ...

Plotting growth curve using python

Image
Data plotting can be easily done in excel. Excel is a very easy and efficient tool for calculations and plotting of biological data and most people including me prefer it. With excel one has to plot the data and do all customization each and every time for a new data set. Therefore, when it comes to plotting multiple datasets of similar nature over and over again, using a programming language is more efficient. Once a template code for a plot is ready, one can plot any number of data sets with it in a few seconds. Here we will see how to plot a simple scatter plot by taking an example of growth profile (i.e. data of time vs O.D.) of a cell culture. The reading are from three experiments. The O.D.s were taken from 0 to 6 hours at an interval of one hour.