figureflow.figure_panel.FigurePanel.show_data

figureflow.figure_panel.FigurePanel.show_data = <function FigurePanel.show_data>

Plot data of file for panel. All column names (e.g. x, x_order, x_labels, hue, etc. ) must be strings, independent of which type they are in the dataframe. Statistics will be performed automatically and annotated by statannot. For parameters that can be set additionally, see statannot package “add_stat_annotation” function.

Parameters:
  • x – Column name of data to be used for x axis

  • y – Column name or list of column names of data to be used for y axis. Multiple y values will be plotted as several rows.

  • x_labels – list of tuples to change values in x column, first value in tuple is original name and second value is what the name should be replaced by (e.g. [(“2”, “No axon”), (“3”, “With axon”)] to replace “2” and “3” with the respective text). Alternatively each tuple can contain a standard text in which the placeholder __$$__ will be replaced by the column value. (e.g. [[“Rate value = __$$__”]] would mean that each column value is replaced by the defined string with __$$__ replaced by the column value.

  • hue – column name of data to be used for hue

  • hue_labels – list of tuples to change values in hue column. See description of x_labels for details.

  • col – column name of data used for plots in different columns (generating a row of plots)

  • col_labels – list of tuples to change values in col column. See description of x_labels for details.

  • row – column of data used for plots in different rows (generating a columns of plots)

  • ratio – Column for which to calculate ratio of rows with defined ratio_pair values. If a function other than a simple ratio should be calculated, use the ratio_func argument.

  • row_labels – list of tuples to change values in row column. See description of x_labels for details.

  • x_order – list of x values after applying the changes of x_labels, if order_vals_before_changing_vals is False. If order_vals_before_changing_vals is True, x values should be the original values before applying the changes of x_labels. Determines the order of x values. Each value has to contain a unique part only present in one column value and not part of multiple different column values and does not need to contain the entire column value. Alternatively, can be a function that takes all unique values of the column and returns an iterable of strings of the unique values that defines the order. Can also be the string “ascending” or “descending” to sort values ascendingly or descendingly, respectively.

  • col_order – list of col values after applying the changes of col_labels, if order_vals_before_changing_vals is False. If order_vals_before_changing_vals is True, col values should be the original values before applying the changes of col_labels. Determines the order of col values. Can also be a nested list in which case, the columns will be split in one row per nested list (e.g. [[1,2,3],[2,3,4],[5,6,7]], will be split into three rows, the first with the col values 1, 2 and 3. In that case, the values in the order must be the values before changes through col_labels are applied. Each row must have the same number of columns to allow the same size for each plot, otherwise plots in the row with fewer elements will be wider. For more details see “x_order”.

  • hue_order – list of hue values after applying the changes of hue_labels, if order_vals_before_changing_vals is False. If order_vals_before_changing_vals is True, hue values should be the original values before applying the changes of hue_labels. Determines the order of hue values. For more details see “x_order”.

  • row_order – list of row values after applying the changes of row_labels, if order_vals_before_changing_vals is False. If order_vals_before_changing_vals is True, row values should be the original values before applying the changes of row_labels. Determines the order of row values. For more details see “x_order”.

  • ratio_pairs – List with pairs of values in the ratio column that should be used to calculate the ratio (or, if defined, used as input to the ratio_func. The first value in each pair is the first input to the ratio_func or the numerator in the ratio, while the second value in each pair is the second input to the ratio_func or the denominator in the ratio.

  • ratio_func – Function that receives two inputs, the first and second are the data (pandas.Series objects) from the first and second value of each ratio pair in the ratio column, respectively. Allows calculating arbitrary computations of data.

  • y_operation_cols – Columns which should be supplied to y_operation_func to calculate a new y value. The original set y value will not be used, instead the newly calculated values will be used for y.

  • y_operation_func – Function to which the y_operation_cols will be supplied. It should have as many arguments as there are columns in y_operation_cols defined. The original set y value will not be used, instead the newly calculated values will be used for y.

  • order_vals_before_changing_vals – Whether the _order parameters (e.g. x_order, hue_order, etc) include values before changing values with the _labels parameters or not. Default to allow compatibility with previous scripts is False (use values after replacing with _labels). This will be done automatically for col_order though when using nested lists for col_order to plot cols in different rows.

  • inclusion_criteria – list of Dictionaries with columns as key and list of values or one value that the column should match, since value all matches from each dictionary will be concatanated. If no matches are found (ValueError ‘The inclusion criteria […] did not match with any data’) but you expected matches and the matched values are numbers, try to use float numbers instead of int (e.g. 9.0 instead of 9, or 200529.0 instead of 200529). Columns might be converted from int to float if NaN values (e.g. empty cells) are found. This type conversion can also happen if some rows in excel are not complete deleted (some column values are left) or a single cell accidentally was added below the rows - this would be visible as rows added in the csv file which are mostly empty. BE CAREFUL NOT TO INTRODUCE DUPLICATES LIKE THIS!

  • show_legend – Whether to show legend of plot for different values in hue column (will not be shown if there is only one hue value)

  • round_columns – List of columns for which values should be rounded. Can also choose column for ‘x’/’hue’/’y’/’col’/’row’ parameter directly, by flanking the respective name of the parameter with a double underscore - e.g. __x__.

  • round_digits – How many digits to round round_columns to. Will only be used if no digits were specified for each round_columns.

  • pair_unit_columns – list of columns that uniquely identify one set of dependent datapoints (needed to connect paired datapoints and also needed as preprocessing to allow statistics tests for paired data)

  • remove_outliers – Whether outliers should be removed from data

  • nb_stds_outliers – Number of stds that outliers need to differ at least from the mean to be excluded (if remove_outliers = True)

  • scale_columns – Dictionary for scaling values, with key as column name and value the factor by which values are scaled (e.g. for changing the unit of the y column)

  • norm_y_cats – list of categories / data columns from which the groups will be build (groupby object) within which it should be normalized (e.g. to normalize values within neurites) can be “hue” or “col” or “x” and will then take the column names that were used for these variables as arguments to the “show_data” function can also be any other column name directly

  • normalize_y_by – value form the group by which the group will be normalized; any function name that can be performed on a series works

  • norm_x_cats – See norm_y_cats, but will be applied to x column

  • normalize_x_by – See normalize_y_by, but will be applied to x column

  • smoothing_rad – Radius for smoothing y values

  • average_columns – List of column names; create new data frame where data will be averages for data rows with same values in average_columns can be used e.g. to average all values of the same neuron

  • normalize – Whether to normalize y values

  • baseline – value that will be subtracted from all y-values before normalization, smoothing etc. helpful e.g. for background subtraction of data from images

  • columns_same_in_groups – list of column names; exclude data with column values not present in all groups - allows to define for different plot groups (by hue, col and x) to only include rows with values in the defined columns that are present in all groups

  • renaming_dicts – list of dicts, IMPORTANT: renaming is done after replacing strings through _labels (e.g. x_labels, hue_labels) parameters each dict is for one renaming one key in the dict has to be “__from__” and the value determines what should be changed one key in the dict has to be “__to__” and the value determines the value it should be changed to one key in the dict has to be “__target_column__” and the value determines in which column the change should occur the other keys are column names and the corresponding values determine the value the column must have for checking for matches, values must be lists otherwise, it is assumed that it is a query and will be executed as pandas dataframe query string

  • nan_fill_val – Value that should be used to fill up NaN values in DataFrame. A numeric value is recommended to prevent type conversion problems for columns that are numeric. NaN values in the y column/s will not be replaced.

  • col_labels_every_row – Bool; whether column labels above should be shown in every row of the facet plot only matters if row is not None

  • sub_padding_y_factor – multiple of figure_panel padding for plots from multiple y values

  • show_y_label_in_all_rows – Whether to show y axis label in all rows (even though they all show the same y axis)

  • normalize_after_data_exclusion – Boolean; whether data should be normalized after data exclusion normalization should usually be done before exclusion of data otherwise excluded units would change normalization depending on what is shown

  • video_frame – Int; for animating data in a video; indicates the current frame of the video and thereby the current maximum x value that should be plotted

  • use_same_y_ranges – Use the same y ranges for all plots. Will use the range from the lowest y value in all groups to the highest y value in all groups

  • increase_padding_above – Whether to increase padding above plots can sometimes be useful to improve layout

  • digits_round_all_columns – Number of digits all columns for excluding data should be rounded to. Prevents floating point imprecisions that lead to mismatching during excluding data.

  • for_measuring – INTERNAL PARAMETER, used when plots are plotted to measure dimensions for perfect alignment, while the plot is removed afterwards again

  • kwargs – Keyword arguments for plotting data and adding annotations, passed to function statannot.plot_and_add_stat_annotation.