jade.basic.plotting package¶
jade.basic.plotting.MakeFigure module¶
-
class
jade.basic.plotting.MakeFigure.
MakeFigure
(rows=1, columns=1, share_x=True, share_y=True)[source]¶ Deprecated. NOW - GO Checkout SEABORN instead of this class! Essentially, this is an interface to a facet grid. Seaborn does this awesomely.
My take on a plotting interface. Because I think matplotlib’s interface sucks.
I wrote this before I knew of pandas.
- You need to know the number of plots ahead of time by passing the grid.
1x1 will make one plot. 2x2 will make a grid of 4 plots. 1x3 is 3 columns of grids horizontally 3x1 is a list of figures.
share_x and share_y tell the full sublplot to share the axis.
-
fill_subplot
(title, labels, x_axis_label=None, y_axis_label=None, index=None, grid=None, add_legend=False, linestyle='--', marker='^', colors=None)[source]¶ This will add data to a particular subplot/plot.
: title: : labels: : x_axis_label: : y_axis_label: : specify_index: : add_legend: : linestyle: : marker: : colors: :return:
-
jade.basic.plotting.MakeFigure.
pad_single_title
(ax, x=0.5, y=1.05)[source]¶ Move the Title up in reference to the plot, essentially adding padding. SINGLE AXES :param ax:Axes :param x: :param y: :return:
-
jade.basic.plotting.MakeFigure.
plot_general_pandas
(df, title, outpath, plot_type, x, y=None, z=None, top_p=0.95, reverse=True)[source]¶ Plot anything in pandas. Make it look descent. Save the figure.
- If you are doing this multiple times in a Notebook:
- Don’t forget to call (matplotlib.pyplot)
- plot.show() plot.close()
Parameters: - df – pandas.DataFrame
- title – str
- outpath – str
- plot_type – str
- x – str
- y – str
- z – str
- top_p – float
- reverse – bool
Return type: matplotlib.Axes
-
jade.basic.plotting.MakeFigure.
plot_x_vs_y_sea_with_regression
(df, title, outpath, x, y, top_p=0.95, reverse=True)[source]¶ Plot X vs Y using a Pandas Dataframe and Seaborn, with regression line., save the figure, and return the Axes.
- If you are doing this multiple times in a Notebook:
- Don’t forget to call (matplotlib.pyplot)
- plot.show() plot.close()
Parameters: - df – pandas.DataFrame
- title – str
- outpath – str
- x – str
- y – str
- top_p – float
- reverse – bool
Return type: matplotlib.Axes
jade.basic.plotting.correlations module¶
-
jade.basic.plotting.correlations.
annotate_r_value
(data, x, y, ax, func=<function pearsonr>, template=None, stat=None, loc='best')[source]¶ Forked from seaborn JointPlot for use with regplot, scatter, etc. Woot. Needs to actually go into Seaborn Now!
Annotate the plot with a statistic about the relationship.
data: pandas.DataFrame x: str y: str ax: matplotlib.Axes
- func : callable
- Statistical function that maps the x, y vectors either to (val, p) or to val.
- template : string format template, optional
- The template must have the format keys “stat” and “val”; if func returns a p value, it should also have the key “p”.
- stat : string, optional
- Name to use for the statistic in the annotation, by default it uses the name of func.
- loc : string or int, optional
- Matplotlib legend location code; used to place the annotation.
jade.basic.plotting.error_bars module¶
-
jade.basic.plotting.error_bars.
calculate_set_errorbars_hist
(ax, data, x, y, binomial_distro=True, total_column='total_entries', y_freq_column=None, x_order=None, hue_order=None, hue=None, caps=True, color='k', linewidth=0.75, base_columnwidth=0.8, full=True)[source]¶ Calculates the standard deviation of the data, sets erorr bars for a bar chart. Default base_columnwidth for seaborn plots is .8
Optionally give x_order and/or hue_order for the ordering of the columns. Make sure to pass this while plotting. Note:
If Hue is enabled, this base is divided by the number of hue_names for the final width used for plotting.Parameters: - ax – mpl.Axes
- data – pandas.DataFrame
- x – str
- y – str
- binomial_distro – bool
- total_column – str
- y_freq_column – str
- x_order – list
- hue_order – list
- hue – str
- caps – bool
- color – str
- linewidth – float
- base_columnwidth – float
- full – bool
Return type: None