Here a R solution with a Wilcoxon test and a figure example:
# library
library(tidyverse)
library(ggpubr)
# get data
sample= c(1:30)
M1=c(3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,2,2)
M2=c(3,2,3,3,2,2,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,2,2)
data.frame(sample,M1,M2) -> df
# calculate wilcox test
wilcox.test(df$M1,df$M2)
#> Wilcoxon rank sum test with continuity correction
#>
#> data: df$M1 and df$M2
#> W = 360, p-value = 0.09554
#> alternative hypothesis: true location shift is not equal to 0
# prepare data for figure
df %>%
gather(key="key",value="value",-sample) -> df
# make figure
my_comparisons <- list( c("M1", "M2"))
ggboxplot(df, x = "key", y = "value",
color = "key", palette = "jco")+
stat_compare_means(comparisons = my_comparisons) # Add pairwise comparisons p-value
[![figure][1]][1]
[1]: https://i.sstatic.net/htsGg.png