/Viz_Others

Data viz for other scholars

Primary LanguageRGNU General Public License v3.0GPL-3.0

Electrophysiology data

Data peek Data looked like this

There were three groups. Electrophysiology parameter was measured every 30 seconds This data came from multiple slices from multiple animals

Typically this is the way many researchers plot Horrible plot

Weird graphing softwares add their horrible palettes with meshes and grids. With more than 4 groups the entire visualisation gets muddy 😩

Enter seaborn + matplotlib. Kickass

Code updated here

Things I learned from this dataviz

  1. Melting dataframes
  2. Color palette customisation
  3. Adding background fills

Boxplots plus Strip plots

This set was just an average, quick and dirty requirement

There were heaps of excel sheets and need of the hour was box+point plots across two groups

Graphs were not visually pleasing 😩 But the job was done!

Data peek

Data looked like this

Final plot

Code here

Things I learned from this dataviz

  1. My first box+strip plot
  2. I could bring a smile to the person who had only 1 hour left to do entire graphing
  3. learned how to pick data from multiple columns, generate plot, save and loop

Yet To Do

  1. Removing one label
  2. Color palette customisation (learned it later)
  3. Learn how to automate creating a large csv from multiple based on some logic

Batchmode Excel to PDF converter

There were ~100s of excel files which had to be converted to PDF

This was more of a challenge than utility hack

Things I learned

  1. Came across this opensource and free utility called wkhtmltopdf
  2. File converting was fun :happy:

To Do

  1. Styling of dataframe for a highlighted and aesthetic html
  2. Similar converters for .doc and .docx files

Mean + CI skirt for 12 groups data acquired throughout the day

Data peek

Data looked like this

Data had Groups column with 2 levels, Intervention with 2 levels, Recording time point 2 levels and Phase with 2 levels

As a combination there were 12 group combinations

Phase levels (Light and Dark were exclusive)

So, the idea was to represent Phase levels using color (Hours 0-12 with light color and 12-24 in dark color)

Phase colors

That leaves 6 groups to plot

Scatter plot

I will leave out some attempts to capture all groups in a single plot. Far from complete 😒

Two steps away

The color palette is not standing out in background. The CI skirts are swallowed 😒

Aesthetic but one group

Phase(Light and Dark are captured) but no group info 😒


Got back to this Viz. Created a gridplot using patchwork

Linetypes captures BL vs PE

Linecolor captures four groups - Group+Intervention

All_four


Got the plot to work after some brainstorming!

Patchwork to rescue to stitch four plots

Final Four

Detailed documentation provided in script plotsleep_fourcol.R


Distribution-KDE | Histogram | Point | Box dataviz

I was inspired by the plot from Anat Arzi's recent nature paper

Inspire

  • We had four groups
  • Reordered the x-axis sequence
  • Custom color palette
  • New tricks from Cederic Scherer's talk
  • ggtext based styling

Code is here

Final


Survey barplot with count label

Barplot

  • Count of participants from various countries

Code is here


Finding missing values | KDE | Robust correlations

Missing value 1

Missing value 2

Summary

Robust correlations

Robust Cor

KDE plots

KDE

Code is here

Visual scrollable table


One way repeated measure ANOVA | Viz | Stats onto figure | Color palette

One way Code is here


Adding label as text where lineplot ends

  • Adding geom_line from one dataset
  • Adding geom_point from another dataset Labels Code is here

Boxplot and dotplot for paired datasets

  • Connection lines colored based on slope
  • Annotations using greek letters and mean
  • Sample sizes per group added above x-axis
  • Custom coloring and styling Labelled line Code is here

Boxplot and dotplot with colored paired slope lines

  • A better version from above v1 Colored labels Code is here

Improvements

  • Keep the y axis title
  • Keep the y-axis scale same for both graphs on left and right
  • Noticed one bug which takes the first colour by default when all lines are having only one type of slope (TRUE or FALSE)
  • As a quick fix keep the first color which represents all slopes

Model comparisons of regression models and viz

Comparison chart

  • compare multiple models and how each predictor performs Radar plot
  • see R squared adjusted, BIC etc for comapring models

Empirical cumulative distribution plots

  • Neat viz showing values of 0.5 ECDF