Knitting patterns categories

August 20, 2015
By

(This article was first published on R – datasock, and kindly contributed to R-bloggers)

Let’s have a look at the repartition of Ravelry patterns among the various categories. The categories have a tree structure. The number of patterns in each category is not accessible via the API, but it is visible on the website main page.

The code below is not the most exciting, but it is a more accurate reflection of the breakdown of knitting patterns in August 2015 than what could be estimated from an API call on the database. I took into account only the patterns that have at least one picture, to avoid potential bad entries (duplicates, drafts …). Some of the categories are aggregated to keep the tree plot simple; the entries named “All Item” are aggregated and actually contain subcategories.

pattern_nbr_tree <- list("Clothing"=list( "Coat/Jacket"=10707,
                                          "Dress"=5232,
                                          "Intimate Apparel"=list("Bra"=35,
                                                                 "Pasties"=10,
                                                                 "Underwear"=152,
                                                                 "Other"=69),
                                          "Leggings"=332,
                                          "Onesies"=905,
                                          "Pants"=1107,
                                          "Robe"=104,
                                          "Shorts"=330,
                                          "Shrug/Bolero"=3939,
                                          "Skirt"=1660,
                                          "Sleepwear"=354,
                                          "Soakers"=470,
                                          "Sweater"=list("Cardigan"=31580,
                                                         "Pullover"=41795,
                                                         "Other"=1088),
                                          "Swimwear"=135,
                                          "Tops"=list("Sleeveles Top"=7195,
                                                      "Strapless Top"=130,
                                                      "Tee"=3604,
                                                      "Other"=550),
                                          "Vest"=9256,
                                          "Other"=767),
                          "Accesories"=list("All Bag"=8883,
                                            "Belt"=271,
                                            "Feet/Legs"=list("Booties"=3501,
                                                             "Legwarmers"=1801,
                                                             "Slippers"=2188,
                                                             "All Socks"=23631,
                                                             "Spats"=89,
                                                             "Other"=540),
                                            "All Hands"=23733,
                                            "All Hat"=45386,
                                            "All Jewelry"=1642,
                                            "Neck/Torso"=list("Bib"=364,
                                                              "Cape"=1591,
                                                              "Collar"=921,
                                                              "Cowl"=17798,
                                                              "Necktie"=362,
                                                              "Poncho"=2604,
                                                              "Scarf"=26600,
                                                              "Shawl/Wrap"=26210,
                                                              "Other"=691),
                                            "All Other Headwear"=3989,
                                            "Other"=1277),
                          "All Home"=36478,
                          "All Toys and Hobbies"=21023,
                          "All Pet"=1551,
                          "All Components"=7073)

This plot shows the number of patterns in each category as the area of the corresponding rectangle.

pattern_nbr_tree <- melt(pattern_nbr_tree)
names(pattern_nbr_tree) <- c("patterns_count","cat3","cat2","cat1")

custom_palette <- c("#FAF0E6","#7FFFD4","#008080","#FF6347","#FA8072","#B0C4DE")
treemap(pattern_nbr_tree,index=c("cat1","cat2","cat3"),vSize="patterns_count",
title="Number of knitting patterns per category",palette=custom_palette,border.col="White",border.lwds=c(6,3,0.5),
        bg.labels=0,fontsize.labels=c(14,13,11),
        align.labels=list(c("left","top"),c("center","center"),c("center","center")))
Number of patterns in each category.

Number of patterns in each category (click to enlarge).

Accessories dominate, probably because they represent a smaller time commitment than clothing items, and there are fewer risks on the fit!

To leave a comment for the author, please follow the link and comment on their blog: R – datasock.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)