8-dotplot

Author

math4mads

简介

用于单一属性的频数统计

1. load package

Code
using TidierPlots,RCall
using DataFrames,Random
Random.seed!(121212)
TaskLocalRNG()

2. make data

Code
raw=rand(1:20,100)
df=DataFrame(x=raw)
show(df)
100×1 DataFrame
 Row │ x     
     │ Int64 
─────┼───────
   1 │    19
   2 │     2
   3 │    15
   4 │    16
   5 │    16
   6 │    18
   7 │    15
   8 │    13
   9 │    12
  10 │     2
  11 │    20
  ⋮  │   ⋮
  91 │     3
  92 │    12
  93 │     8
  94 │    16
  95 │     3
  96 │     3
  97 │     8
  98 │    14
  99 │    14
 100 │    12
79 rows omitted

3. plot

Code
    @rput df
    R"""
    library(ggplot2)
   ggplot(df, aes(x = x)) + 
  geom_dotplot(dotsize = .75, stackratio = 1.2, 
               fill = "steelblue") + 
  scale_y_continuous(NULL, breaks = NULL) + 
  labs(title = "Stacked Dot Plot", x = "Data Values") +
  theme_minimal()
    """
┌ Warning: RCall.jl: Bin width defaults to 1/30 of the range of the data. Pick better value with
│ `binwidth`.
└ @ RCall ~/.julia/packages/RCall/gOwEW/src/io.jl:172

RObject{VecSxp}