{"id":1452,"date":"2022-05-03T13:43:57","date_gmt":"2022-05-03T20:43:57","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1452"},"modified":"2022-05-29T01:40:07","modified_gmt":"2022-05-29T08:40:07","slug":"210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2-3-2-2-2-2","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2022\/05\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-2-2-2-2-2-2-2-2-2-3-2-2-2-2\/","title":{"rendered":"#280 TSA data plot using R"},"content":{"rendered":"<p>Number of passengers at USA Airport TSA checkpoints for 2019, 2020, 2021 and 2022<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\ninstall.packages('xml2')\r\ninstall.packages('rvest')\r\ninstall.packages('tidyverse')\r\ninstall.packages('janitor')\r\n#install.packages('themeani')\r\n#install.packages(&quot;ggplot2&quot;)\r\n#install.packages(&quot;magrittr&quot;)\r\n#install.packages(&quot;dplyr&quot;) \r\nlibrary('xml2')\r\nlibrary(rvest)\r\nlibrary(tidyverse)\r\nlibrary(ggplot2)\r\nlibrary(dplyr)\r\nlibrary('xml2')\r\nlibrary(rvest)\r\nlibrary(tidyverse)\r\n\r\n#read_html(&quot;https:\/\/www.tsa.gov\/coronavirus\/passenger-throughput?page=0&quot;) -&gt; myurl\r\n#html_table(myurl, header = TRUE, fill = TRUE) -&gt; tsa\r\n\r\n#working directory\r\nsetwd(&quot;D:\/projects\/wordpress\/ex280_tsa&quot;)\r\n\r\ntsa &lt;- read.table(&quot;data_tsa.txt&quot;, header = TRUE, sep = &quot;\\t&quot;)\r\n\r\ntsa %&gt;%\r\njanitor::clean_names() %&gt;%\r\nrename(\r\n\tdata_2019 = c2019,\r\n\tdata_2020 = c2020,\r\n\tdata_2021 = c2021,\r\n\tdata_2022 = c2022\r\n) -&gt; tsa2\r\n\r\n\r\npng(file=&quot;tsa_2022_05.png&quot;,width=600, height=600)\r\n\r\nggplot(tsa2) +\r\ngeom_line(aes(x = date, y = data_2019,colour = &quot;2019&quot;)) +\r\ngeom_point(aes(x = date, y = data_2019,colour = &quot;2019&quot;)) +\r\ngeom_smooth(aes(x = date, y = data_2019,,colour = &quot;2019&quot;),span = 0.3) +\r\n#\r\ngeom_line(aes(x = date, y = data_2020,colour = &quot;2020&quot;))+\r\ngeom_point(aes(x = date, y = data_2020,colour = &quot;2020&quot;)) +\r\ngeom_smooth(aes(x = date, y = data_2020,colour = &quot;2020&quot;),span = 0.3) +\r\n#\r\ngeom_line(aes(x = date, y = data_2021,colour = &quot;2021&quot;)) +\r\ngeom_point(aes(x = date, y = data_2021,colour = &quot;2021&quot;)) +\r\ngeom_smooth(aes(x = date, y = data_2021,colour = &quot;2021&quot;),span = 0.3) +\r\n#\r\ngeom_line(aes(x = date, y = data_2022,colour = &quot;2022&quot;)) +\r\ngeom_point(aes(x = date, y = data_2022,colour = &quot;2022&quot;)) +\r\ngeom_smooth(aes(x = date, y = data_2022,colour = &quot;2022&quot;),span = 0.6) +\r\n#\r\nscale_x_continuous(breaks = seq(0, 365, by = 14)) +\r\nscale_y_continuous(labels = scales::&quot;comma&quot;) +\r\nscale_colour_manual(name = &quot;Years&quot;, \r\n                      breaks = c(&quot;2019&quot;,&quot;2020&quot;,&quot;2021&quot;,&quot;2022&quot;),\r\n                      values = c(&quot;darkgreen&quot;,&quot;red&quot;,&quot;blue&quot;,&quot;darkblue&quot;)) +\r\ntheme(legend.position = c(0.8, 0.1)) +\r\nlabs(x = &quot;Day #&quot;,y = &quot;Number of Passengers&quot;,title = &quot;Number of passengers\r\nat USA Airport TSA checkpoints for 2019, 2020, 2021 and 2022&quot;)\r\ndev.off()\r\n<\/pre>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/05\/tsa_2022_05-1.png?resize=600%2C600&#038;ssl=1\" alt=\"\" width=\"600\" height=\"600\" class=\"alignnone size-full wp-image-1455\" srcset=\"https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/05\/tsa_2022_05-1.png 600w, https:\/\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/05\/tsa_2022_05-1-480x480.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 600px, 100vw\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Number of passengers at USA Airport TSA checkpoints for 2019, 2020, 2021 and 2022 install.packages(&#8216;xml2&#8217;) install.packages(&#8216;rvest&#8217;) install.packages(&#8216;tidyverse&#8217;) install.packages(&#8216;janitor&#8217;) #install.packages(&#8216;themeani&#8217;) #install.packages(&quot;ggplot2&quot;) #install.packages(&quot;magrittr&quot;) #install.packages(&quot;dplyr&quot;) library(&#8216;xml2&#8217;) library(rvest) library(tidyverse) library(ggplot2) library(dplyr) library(&#8216;xml2&#8217;) library(rvest) library(tidyverse) #read_html(&quot;https:\/\/www.tsa.gov\/coronavirus\/passenger-throughput?page=0&quot;) -&gt; myurl #html_table(myurl, header = TRUE, fill = TRUE) -&gt; tsa #working directory setwd(&quot;D:\/projects\/wordpress\/ex280_tsa&quot;) tsa &lt;- read.table(&quot;data_tsa.txt&quot;, header = TRUE, sep = &quot;\\t&quot;) tsa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1452","post","type-post","status-publish","format-standard","hentry","category-r"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-nq","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":579,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/06\/84\/","url_meta":{"origin":1452,"position":0},"title":"#84 Volcano plot for gene expression using R","author":"gantovnik","date":"2020-06-15","format":false,"excerpt":"[code language=\"python\"] library(\"readxl\") library(\"ggplot2\") #Best plots library(\"ggrepel\") #Avoid overlapping labels library(\"dplyr\") #set working directory where all files are located getwd() setwd(\"D:\\\\projects\\\\ex89\") getwd() df <- read_excel(\"data.xlsx\") i=3 k_array = c(2,4,6) label_array = c(\"DC\",\"SC\",\"PC\") k <- k_array[i] label <- label_array[i] df = df[c(1,k,k+1)] colnames(df) <- c(\"gene\",\"log_fc\",\"pvalue\") df <- df[- grep(\"NA\", df$gene),] #\u2026","rel":"","context":"In &quot;bioinformatics&quot;","block_context":{"text":"bioinformatics","link":"https:\/\/gantovnik.com\/bio-tips\/category\/bioinformatics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/Volcanoplot_DC.jpeg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/Volcanoplot_DC.jpeg?resize=350%2C200 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/Volcanoplot_DC.jpeg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/Volcanoplot_DC.jpeg?resize=700%2C400 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/Volcanoplot_DC.jpeg?resize=1050%2C600 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/06\/Volcanoplot_DC.jpeg?resize=1400%2C800 4x"},"classes":[]},{"id":1912,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/372-tsa-data-number-of-passengers-at-usa-airport-checkpoints\/","url_meta":{"origin":1452,"position":1},"title":"#372 TSA data: Number of passengers at USA airport checkpoints","author":"gantovnik","date":"2023-08-09","format":false,"excerpt":"Good news for the aerospace industry because the number of passengers passing through TSA checkpoints this year is the same as in 2019 (before COVID-19). [code language=\"python\"] import pandas as pd import numpy as np import math import matplotlib.pyplot as plt from plotnine import ggplot, geom_point, aes, stat_smooth, facet_wrap,geom_smooth,labs, scale_x_continuous,geom_line\u2026","rel":"","context":"In &quot;aerospace&quot;","block_context":{"text":"aerospace","link":"https:\/\/gantovnik.com\/bio-tips\/category\/aerospace\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/tsa_2023_08.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/tsa_2023_08.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/tsa_2023_08.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/tsa_2023_08.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/tsa_2023_08.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/tsa_2023_08.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":654,"url":"https:\/\/gantovnik.com\/bio-tips\/2020\/09\/107-tsa-data-2020-vs-2019\/","url_meta":{"origin":1452,"position":2},"title":"#107: TSA Data 2020 vs 2019","author":"gantovnik","date":"2020-09-28","format":false,"excerpt":"#107: TSA Data 2020 vs 2019 The TSA has started to publish the daily volume of passengers going through checkpoints on its website. The data set also includes the numbers from 2019 in order to measure the impact of travel as a result of COVID-19. https:\/\/www.tsa.gov\/coronavirus\/passenger-throughput [code language=\"python\"] from bs4\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/09\/ex107.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/09\/ex107.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/09\/ex107.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/09\/ex107.png?resize=700%2C400 2x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/09\/ex107.png?resize=1050%2C600 3x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2020\/09\/ex107.png?resize=1400%2C800 4x"},"classes":[]},{"id":1929,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/379-joint-and-marginal-histograms-using-seaborn-library\/","url_meta":{"origin":1452,"position":3},"title":"#379 Joint and marginal histograms using seaborn library","author":"gantovnik","date":"2023-08-10","format":false,"excerpt":"[code language=\"python\"] #Joint and marginal histograms using seaborn library import matplotlib.pyplot as plt #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"ticks\") def main(): # Load the planets dataset and initialize the figure planets = sns.load_dataset(\"planets\") g = sns.JointGrid(data=planets, x=\"year\", y=\"distance\", marginal_ticks=True) # Set a log scaling on the\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex379.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex379.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex379.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1921,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/376-scatterplot-with-continuous-hues-and-sizes-using-seaborn-library\/","url_meta":{"origin":1452,"position":4},"title":"#376 Scatterplot with continuous hues and sizes using seaborn library","author":"gantovnik","date":"2023-08-10","format":false,"excerpt":"[code language=\"python\"] #Scatterplot with continuous hues and sizes import matplotlib.pyplot as plt #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"whitegrid\") def main(): # Load the example planets dataset planets = sns.load_dataset(\"planets\") cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True) g = sns.relplot( data=planets, x=\"distance\", y=\"orbital_period\", hue=\"year\", size=\"mass\", palette=cmap, sizes=(10, 200), ) g.set(xscale=\"log\",\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex376.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex376.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex376.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1938,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/08\/383-horizontal-bar-plot-using-seaborn-library\/","url_meta":{"origin":1452,"position":5},"title":"#383 Horizontal bar plot using seaborn library","author":"gantovnik","date":"2023-08-11","format":false,"excerpt":"[code language=\"python\"] #Horizontal bar plot using seaborn library import matplotlib.pyplot as plt #conda install -c anaconda seaborn import seaborn as sns sns.set_theme(style=\"whitegrid\") def main(): # Initialize the matplotlib figure f, ax = plt.subplots(figsize=(6, 15)) # Load the example car crash dataset crashes = sns.load_dataset(\"car_crashes\").sort_values(\"total\", ascending=False) # Plot the total crashes\u2026","rel":"","context":"In &quot;plot&quot;","block_context":{"text":"plot","link":"https:\/\/gantovnik.com\/bio-tips\/category\/plot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex383.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex383.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/08\/ex383.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1452"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1452\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}