Plotting¶
- biorpy.plotting.barPlot(dict_, keysInOrder=None, printCounts=True, ylim=None, *args, **kwdargs)[source]¶
Plot a bar plot
Parameters: - dict – a dictionary of name -> value, where value is the height of the bar use a collections.OrderedDict() to easily convey the order of the groups
- keysInOrder – an optional ordering of the keys in dict_ (alternate option to using collections.OrderedDict)
- printCounts – option to print the counts on top of each bar
additional kwdargs are passed directly to r.barplot()
- biorpy.plotting.boxPlot(dict_, keysInOrder=None, **kwdargs)[source]¶
Plot a boxplot
- dict_: a dictionary of group_name -> vector, where vector is the data points to be plotted for each group;
- use a collections.OrderedDict() to easily convey the order of the groups
keysInOrder: an optional ordering of the keys in dict_ (alternate option to using collections.OrderedDict)
additional kwdargs are passed directly to r.boxplot()
- biorpy.plotting.ecdf(vectors, labels, colors=['red', 'blue', 'orange', 'violet', 'green', 'brown'], xlab='', ylab='cumulative fraction', main='', legendWhere='topleft', lty=1, lwd=1, **ecdfKwdArgs)[source]¶
Take a list of lists, convert them to vectors, and plots them sequentially on a CDF
- biorpy.plotting.errbars(x=None, y=None, x_lower=None, x_upper=None, y_lower=None, y_upper=None, length=0.08, *args, **kwdargs)[source]¶
Draws error bars on top of an existing plot
specify EITHER: (y, x_lower and x_upper) OR (x, y_lower, y_upper) y: the y coordinate of each data point x_lower: the left coordinate of the error bar x_upper: the right coordinate of the error bar
similarly for x, y_lower and y_upper uses the r.arrows() command, and passes any additional keyword args to r.arrows()
- biorpy.plotting.plotMulti(xs, ys, names, colors=None, legendWhere='bottomright', xlab='', ylab='', plotArgs=None, lineArgs=None, **kwdargs)[source]¶
Plot multiple lines on the same axes; convenience function for calling r.plot() and then r.lines() (possibly multiple times) and adding an r.legend()
Parameters: - xs – a list of vectors of x values, one vector for each dataset to be plotted
- ys – a list of vectors of y values, as above, in the same order
- names – the names of each dataset, used for putting together the legend
- colors – an optional list of colors (html hex style)
- legendWhere – the location parameter used to specify positioning of the legend (a combination of bottom/top and right/left)
- plotArgs – an optional dictionary of arguments to r.plot(), for example xlim=[0,3]
- lineArgs – an option dictionary of arguments to r.lines()
- kwdArgs – optional R plotting arguments can be passed in as keyword arguments [ie, plotMulti(xs, ys, names, lty=3)] to specify parameters for both the r.plot() and r.lines() commands
- biorpy.plotting.plotWithCor(x, y, method='spearman', main='', **kwdargs)[source]¶
Adds the correlation coefficient to the title of a scatterplot