René's URL Explorer Experiment


Title: A function to add a colored polygon to a plot for confidence intervals · Issue #2 · dapperstats/bbplot · GitHub

Open Graph Title: A function to add a colored polygon to a plot for confidence intervals · Issue #2 · dapperstats/bbplot

X Title: A function to add a colored polygon to a plot for confidence intervals · Issue #2 · dapperstats/bbplot

Description: The title says it all. The function, which I called ribbon() is a slight modification to polygon() with quality of life improvements to make it easier to add colored confidence intervals to a plot. Default values are taken for all polygo...

Open Graph Description: The title says it all. The function, which I called ribbon() is a slight modification to polygon() with quality of life improvements to make it easier to add colored confidence intervals to a plot....

X Description: The title says it all. The function, which I called ribbon() is a slight modification to polygon() with quality of life improvements to make it easier to add colored confidence intervals to a plot....

Opengraph URL: https://github.com/dapperstats/bbplot/issues/2

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"A function to add a colored polygon to a plot for confidence intervals","articleBody":"The title says it all. The function, which I called `ribbon()` is a slight modification to `polygon()` with quality of life improvements to make it easier to add colored confidence intervals to a plot. Default values are taken for all polygon arguments, except for border, which is set to NA. Additionally, an alpha argument has been added to accommodate partially transparent confidence intervals. Any of the input values can be overwritten within this function's call.\r\n\r\nA standard workflow would look something like this, which could not add in transparency. \r\n\r\n```R\r\ndata(cars)\r\n# fit model\r\nm1 \u003c- lm(\r\n  dist ~ speed,\r\n  data = cars\r\n)\r\n# make predictions\r\npreds \u003c- predict(\r\n  m1, \r\n  newdata = data.frame(speed = 10:25),\r\n  interval = \"confidence\"\r\n)\r\n# base plot\r\nblank(\r\n  xlim = c(10,25),\r\n  ylim = c(15,120),\r\n  xlab = \"Speed\",\r\n  ylab = \"Stopping distance\",\r\n  xaxt = \"s\",\r\n  yaxt = \"s\",\r\n  bty = \"l\",\r\n  las = 1\r\n)\r\npolygon(\r\n  x = c(10:25, rev(10:25)),\r\n  y = c(preds[,2], rev(preds[,3])),\r\n  col = \"purple\",\r\n  border = NA\r\n)\r\n```\r\n\r\nThe function I am suggesting would replace polygon and in this case would look like:\r\n```R\r\nribbon(\r\n  x=10:25,\r\n  y=preds[,c(\"lwr\",\"upr\")],\r\n  col = \"purple\",\r\n  alpha = 0.5\r\n)\r\n\r\n```\r\nIn this case x does not need to be reversed (i.e., `x = c(10:25, rev(10:25))`) and you can input a two-column data.frame or matrix into `y`.   Likewise, there is an `alpha` argument now which uses base R to set the alpha channel \u0026 make colors transparent if you want them to be. Code for this function is:\r\n\r\n```R\r\nribbon \u003c- function(x, y, density=NULL, angle=45, border=NA,\r\n                   col=NA, lty= par(\"lty\"),...,fillOddEven=FALSE,\r\n                   alpha = NULL\r\n  ){\r\n  # error checks\r\n  if(!any(is.na(col)) \u0026 length(col)\u003e1){\r\n    warning(\"Two values input to col. Only first element used.\")\r\n    col \u003c- col[1]\r\n  }\r\n  # check if y is a matrix\r\n  if(is.matrix(y)|is.data.frame(y)){\r\n    y \u003c- c(y[,1], rev(y[,2]))\r\n    # check if x is half the length of y\r\n    if(length(y)/length(x) == 2){\r\n      x \u003c- c(x, rev(x))\r\n    }\r\n  }\r\n  # evaluate color and alpha channel\r\n  if( is.na(col) ){\r\n    my_col \u003c- NA\r\n  } else { # otherwise go through color process\r\n    # \r\n    if(\r\n      length(grep(\"^#\", col)) == 1 \u0026 # if start with hash\r\n      nchar(col)\u003e7 # \u0026 alpha channel is present\r\n      ){\r\n        if(!is.null(alpha)){\r\n          warning(\"col already has alpha channel, ignoring alpha argument.\")\r\n          my_col \u003c- col\r\n        } else {\r\n          my_col \u003c- col\r\n        }\r\n      } else {\r\n      # get rgb\r\n      my_rgbs \u003c- col2rgb(col)\r\n      # set color\r\n      my_col \u003c- rgb(\r\n        my_rgbs[1],my_rgbs[2],my_rgbs[3],max = 255,alpha = 255 * alpha\r\n      )\r\n    } \r\n  }\r\n  polygon(\r\n    x = x, y = y, density = density, angle = angle,\r\n    border = border, col = my_col, lty = lty,\r\n    fillOddEven = fillOddEven, ...\r\n  )\r\n}\r\n```\r\n\r\nCode, documentation, and tests are written. Happy to submit a PR if you want to check it out!","author":{"url":"https://github.com/mfidino","@type":"Person","name":"mfidino"},"datePublished":"2021-09-02T19:57:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2/bbplot/issues/2"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:41471370-5d34-259f-bba5-19bbc26dcebe
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA01E:2B524B:2F468:419CD:69810380
html-safe-noncee18f7370c16213d5fd111774a2f52707562278b99776fab318430738e7182c1e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDFFOjJCNTI0QjoyRjQ2ODo0MTlDRDo2OTgxMDM4MCIsInZpc2l0b3JfaWQiOiI1MjQ5NDQ3MTE4NDM0Nzk2NDE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacfb6d113852278fd10cc3e7641de9b24d3a1419f539e9d2ec22f6820e76e3f2e4
hovercard-subject-tagissue:987107924
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/dapperstats/bbplot/2/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a581fecc79124d939f301537177a5e79244d24deb781abd86de25437f3fbc694/dapperstats/bbplot/issues/2
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a581fecc79124d939f301537177a5e79244d24deb781abd86de25437f3fbc694/dapperstats/bbplot/issues/2
og:image:altThe title says it all. The function, which I called ribbon() is a slight modification to polygon() with quality of life improvements to make it easier to add colored confidence intervals to a plot....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemfidino
hostnamegithub.com
expected-hostnamegithub.com
None39fe8101494cbb823c09b619b68c80cd4d05ab7279997038dbe06bb91608abe1
turbo-cache-controlno-preview
go-importgithub.com/dapperstats/bbplot git https://github.com/dapperstats/bbplot.git
octolytics-dimension-user_id41246652
octolytics-dimension-user_logindapperstats
octolytics-dimension-repository_id191252615
octolytics-dimension-repository_nwodapperstats/bbplot
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id191252615
octolytics-dimension-repository_network_root_nwodapperstats/bbplot
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released5b34a4e4898b066c629879feb4b184bc471d6a7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/dapperstats/bbplot/issues/2#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdapperstats%2Fbbplot%2Fissues%2F2
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdapperstats%2Fbbplot%2Fissues%2F2
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=dapperstats%2Fbbplot
Reloadhttps://patch-diff.githubusercontent.com/dapperstats/bbplot/issues/2
Reloadhttps://patch-diff.githubusercontent.com/dapperstats/bbplot/issues/2
Reloadhttps://patch-diff.githubusercontent.com/dapperstats/bbplot/issues/2
dapperstats https://patch-diff.githubusercontent.com/dapperstats
bbplothttps://patch-diff.githubusercontent.com/dapperstats/bbplot
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fdapperstats%2Fbbplot
Fork 1 https://patch-diff.githubusercontent.com/login?return_to=%2Fdapperstats%2Fbbplot
Star 2 https://patch-diff.githubusercontent.com/login?return_to=%2Fdapperstats%2Fbbplot
Code https://patch-diff.githubusercontent.com/dapperstats/bbplot
Issues 1 https://patch-diff.githubusercontent.com/dapperstats/bbplot/issues
Pull requests 0 https://patch-diff.githubusercontent.com/dapperstats/bbplot/pulls
Actions https://patch-diff.githubusercontent.com/dapperstats/bbplot/actions
Projects 0 https://patch-diff.githubusercontent.com/dapperstats/bbplot/projects
Security 0 https://patch-diff.githubusercontent.com/dapperstats/bbplot/security
Insights https://patch-diff.githubusercontent.com/dapperstats/bbplot/pulse
Code https://patch-diff.githubusercontent.com/dapperstats/bbplot
Issues https://patch-diff.githubusercontent.com/dapperstats/bbplot/issues
Pull requests https://patch-diff.githubusercontent.com/dapperstats/bbplot/pulls
Actions https://patch-diff.githubusercontent.com/dapperstats/bbplot/actions
Projects https://patch-diff.githubusercontent.com/dapperstats/bbplot/projects
Security https://patch-diff.githubusercontent.com/dapperstats/bbplot/security
Insights https://patch-diff.githubusercontent.com/dapperstats/bbplot/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/dapperstats/bbplot/issues/2
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/dapperstats/bbplot/issues/2
A function to add a colored polygon to a plot for confidence intervalshttps://patch-diff.githubusercontent.com/dapperstats/bbplot/issues/2#top
https://github.com/mfidino
https://github.com/mfidino
mfidinohttps://github.com/mfidino
on Sep 2, 2021https://github.com/dapperstats/bbplot/issues/2#issue-987107924
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.