diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 000000000..92b891704 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master, automatic-birthday-machine] + release: + types: [published] + workflow_dispatch: + +name: pkgdown.yaml + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index 815d6c977..1c25b1b9b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ *ANIMINT_TEST_FOO *pids.txt *~ +docs diff --git a/DESCRIPTION b/DESCRIPTION index 396293003..7b606fd66 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,9 +8,6 @@ Authors@R: c( email="toby.hocking@r-project.org", role=c("aut", "cre"), comment="Original animint code"), - person("Biplab", "Sutradhar", - role = "ctb", - comment = "Updated animist.js to use class for source links"), person("Hadley", "Wickham", role=c("aut"), comment="Forked ggplot2 code"), @@ -58,7 +55,10 @@ Authors@R: c( comment="Animint2 GSoC 2023"), person("Siddhesh", "Deodhar", role="aut", - comment="Animint2 GSoC 2024")) + comment="Animint2 GSoC 2024"), + person("Biplab", "Sutradhar", + role = "ctb", + comment = "bug fixer: id issue")) Description: Functions are provided for defining animated, interactive data visualizations in R code, and rendering on a web page. The 2018 Journal of Computational and diff --git a/NEWS.md b/NEWS.md index df16db9a3..5a0e24dad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,10 @@ # Changes in version 2024.10.10 (PR#154) - - Updated `animist.js` to use classes for source links, resolving issue #145. +- Updated `animint.js` to use CSS classes instead of IDs for source links. # Changes in version 2024.9.18 (PR#131) - - Added functionality to capture screenshot in animint2pages +- Added functionality to capture screenshot in animint2pages. # Changes in version 2024.9.17 diff --git a/_pkgdown.yml b/_pkgdown.yml index 48634af72..b29aae390 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -15,6 +15,7 @@ template: bootstrap: 5 + light-switch: true bslib: base_font: {google: "Roboto Condensed"} heading_font: {google: "Roboto Condensed"} @@ -296,4 +297,5 @@ reference: - transform_shape - translate_qplot_ggplot - translate_qplot_lattice - - update_gallery \ No newline at end of file + - update_gallery + diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index 329cb3e77..000000000 --- a/docs/404.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - -Page not found (404) • animint2 - - - - - - - - - - - - Skip to contents - - -
-
-
- -Content not found. Please use links in the navbar. - -
-
- - - -
- - - - - - - diff --git a/docs/articles/animint2.html b/docs/articles/animint2.html deleted file mode 100644 index 3f6f1e3c5..000000000 --- a/docs/articles/animint2.html +++ /dev/null @@ -1,638 +0,0 @@ - - - - - - - - -Animint2 Quick Start Guide • animint2 - - - - - - - - - - - - - Skip to contents - - -
- - - - -
-
- - - -
-

Introduction -

-

Welcome to the quick start guide. My goal is to introduce you to -animint2 in a way that is both brief and easy to -understand. I assume nothing except some basic familiarity with R, data -visualizations, and a little bit of statistics. Some familiarity with -the ggplot2 package is helpful but unnecessary.

-

After reading this, you’ll leave with a sense of how -animint2 works. You’ll also know how to make interactive -data visualizations, sometimes referred to as animints. For basic -animints, this quick start guide is all you’ll need. To learn how to -make more sophisticated animints, take a look at the animint2 -Manual. You may also want to take a look at the animint -gallery, which showcases how sophisticated and powerful animints can -be.

-
-
-

Datasets -

-

Some readers may want to follow along interactively. Both -animint2 and R have datasets that you may use. Access the -dataset list with data(). Alternatively, you may already -have a dataset you’d like to use to experiment with -animint2.

-

I use a custom dataset in this guide, which I’ve named -meowtrics. The data in the dataset are simulated, which is -a fancy way of saying that I forced a computer to make them up. The data -are about ten different housecats and how they’re perceived over -time.i Here’s a glimpse:

-
-head(meowtrics)
-
##   Day        Cat Coolness Cuteness               Kind
-## 1   1   Clifford     0.16     4.50 Domestic Shorthair
-## 2   1    Junebug     0.36     3.70  Domestic Longhair
-## 3   1     Muffin     0.41     0.47        Cornish Rex
-## 4   1 Teddy Bear     0.47     5.10 Domestic Shorthair
-## 5   1      Diana     0.61     9.60 Domestic Shorthair
-## 6   1      Bello     0.71     1.90 Domestic Shorthair
-
-
-

Anatomy of a Data Visualization -

-

Data visualizations are commonplace, and for good reason. Large -tables of data are difficult to parse. A good data visualization can -illuminate patterns that would have otherwise hard to spot. In contrast, -a poor (or deliberately misleading) data visualization can obscure even -obvious patterns. How do we design good data visualizations while -avoiding bad ones?

-

We start by understanding what data visualizations are made of and -how they’re arranged. This arrangement is often called the grammar of -graphics.ii This quick start guide won’t -teach you the grammar, and you don’t need to know it to get started with -animint2. But you should know that the syntax of -animint2—that is, the way the code is written—is modelled -on the grammar.

-

Let’s see an example. Say I want to visualize how people rate cat -cuteness over time. I want the y-axis to depict the cuteness ratings, -and the x-axis the days. I also want it to be a scatterplot. What should -I do?

-

First, if I haven’t already, I need to install -animint2:

-
-install.packages("animint2")
-

I load animint2:

- -

Next, I search for the functions that I’ll need and put them -together. First, I need ggplot(), which is like the blank -sheet of paper (or computer screen) the program draws on to make the -graph.iii To make a scatterplot, I’ll use -either geom_point() or geom_jitter(). Finally, -for the axes, I’ll need aes().

-

Then I name the graph and put it all together:

-
-cute_plot <-                    #1
-  ggplot() +                    #2
-  geom_point(                   #3
-    data = meowtrics,           #4
-    aes(x = Day, y = Cuteness)) #5
-cute_plot                       #6
-

A scatterplot about cat cuteness ratings over time. The x-axis are the days, and the y-axis the cuteness ratings. There is a lot of variance in the data, but in general cat cuteness ratings rise over time.

-

If you’re unfamiliar with the syntax, the code can get -confusing.iv Let’s go over this code -block line by line:

-
    -
  1. -I name the data visualization. Since it’s a -scatterplot about cat cuteness, I name it cute_plot. You -can name data visualizations whatever you like, but it’s best if you -name it something that will make sense to your future self. -
  2. -
  3. -Next, I call the ggplot() -function, since I’m making a data visualization. -
  4. -
  5. -Then I call geom_point(), because -I’m making a scatterplot. -
  6. -
  7. -I want to use my meowtrics -dataset to draw the points in my scatterplot, so I set -data = meowtrics. -
  8. -
  9. -aes() controls the aesthetics of -the data visualization, including axes. I place it inside -geom_point() and tell my program that the Day and Cuteness -variables are on the x- and y-axes, respectively. -
  10. -
  11. -I repeat the name of my data visualization, -which tells the program to display my graph. -
  12. -
-

Look at the plot. We can see that while there’s a lot of variance in -the data, there seems to be an upward trend in cat cuteness ratings. But -this graph could be better. And animint2 gives us the tools -to improve it.

-

Take a look at this slightly modified data visualization:

-
-cute_plot_colored <-                             #1
-  ggplot() +
-  geom_point(
-    data = meowtrics,
-    aes(x = Day, y = Cuteness,
-        group = Cat, color = Cat)) +             #2
-  labs(title = "Cat Cuteness Ratings Over Time") #3
-cute_plot_colored
-

A scatterplot titled Cat Cutness Ratings Over Time. It looks exactly the same as the previous graph, except all the data points are differentiated by color. There is also a legend that maps each color to a cat.

-

Each cat is differentiated from one another by color, and there’s now -a legend. Codewise, what’s changed?

-
    -
  1. -This data visualization has a different name. -If two plots have the same name, one will override the other. -
  2. -
  3. -I’ve added new arguments to -aes(): I’ve grouped the points in the scatterplot by cat, -and I’ve also differentiated the cats’ data points by -color.v -
  4. -
  5. -Using labs(), I’ve given the -graph a title. -
  6. -
-

While this new graph communicates more information, it’s also -somewhat overwhelming. What if we could move some of the data out of the -way? Or compare a subset of cat cuteness ratings instead of seeing -everything at once? Reader, I have good news.

-
-
-

Making Animints -

-

The good news is this: animint2 makes it easy to render -a static data visualization interactive. Just use the -animint() function with the previous plot as the -argument:

-
-animint(cute_plot_colored)
- -

-

-
- -
-

This is an animint of our second static data visualization. By -clicking on the legend or by using the selection menu, you can control -which subjects have their data graphed, as well as how -many.vi This allows you to explore your -data without needing to facet all possible cat combinations. For -exploratory data analysis, this level of control may be all you -need.

-

In some cases, you may want more control. Say you want to emphasize -Archibald and Muffin’s cuteness ratings over time. In -animint2, you would use the first argument and -specify which cats to present:

-
-cute_present <- 
-  animint(cute_plot_colored, 
-          first = list( #1
-            Cat = c(    #2
-              "Archibald", "Muffin")))
-cute_present
-

-

-
- -
-

This is most useful for situations where you’re showcasing or -presenting your animint. Pay attention to the syntax:

-
    -
  1. -The first argument only accepts -list()s. -
  2. -
  3. -The specified cats must be in a character -vector. That’s why they’re in a c() function. -
  4. -
-
-
-

Using showSelected -

-

Our current animints use three variables: Day, Cuteness, and Cat. -What if you want to explore or present a -fourth?vii In a static data -visualization, this would require multiple graphs or the addition of an -unwieldy third dimension.

-

Luckily, animints are not subject to the same restrictions. In -animint(), we can use the showSelected and -time arguments to show how the Coolness and Cuteness -variables interact day-by-day.

-

First, let’s look at an animint with the showSelected -variable:

-
-associations <- 
-  ggplot() +
-  geom_point(
-    data = meowtrics,
-    showSelected = "Day",           #1
-    aes(x = Coolness, y = Cuteness, 
-        color = Cat, group = Cat, 
-        key = Cat)) +               #2
-  labs(title = "Associations Between Cuteness and Coolness")
-animint(associations)
-

-

-
- -
-
    -
  1. -showSelected = "Day" lets you -adjust the day in the selection menu. -
  2. -
  3. -Most real-world datasets have missing values. -key accounts for that when transitioning between different -days. -
  4. -
-

You can use the selection menu to see the different associations -between cuteness and coolness ratings per -day.viii

-

Next, let’s see that same animint with the time and -duration options applied:

-
-animated_associations <- 
-  animint(associations, 
-          duration = list(Day = 1000), #1
-          time = list(                 #2
-            variable = "Day", 
-            ms = 1000))                #3
-animated_associations
-

-

-
- -
-
    -
  1. -duration specifies how quickly -the points move from their old location to their new -location.ix The shorter the duration, the -quicker the movement. It takes a list and uses milliseconds as its unit -of measurement. -
  2. -
  3. -time also takes a list. -
  4. -
  5. -In contrast to duration, -time = list(ms) specifies how long the points stay in -place. It also uses milliseconds as its unit of measurement. -
  6. -
-

You can also click the “Show animation controls” button and manually -adjust both the time and duration. Try it -out.

-
-
-

Using clickSelects -

-

So far, we’ve been interacting with animints by clicking the legend -and using the selection menus and animation controls. What if we could -interact with the animint directly? Using clickSelects, we -can do just that. Let’s return to our data visualization depicting -cuteness ratings over time, this time as an animint:

-
-cute_colored_again <-
-  ggplot() +
-  geom_point(
-    data = meowtrics,
-    clickSelects = "Cat", #1
-    aes(x = Day, y = Cuteness,
-        group = Cat, color = Cat))
-animint(cute_colored_again)
-

-

-
- -
-
  1. -clickSelects takes a variable -with quotations. The variable in clickSelects and -group are the same: they’re both Cat. -
-

Hover over and click on the data points. You’ll notice that it has -the same effect as clicking on the legend: It removes the data from the -animint.

-

Now, let’s interact with a very similar animint:

- -
-cute_plot_kind <-
-  ggplot() +
-  geom_point(
-    data = meowtrics,
-    clickSelects = "Kind", #1
-    aes(x = Day, y = Cuteness,
-        group = Cat, color = Cat))
-animint(cute_plot_kind)
-

-

-
- -
-
  1. -I’ve swapped out Cat for Kind. Now the -variables in clickSelects and group are -different. This is a useful way of adding another variable to your data -visualizations. -
-

When you interact with this animint, you’ll notice three -differences:

-
    -
  1. Hover over the animints. In both, you’ll notice a hover box appear. -In the first animint, the hover box repeats the cat’s name. In the -second, the hover box describes what kind of cat they are.
  2. -
  3. In the second animint, there is an additional variable in the -selection menu. You can use it to highlight the data points depicting a -certain kind of cat.
  4. -
  5. When you click on a data point, it doesn’t disappear. Instead, like -the selection menu, it highlights data points depicting certain kinds of -cats.
  6. -
-
-
-

Linked Plots -

-

animint2 also allows us to link multiple plots together -into one animint. When two plots are linked, a change in one plot can -cause changes in another.

-

Let’s return to two interactive data visualizations we’ve already -looked at: associations between coolness and cuteness, and cuteness -ratings over time.

-

Here’s the first data visualization again, lightly altered:

-
-associations_again <-
-  ggplot() +
-  geom_point(
-    data = meowtrics,
-    showSelected = "Day",
-    clickSelects = "Kind",
-    aes(x = Coolness, y = Cuteness,
-        color = Cat, group = Cat,
-        key = Cat))
-

I want to link it to my plot about cuteness ratings over time. That -way, I can see how coolness ratings change over time, too. The linking -process is a little more involved than usual:

-
-md <- data.frame(Day = unique(meowtrics$Day))  #1
-
-linked <- animint(associations_again,          #2
-                  duration = list(Day = 1000)) #3
-
-linked$overtime <-                             #4
-  ggplot() + 
-  geom_tallrect(                               #5
-    data = md,                                 #6
-    aes(xmin = Day-0.5, xmax = Day+0.5),       #7
-    clickSelects = "Day",                      #8
-    alpha = 0.5                                #9
-    ) +                                        #10
-  geom_point(
-    data = meowtrics,                          #11
-    clickSelects = "Cat",
-    aes(x = Day, y = Cuteness, 
-        group = Cat, color = Cat))
-linked                                         #12
-

-

-
- -
-
    -
  1. -I’m taking the Day column from -meowtrics (meowtrics$Day), stripping redundant -days from it viaunique(), renaming it, and then making it a -data.frame(). Now I have a dataframe of all 30 days in -meowtrics. This is for geom_tallrect(), which -I’ll use later. -
  2. -
  3. -I take associations_2 and make it -an animint. -
  4. -
  5. -duration controls how long it -takes data points to move from one part of the animint to another. As -mentioned, it’s optional. -
  6. -
  7. -I take the previously-created animint and -attach new animints to it. I name the list of animint -overtime. -
  8. -
  9. -This is the geom_tallrect() -function. It creates a vertical bar that allows you to manipulate time -variables by clicking on the plot. -
  10. -
  11. -geom_tallrect() requires a new -dataset that contains only the time variable. It’s using the dataset -that I constructed earlier. -
  12. -
  13. -xmin and xmax -control how wide the tallrect is, which affects the appearance of the -selected time variable. In this case, it controls how much a day takes -up on the tallrect. -
  14. -
  15. -clickSelects is necessary here, -since we need to be able to select the day from the plot. -
  16. -
  17. -alpha controls the transparency -of the tallrect. Lower numbers increase transparency. -
  18. -
  19. -Using +, I attach the tallrect to -the plot about cuteness ratings over time. -
  20. -
  21. -We’re back to using meowtrics as -our dataset. -
  22. -
  23. -Finally, we intitate the animint. -
  24. -
-

Try it out. When you adjust the day on the bottom plot, the top plot -also readjusts. When you click on the legend on the top plot, the bottom -plot is also affected. These linked plots can get much complex. For -examples, see the animint -gallery.

-
-
-

Conclusion -

-

And that’s it. You’re now a reasonably competent -animint2 user. If you would like to learn more, please read -the animint2 -Manual—especially chapters 1 to 4, which go over the same material -in greater depth.

-

Feel free to post any questions to our GitHub issues. -Thanks for reading!

-
-
-

Footnotes -

-
    -
  1. -Fun science fact: Cats are objectively the best animal. -
  2. -
  3. -If you’re interested in learning about the grammar and want to get right -to the primary source, see Leland Wilkinson’s The Grammar of -Graphics. -
  4. -
  5. -All data visualizations use ggplot(). -
  6. -
  7. -Notice also that the ggplot() and geom_point() -functions are held together by the + symbol. In other -words: You begin with a blank data visualization and then add a -scatterplot atop it. All functions in animint2 are held -together with +. You’ll be using it a lot. -
  8. -
  9. -It’s possible to differentiate the data points in a different manner. -For example, instead of different colors, I could have used different -shapes. -
  10. -
  11. -Play around with the animint. See what you can and can’t interact with. -
  12. -
  13. -Recall that our meowtrics dataset has a Coolness variable -we haven’t looked at yet. -
  14. -
  15. -Play around with it and see what you can do. -
  16. -
  17. -Fun fact: The duration argument is optional. If you decide -not to use duration or set it to 0 milliseconds, the points -teleport from one location to another. -
  18. -
-
-
-
- - - - -
- - - - - - - diff --git a/docs/articles/animint2_files/figure-html/anatomy-cute-plot-1.png b/docs/articles/animint2_files/figure-html/anatomy-cute-plot-1.png deleted file mode 100644 index b58f4f50c..000000000 Binary files a/docs/articles/animint2_files/figure-html/anatomy-cute-plot-1.png and /dev/null differ diff --git a/docs/articles/animint2_files/figure-html/anatomy-cute-plot-2-1.png b/docs/articles/animint2_files/figure-html/anatomy-cute-plot-2-1.png deleted file mode 100644 index 8b025141d..000000000 Binary files a/docs/articles/animint2_files/figure-html/anatomy-cute-plot-2-1.png and /dev/null differ diff --git a/docs/articles/animint2_files/figure-html/anatomy-cute-plot-colored-1.png b/docs/articles/animint2_files/figure-html/anatomy-cute-plot-colored-1.png deleted file mode 100644 index 8b025141d..000000000 Binary files a/docs/articles/animint2_files/figure-html/anatomy-cute-plot-colored-1.png and /dev/null differ diff --git a/docs/articles/basicscutepresent/geom1_point_cuteplotcolored_chunk1.tsv b/docs/articles/basicscutepresent/geom1_point_cuteplotcolored_chunk1.tsv deleted file mode 100644 index 3887a9030..000000000 --- a/docs/articles/basicscutepresent/geom1_point_cuteplotcolored_chunk1.tsv +++ /dev/null @@ -1,301 +0,0 @@ -colour x y showSelectedlegendcolour fill -#A3A500 1 4.5 Clifford #A3A500 -#00BFC4 1 3.7 Junebug #00BFC4 -#00B0F6 1 0.47 Muffin #00B0F6 -#E76BF3 1 5.1 Teddy Bear #E76BF3 -#39B600 1 9.6 Diana #39B600 -#D89000 1 1.9 Bello #D89000 -#00BF7D 1 4.9 Jellybean #00BF7D -#F8766D 1 9.1 Archibald #F8766D -#9590FF 1 2.3 Saturday #9590FF -#FF62BC 1 5.9 Wilbur #FF62BC -#A3A500 2 8.2 Clifford #A3A500 -#00BFC4 2 2.6 Junebug #00BFC4 -#00B0F6 2 5.1 Muffin #00B0F6 -#E76BF3 2 3.2 Teddy Bear #E76BF3 -#39B600 2 2.6 Diana #39B600 -#D89000 2 5.3 Bello #D89000 -#00BF7D 2 8.8 Jellybean #00BF7D -#F8766D 2 2.6 Archibald #F8766D -#9590FF 2 4.4 Saturday #9590FF -#FF62BC 2 8 Wilbur #FF62BC -#A3A500 3 2.7 Clifford #A3A500 -#00BFC4 3 5.7 Junebug #00BFC4 -#00B0F6 3 6.1 Muffin #00B0F6 -#E76BF3 3 3 Teddy Bear #E76BF3 -#39B600 3 4.2 Diana #39B600 -#D89000 3 0.72 Bello #D89000 -#00BF7D 3 3.1 Jellybean #00BF7D -#F8766D 3 4.6 Archibald #F8766D -#9590FF 3 4.2 Saturday #9590FF -#FF62BC 3 3.1 Wilbur #FF62BC -#A3A500 4 5.1 Clifford #A3A500 -#00BFC4 4 3.4 Junebug #00BFC4 -#00B0F6 4 3.2 Muffin #00B0F6 -#E76BF3 4 5.1 Teddy Bear #E76BF3 -#39B600 4 7.5 Diana #39B600 -#D89000 4 3.4 Bello #D89000 -#00BF7D 4 4.8 Jellybean #00BF7D -#F8766D 4 2.2 Archibald #F8766D -#9590FF 4 3.4 Saturday #9590FF -#FF62BC 4 5.7 Wilbur #FF62BC -#A3A500 5 2.9 Clifford #A3A500 -#00BFC4 5 3.5 Junebug #00BFC4 -#00B0F6 5 5.1 Muffin #00B0F6 -#E76BF3 5 3.6 Teddy Bear #E76BF3 -#39B600 5 3.5 Diana #39B600 -#D89000 5 5 Bello #D89000 -#00BF7D 5 6.3 Jellybean #00BF7D -#F8766D 5 3.5 Archibald #F8766D -#9590FF 5 4.6 Saturday #9590FF -#FF62BC 5 8.9 Wilbur #FF62BC -#A3A500 6 3.7 Clifford #A3A500 -#00BFC4 6 5.5 Junebug #00BFC4 -#00B0F6 6 7.4 Muffin #00B0F6 -#E76BF3 6 3.9 Teddy Bear #E76BF3 -#39B600 6 4.1 Diana #39B600 -#D89000 6 4.6 Bello #D89000 -#00BF7D 6 4 Jellybean #00BF7D -#F8766D 6 7.3 Archibald #F8766D -#9590FF 6 0.36 Saturday #9590FF -#FF62BC 6 4.1 Wilbur #FF62BC -#A3A500 7 4.6 Clifford #A3A500 -#00BFC4 7 5.7 Junebug #00BFC4 -#00B0F6 7 4.1 Muffin #00B0F6 -#E76BF3 7 5.8 Teddy Bear #E76BF3 -#39B600 7 4.4 Diana #39B600 -#D89000 7 4.1 Bello #D89000 -#00BF7D 7 5.3 Jellybean #00BF7D -#F8766D 7 6 Archibald #F8766D -#9590FF 7 4.1 Saturday #9590FF -#FF62BC 7 5.8 Wilbur #FF62BC -#A3A500 8 9.5 Clifford #A3A500 -#00BFC4 8 4.1 Junebug #00BFC4 -#00B0F6 8 4.2 Muffin #00B0F6 -#E76BF3 8 2.7 Teddy Bear #E76BF3 -#39B600 8 4.2 Diana #39B600 -#D89000 8 4.6 Bello #D89000 -#00BF7D 8 6.6 Jellybean #00BF7D -#F8766D 8 4.2 Archibald #F8766D -#9590FF 8 4.3 Saturday #9590FF -#FF62BC 8 0.76 Wilbur #FF62BC -#A3A500 9 4.4 Clifford #A3A500 -#00BFC4 9 5.2 Junebug #00BFC4 -#00B0F6 9 0.71 Muffin #00B0F6 -#E76BF3 9 4.4 Teddy Bear #E76BF3 -#39B600 9 3.8 Diana #39B600 -#D89000 9 3.7 Bello #D89000 -#00BF7D 9 4.4 Jellybean #00BF7D -#F8766D 9 5.2 Archibald #F8766D -#9590FF 9 3 Saturday #9590FF -#FF62BC 9 4.4 Wilbur #FF62BC -#A3A500 10 4.9 Clifford #A3A500 -#00BFC4 10 5.5 Junebug #00BFC4 -#00B0F6 10 4.5 Muffin #00B0F6 -#E76BF3 10 6.8 Teddy Bear #E76BF3 -#39B600 10 3.7 Diana #39B600 -#D89000 10 4.5 Bello #D89000 -#00BF7D 10 4.9 Jellybean #00BF7D -#F8766D 10 8.5 Archibald #F8766D -#9590FF 10 4.5 Saturday #9590FF -#FF62BC 10 4.9 Wilbur #FF62BC -#A3A500 11 6.2 Clifford #A3A500 -#00BFC4 11 4.5 Junebug #00BFC4 -#00B0F6 11 4.3 Muffin #00B0F6 -#E76BF3 11 4 Teddy Bear #E76BF3 -#39B600 11 4.5 Diana #39B600 -#D89000 11 4.8 Bello #D89000 -#00BF7D 11 3 Jellybean #00BF7D -#F8766D 11 4.6 Archibald #F8766D -#9590FF 11 5.2 Saturday #9590FF -#FF62BC 11 3.8 Wilbur #FF62BC -#A3A500 12 4.6 Clifford #A3A500 -#00BFC4 12 5.4 Junebug #00BFC4 -#00B0F6 12 7 Muffin #00B0F6 -#E76BF3 12 4.6 Teddy Bear #E76BF3 -#39B600 12 6.1 Diana #39B600 -#D89000 12 9.5 Bello #D89000 -#00BF7D 12 4.6 Jellybean #00BF7D -#F8766D 12 6 Archibald #F8766D -#9590FF 12 7.7 Saturday #9590FF -#FF62BC 12 4.6 Wilbur #FF62BC -#A3A500 13 4.9 Clifford #A3A500 -#00BFC4 13 2.2 Junebug #00BFC4 -#00B0F6 13 4.6 Muffin #00B0F6 -#E76BF3 13 6.4 Teddy Bear #E76BF3 -#39B600 13 7.2 Diana #39B600 -#D89000 13 4.6 Bello #D89000 -#00BF7D 13 3.2 Jellybean #00BF7D -#F8766D 13 6.6 Archibald #F8766D -#9590FF 13 4.7 Saturday #9590FF -#FF62BC 13 5.6 Wilbur #FF62BC -#A3A500 14 7.1 Clifford #A3A500 -#00BFC4 14 4.7 Junebug #00BFC4 -#00B0F6 14 4.5 Muffin #00B0F6 -#E76BF3 14 2.8 Teddy Bear #E76BF3 -#39B600 14 4.8 Diana #39B600 -#D89000 14 6.3 Bello #D89000 -#00BF7D 14 7.1 Jellybean #00BF7D -#F8766D 14 4.9 Archibald #F8766D -#9590FF 14 4.6 Saturday #9590FF -#FF62BC 14 6.6 Wilbur #FF62BC -#A3A500 15 4.9 Clifford #A3A500 -#00BFC4 15 6.3 Junebug #00BFC4 -#00B0F6 15 0.41 Muffin #00B0F6 -#E76BF3 15 4.9 Teddy Bear #E76BF3 -#39B600 15 5 Diana #39B600 -#D89000 15 0.61 Bello #D89000 -#00BF7D 15 4.9 Jellybean #00BF7D -#F8766D 15 3.1 Archibald #F8766D -#9590FF 15 2.8 Saturday #9590FF -#FF62BC 15 5 Wilbur #FF62BC -#A3A500 16 4.6 Clifford #A3A500 -#00BFC4 16 3 Junebug #00BFC4 -#00B0F6 16 5 Muffin #00B0F6 -#E76BF3 16 3.3 Teddy Bear #E76BF3 -#39B600 16 9.6 Diana #39B600 -#D89000 16 5 Bello #D89000 -#00BF7D 16 5.2 Jellybean #00BF7D -#F8766D 16 3.9 Archibald #F8766D -#9590FF 16 5 Saturday #9590FF -#FF62BC 16 6.9 Wilbur #FF62BC -#A3A500 17 3.7 Clifford #A3A500 -#00BFC4 17 5 Junebug #00BFC4 -#00B0F6 17 2.7 Muffin #00B0F6 -#E76BF3 17 8.4 Teddy Bear #E76BF3 -#39B600 17 5 Diana #39B600 -#D89000 17 6 Bello #D89000 -#00BF7D 17 8.5 Jellybean #00BF7D -#F8766D 17 5.1 Archibald #F8766D -#9590FF 17 3.6 Saturday #9590FF -#FF62BC 17 3.2 Wilbur #FF62BC -#A3A500 18 5.2 Clifford #A3A500 -#00BFC4 18 6.8 Junebug #00BFC4 -#00B0F6 18 1.3 Muffin #00B0F6 -#E76BF3 18 5.2 Teddy Bear #E76BF3 -#39B600 18 6.4 Diana #39B600 -#D89000 18 6.2 Bello #D89000 -#00BF7D 18 5.2 Jellybean #00BF7D -#F8766D 18 4.2 Archibald #F8766D -#9590FF 18 7.9 Saturday #9590FF -#FF62BC 18 5.2 Wilbur #FF62BC -#A3A500 19 4.7 Clifford #A3A500 -#00BFC4 19 3.4 Junebug #00BFC4 -#00B0F6 19 5.3 Muffin #00B0F6 -#E76BF3 19 4.9 Teddy Bear #E76BF3 -#39B600 19 9.1 Diana #39B600 -#D89000 19 5.3 Bello #D89000 -#00BF7D 19 4.6 Jellybean #00BF7D -#F8766D 19 2 Archibald #F8766D -#9590FF 19 5.4 Saturday #9590FF -#FF62BC 19 7.6 Wilbur #FF62BC -#A3A500 20 7.9 Clifford #A3A500 -#00BFC4 20 5.4 Junebug #00BFC4 -#00B0F6 20 5.1 Muffin #00B0F6 -#E76BF3 20 7.5 Teddy Bear #E76BF3 -#39B600 20 5.4 Diana #39B600 -#D89000 20 4.3 Bello #D89000 -#00BF7D 20 9.1 Jellybean #00BF7D -#F8766D 20 5.4 Archibald #F8766D -#9590FF 20 5.6 Saturday #9590FF -#FF62BC 20 3.2 Wilbur #FF62BC -#A3A500 21 5.5 Clifford #A3A500 -#00BFC4 21 5.2 Junebug #00BFC4 -#00B0F6 21 0.86 Muffin #00B0F6 -#E76BF3 21 5.5 Teddy Bear #E76BF3 -#39B600 21 4.9 Diana #39B600 -#D89000 21 9.1 Bello #D89000 -#00BF7D 21 5.5 Jellybean #00BF7D -#F8766D 21 4.9 Archibald #F8766D -#9590FF 21 9.6 Saturday #9590FF -#FF62BC 21 5.6 Wilbur #FF62BC -#A3A500 22 5.4 Clifford #A3A500 -#00BFC4 22 6.7 Junebug #00BFC4 -#00B0F6 22 5.7 Muffin #00B0F6 -#E76BF3 22 3.9 Teddy Bear #E76BF3 -#39B600 22 7.4 Diana #39B600 -#D89000 22 5.8 Bello #D89000 -#00BF7D 22 3.8 Jellybean #00BF7D -#F8766D 22 4.4 Archibald #F8766D -#9590FF 22 5.9 Saturday #9590FF -#FF62BC 22 6.6 Wilbur #FF62BC -#A3A500 23 1.2 Clifford #A3A500 -#00BFC4 23 5.9 Junebug #00BFC4 -#00B0F6 23 2.9 Muffin #00B0F6 -#E76BF3 23 6.8 Teddy Bear #E76BF3 -#39B600 23 5.9 Diana #39B600 -#D89000 23 5 Bello #D89000 -#00BF7D 23 7.3 Jellybean #00BF7D -#F8766D 23 5.9 Archibald #F8766D -#9590FF 23 3.9 Saturday #9590FF -#FF62BC 23 4.8 Wilbur #FF62BC -#A3A500 24 5.9 Clifford #A3A500 -#00BFC4 24 5.3 Junebug #00BFC4 -#00B0F6 24 1.7 Muffin #00B0F6 -#E76BF3 24 6 Teddy Bear #E76BF3 -#39B600 24 6 Diana #39B600 -#D89000 24 6.8 Bello #D89000 -#00BF7D 24 6 Jellybean #00BF7D -#F8766D 24 2.9 Archibald #F8766D -#9590FF 24 2.6 Saturday #9590FF -#FF62BC 24 6 Wilbur #FF62BC -#A3A500 25 5.9 Clifford #A3A500 -#00BFC4 25 3.4 Junebug #00BFC4 -#00B0F6 25 6.1 Muffin #00B0F6 -#E76BF3 25 5 Teddy Bear #E76BF3 -#39B600 25 2.1 Diana #39B600 -#D89000 25 6.2 Bello #D89000 -#00BF7D 25 3.7 Jellybean #00BF7D -#F8766D 25 0.16 Archibald #F8766D -#9590FF 25 6.3 Saturday #9590FF -#FF62BC 25 3.1 Wilbur #FF62BC -#A3A500 26 3.8 Clifford #A3A500 -#00BFC4 26 6.3 Junebug #00BFC4 -#00B0F6 26 5.7 Muffin #00B0F6 -#E76BF3 26 5.6 Teddy Bear #E76BF3 -#39B600 26 6.3 Diana #39B600 -#D89000 26 4.8 Bello #D89000 -#00BF7D 26 6.8 Jellybean #00BF7D -#F8766D 26 6.3 Archibald #F8766D -#9590FF 26 5.2 Saturday #9590FF -#FF62BC 26 7.5 Wilbur #FF62BC -#A3A500 27 6.4 Clifford #A3A500 -#00BFC4 27 5.8 Junebug #00BFC4 -#00B0F6 27 9.5 Muffin #00B0F6 -#E76BF3 27 6.5 Teddy Bear #E76BF3 -#39B600 27 6.7 Diana #39B600 -#D89000 27 1.6 Bello #D89000 -#00BF7D 27 6.6 Jellybean #00BF7D -#F8766D 27 4.9 Archibald #F8766D -#9590FF 27 3.2 Saturday #9590FF -#FF62BC 27 6.8 Wilbur #FF62BC -#A3A500 28 4.4 Clifford #A3A500 -#00BFC4 28 1.3 Junebug #00BFC4 -#00B0F6 28 6.9 Muffin #00B0F6 -#E76BF3 28 6.4 Teddy Bear #E76BF3 -#39B600 28 6.4 Diana #39B600 -#D89000 28 6.9 Bello #D89000 -#00BF7D 28 4.1 Jellybean #00BF7D -#F8766D 28 3.3 Archibald #F8766D -#9590FF 28 7 Saturday #9590FF -#FF62BC 28 3.8 Wilbur #FF62BC -#A3A500 29 6.5 Clifford #A3A500 -#00BFC4 29 7.4 Junebug #00BFC4 -#00B0F6 29 4.5 Muffin #00B0F6 -#E76BF3 29 3 Teddy Bear #E76BF3 -#39B600 29 7.5 Diana #39B600 -#D89000 29 7.4 Bello #D89000 -#00BF7D 29 0.71 Jellybean #00BF7D -#F8766D 29 7.8 Archibald #F8766D -#9590FF 29 4.2 Saturday #9590FF -#FF62BC 29 6.6 Wilbur #FF62BC -#A3A500 30 8.3 Clifford #A3A500 -#00BFC4 30 5.4 Junebug #00BFC4 -#00B0F6 30 7.6 Muffin #00B0F6 -#E76BF3 30 8.8 Teddy Bear #E76BF3 -#39B600 30 3.8 Diana #39B600 -#D89000 30 5.5 Bello #D89000 -#00BF7D 30 8.9 Jellybean #00BF7D -#F8766D 30 3.8 Archibald #F8766D -#9590FF 30 5.4 Saturday #9590FF -#FF62BC 30 9.1 Wilbur #FF62BC diff --git a/docs/articles/index.html b/docs/articles/index.html deleted file mode 100644 index 3d947b71d..000000000 --- a/docs/articles/index.html +++ /dev/null @@ -1,74 +0,0 @@ - -Articles • animint2 - Skip to contents - - -
-
-
- -
-

All vignettes

-

- -
Animint2 Quick Start Guide
-
-
-
- - -
- - - - - - - diff --git a/docs/articles/linkedplots/animint.js b/docs/articles/linkedplots/animint.js deleted file mode 100644 index 01dd1e740..000000000 --- a/docs/articles/linkedplots/animint.js +++ /dev/null @@ -1,2690 +0,0 @@ -// Define functions to render linked interactive plots using d3. -// Another script should define e.g. -// -// Constructor for animint Object. -var animint = function (to_select, json_file) { - - var default_axis_px = 16; - - function wait_until_then(timeout, condFun, readyFun) { - var args=arguments - function checkFun() { - if(condFun()) { - readyFun(args[3],args[4]); - } else{ - setTimeout(checkFun, timeout); - } - } - checkFun(); - } - - function convert_R_types(resp_array, types){ - return resp_array.map(function (d) { - for (var v_name in d) { - if(!is_interactive_aes(v_name)){ - var r_type = types[v_name]; - if (r_type == "integer") { - d[v_name] = parseInt(d[v_name]); - } else if (r_type == "numeric") { - d[v_name] = parseFloat(d[v_name]); - } else if (r_type == "factor" || r_type == "rgb" - || r_type == "linetype" || r_type == "label" - || r_type == "character") { - // keep it as a character - } else if (r_type == "character" & v_name == "outliers") { - d[v_name] = parseFloat(d[v_name].split(" @ ")); - } - } - } - return d; - }); - } - - // replacing periods in variable with an underscore this makes sure - // that selector doesn't confuse . in name with css selectors - function safe_name(unsafe_name){ - return unsafe_name.replace(/[ .]/g, '_'); - } - function legend_class_name(selector_name){ - return safe_name(selector_name) + "_variable"; - } - - function is_interactive_aes(v_name){ - if(v_name.indexOf("clickSelects") > -1){ - return true; - } - if(v_name.indexOf("showSelected") > -1){ - return true; - } - return false; - } - - var linetypesize2dasharray = function (lt, size) { - var isInt = function(n) { - return typeof n === 'number' && parseFloat(n) == parseInt(n, 10) && !isNaN(n); - }; - if(isInt(lt)){ // R integer line types. - if(lt == 1){ - return null; - } - var o = { - 0: size * 0 + "," + size * 10, - 2: size * 4 + "," + size * 4, - 3: size + "," + size * 2, - 4: size + "," + size * 2 + "," + size * 4 + "," + size * 2, - 5: size * 8 + "," + size * 4, - 6: size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2 - }; - } else { // R defined line types - if(lt == "solid" || lt === null){ - return null; - } - var o = { - "blank": size * 0 + "," + size * 10, - "none": size * 0 + "," + size * 10, - "dashed": size * 4 + "," + size * 4, - "dotted": size + "," + size * 2, - "dotdash": size + "," + size * 2 + "," + size * 4 + "," + size * 2, - "longdash": size * 8 + "," + size * 4, - "twodash": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, - "22": size * 2 + "," + size * 2, - "42": size * 4 + "," + size * 2, - "44": size * 4 + "," + size * 4,"13": size + "," + size * 3, - "1343": size + "," + size * 3 + "," + size * 4 + "," + size * 3, - "73": size * 7 + "," + size * 3, - "2262": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, - "12223242": size + "," + size * 2 + "," + size * 2 + "," + size * 2 + "," + size * 3 + "," + size * 2 + "," + size * 4 + "," + size * 2, - "F282": size * 15 + "," + size * 2 + "," + size * 8 + "," + size * 2, - "F4448444": size * 15 + "," + size * 4 + "," + size * 4 + "," + size * 4 + "," + size * 8 + "," + size * 4 + "," + size * 4 + "," + size * 4, - "224282F2": size * 2 + "," + size * 2 + "," + size * 4 + "," + size * 2 + "," + size * 8 + "," + size * 2 + "," + size * 16 + "," + size * 2, - "F1": size * 16 + "," + size - }; - } - - if (lt in o){ - return o[lt]; - } else{ // manually specified line types - str = lt.split(""); - strnum = str.map(function (d) { - return size * parseInt(d, 16); - }); - return strnum; - } - }; - - var isArray = function(o) { - return Object.prototype.toString.call(o) === '[object Array]'; - }; - - // create a dummy element, apply the appropriate classes, - // and then measure the element - // Inspired from http://jsfiddle.net/uzddx/2/ - var measureText = function(pText, pFontSize, pAngle, pStyle) { - if (!pText || pText.length === 0) return {height: 0, width: 0}; - if (pAngle === null || isNaN(pAngle)) pAngle = 0; - - var container = element.append('svg'); - // do we need to set the class so that styling is applied? - //.attr('class', classname); - - container.append('text') - .attr({x: -1000, y: -1000}) - .attr("transform", "rotate(" + pAngle + ")") - .attr("style", pStyle) - .attr("font-size", pFontSize) - .text(pText); - - var bbox = container.node().getBBox(); - container.remove(); - - return {height: bbox.height, width: bbox.width}; - }; - - var nest_by_group = d3.nest().key(function(d){ return d.group; }); - var dirs = json_file.split("/"); - dirs.pop(); //if a directory path exists, remove the JSON file from dirs - var element = d3.select(to_select); - this.element = element; - var viz_id = element.attr("id"); - var Widgets = {}; - this.Widgets = Widgets; - var Selectors = {}; - this.Selectors = Selectors; - var Plots = {}; - this.Plots = Plots; - var Geoms = {}; - this.Geoms = Geoms; - // SVGs must be stored separately from Geoms since they are - // initialized first, with the Plots. - var SVGs = {}; - this.SVGs = SVGs; - var Animation = {}; - this.Animation = Animation; - var all_geom_names = {}; - this.all_geom_names = all_geom_names; - - //creating an array to contain the selectize widgets - var selectized_array = []; - var data_object_geoms = { - "line":true, - "path":true, - "ribbon":true, - "polygon":true - }; - var css = document.createElement('style'); - css.type = 'text/css'; - var styles = [".axis path{fill: none;stroke: black;shape-rendering: crispEdges;}", - ".axis line{fill: none;stroke: black;shape-rendering: crispEdges;}", - ".axis text {font-family: sans-serif;font-size: 11px;}"]; - - var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; - // Determine if data will be an object or an array. - if(g_info.geom in data_object_geoms){ - g_info.data_is_object = true; - }else{ - g_info.data_is_object = false; - } - // Add a row to the loading table. - g_info.tr = Widgets["loading"].append("tr"); - g_info.tr.append("td").text(g_name); - g_info.tr.append("td").attr("class", "chunk"); - g_info.tr.append("td").attr("class", "downloaded").text(0); - g_info.tr.append("td").text(g_info.total); - g_info.tr.append("td").attr("class", "status").text("initialized"); - - // load chunk tsv - g_info.data = {}; - g_info.download_status = {}; - Geoms[g_name] = g_info; - // Determine whether common chunk tsv exists - // If yes, load it - if(g_info.hasOwnProperty("columns") && g_info.columns.common){ - var common_tsv = get_tsv(g_info, "_common"); - g_info.common_tsv = common_tsv; - var common_path = getTSVpath(common_tsv); - d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); - }); - } else { - g_info.common_tsv = null; - } - // Save this geom and load it! - update_geom(g_name, null); - }; - var add_plot = function (p_name, p_info) { - // Each plot may have one or more legends. To make space for the - // legends, we put each plot in a table with one row and two - // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); - var plot_tr = plot_table.append("tr"); - var tdLeft = plot_tr.append("td"); - var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); - if(viz_id === null){ - p_info.plot_id = p_name; - }else{ - p_info.plot_id = viz_id + "_" + p_name; - } - var svg = tdLeft.append("svg") - .attr("id", p_info.plot_id) - .attr("height", p_info.options.height) - .attr("width", p_info.options.width); - - // divvy up width/height based on the panel layout - var nrows = Math.max.apply(null, p_info.layout.ROW); - var ncols = Math.max.apply(null, p_info.layout.COL); - var panel_names = p_info.layout.PANEL; - var npanels = Math.max.apply(null, panel_names); - - // Note axis names are "shared" across panels (just like the title) - var xtitlepadding = 5 + measureText(p_info["xtitle"], default_axis_px).height; - var ytitlepadding = 5 + measureText(p_info["ytitle"], default_axis_px).height; - - // 'margins' are fixed across panels and do not - // include title/axis/label padding (since these are not - // fixed across panels). They do, however, account for - // spacing between panels - var text_height_pixels = measureText("foo", 11).height; - var margin = { - left: 0, - right: text_height_pixels * p_info.panel_margin_lines, - top: text_height_pixels * p_info.panel_margin_lines, - bottom: 0 - }; - var plotdim = { - width: 0, - height: 0, - xstart: 0, - xend: 0, - ystart: 0, - yend: 0, - graph: { - width: 0, - height: 0 - }, - margin: margin, - xlab: { - x: 0, - y: 0 - }, - ylab: { - x: 0, - y: 0 - }, - title: { - x: 0, - y: 0 - } - }; - - // Draw the title - var titlepadding = measureText(p_info.title, p_info.title_size).height; - // why are we giving the title padding if it is undefined? - if (p_info.title === undefined) titlepadding = 0; - plotdim.title.x = p_info.options.width / 2; - plotdim.title.y = titlepadding; - svg.append("text") - .text(p_info.title) - .attr("class", "plottitle") - .attr("font-family", "sans-serif") - .attr("font-size", p_info.title_size) - .attr("transform", "translate(" + plotdim.title.x + "," + - plotdim.title.y + ")") - .style("text-anchor", "middle"); - - // grab max text size over axis labels and facet strip labels - var axispaddingy = 5; - if(p_info.hasOwnProperty("ylabs") && p_info.ylabs.length){ - axispaddingy += Math.max.apply(null, p_info.ylabs.map(function(entry){ - // + 5 to give a little extra space to avoid bad axis labels - // in shiny. - return measureText(entry, p_info.ysize).width + 5; - })); - } - var axispaddingx = 10 + 20; - if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ - // TODO: throw warning if text height is large portion of plot height? - axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ - return measureText(entry, p_info.xsize, p_info.xangle).height; - })); - // TODO: carefully calculating this gets complicated with rotating xlabs - //margin.right += 5; - } - plotdim.margin = margin; - - var strip_heights = p_info.strips.top.map(function(entry){ - return measureText(entry, p_info.strip_text_xsize).height; - }); - var strip_widths = p_info.strips.right.map(function(entry){ - return measureText(entry, p_info.strip_text_ysize).height; - }); - - // compute the number of x/y axes, max strip height per row, and - // max strip width per columns, for calculating height/width of - // graphing region. - var row_strip_heights = []; - var col_strip_widths = []; - var n_xaxes = 0; - var n_yaxes = 0; - var current_row, current_col; - for (var layout_i = 0; layout_i < npanels; layout_i++) { - current_row = p_info.layout.ROW[layout_i] - 1; - current_col = p_info.layout.COL[layout_i] - 1; - if(row_strip_heights[current_row] === undefined){ - row_strip_heights[current_row] = []; - } - if(col_strip_widths[current_col] === undefined){ - col_strip_widths[current_col] = []; - } - row_strip_heights[current_row].push(strip_heights[layout_i]); - col_strip_widths[current_col].push(strip_widths[layout_i]); - if (p_info.layout.COL[layout_i] == 1) { - n_xaxes += p_info.layout.AXIS_X[layout_i]; - } - if (p_info.layout.ROW[layout_i] == 1) { - n_yaxes += p_info.layout.AXIS_Y[layout_i]; - } - } - function cumsum_array(array_of_arrays){ - var cumsum = [], max_value, cumsum_value = 0; - for(var i=0; i 1) { - background.append("rect") - .attr("x", plotdim.xstart) - .attr("y", plotdim.ystart) - .attr("width", plotdim.xend - plotdim.xstart) - .attr("height", plotdim.yend - plotdim.ystart) - .attr("class", "background_rect") - .style("fill", p_info.panel_background.fill) - .style("stroke", p_info.panel_background.colour) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(p_info.panel_background.linetype, - p_info.panel_background.size); - }); - } - - // drawing the grid lines - ["grid_minor", "grid_major"].forEach(function(grid_class){ - var grid_background = p_info[grid_class]; - // if grid lines are defined - if(grid_background.hasOwnProperty("size")) { - var grid = background.append("g") - .attr("class", grid_class); - ["x","y"].forEach(function(scale_var){ - var const_var; - if(scale_var == "x"){ - const_var = "y"; - }else{ - const_var = "x"; - } - grid.append("g") - .attr("class", scale_var) - .selectAll("line") - .data(grid_background.loc[scale_var][layout_i]) - .enter() - .append("line") - .attr(const_var + "1", plotdim[const_var + "start"]) - .attr(const_var + "2", plotdim[const_var + "end"]) - .attr(scale_var + "1", function(d) { - return scales[panel_i][scale_var](d); - }) - .attr(scale_var + "2", function(d) { - return scales[panel_i][scale_var](d); - }) - .style("stroke", grid_background.colour) - .style("stroke-linecap", grid_background.lineend) - .style("stroke-width", grid_background.size) - .style("stroke-dasharray", linetypesize2dasharray( - grid_background.linetype, grid_background.size)) - ; - }); - } - }); - - // drawing border - // uses insert to draw it right before the #plottitle - if(Object.keys(p_info.panel_border).length > 1) { - background.append("rect") - .attr("x", plotdim.xstart) - .attr("y", plotdim.ystart) - .attr("width", plotdim.xend - plotdim.xstart) - .attr("height", plotdim.yend - plotdim.ystart) - .attr("class", "border_rect") - .style("fill", p_info.panel_border.fill) - .style("stroke", p_info.panel_border.colour) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(p_info.panel_border.linetype, - p_info.panel_border.size); - }); - } - - } //end of for(layout_i - // After drawing all backgrounds, we can draw the axis labels. - if(p_info["ytitle"]){ - svg.append("text") - .text(p_info["ytitle"]) - .attr("class", "ytitle") - .style("text-anchor", "middle") - .style("font-size", default_axis_px + "px") - .attr("transform", "translate(" + - ytitle_x + - "," + - (ytitle_top + ytitle_bottom)/2 + - ")rotate(270)") - ; - } - if(p_info["xtitle"]){ - svg.append("text") - .text(p_info["xtitle"]) - .attr("class", "xtitle") - .style("text-anchor", "middle") - .style("font-size", default_axis_px + "px") - .attr("transform", "translate(" + - (xtitle_left + xtitle_right)/2 + - "," + - xtitle_y + - ")") - ; - } - Plots[p_name].scales = scales; - }; //end of add_plot() - - function update_legend_opacity(v_name){ - var s_info = Selectors[v_name]; - s_info.legend_tds.style("opacity", s_info.legend_update_fun); - } - - var add_selector = function (s_name, s_info) { - Selectors[s_name] = s_info; - if(s_info.type == "multiple"){ - if(!isArray(s_info.selected)){ - s_info.selected = [s_info.selected]; - } - // legend_update_fun is evaluated in the context of the - // td.legend_entry_label. - s_info.legend_update_fun = function(d){ - var i_value = s_info.selected.indexOf(this.textContent); - if(i_value == -1){ - return 0.5; - }else{ - return 1; - } - } - }else{ - s_info.legend_update_fun = function(d){ - if(this.textContent == s_info.selected){ - return 1; - }else{ - return 0.5; - } - } - } - s_info.legend_tds = - element.selectAll("tr."+legend_class_name(s_name)+" td.legend_entry_label") - ; - update_legend_opacity(s_name); - }; //end of add_selector() - - function get_tsv(g_info, chunk_id){ - return g_info.classed + "_chunk" + chunk_id + ".tsv"; - } - function getTSVpath(tsv_name){ - return dirs.concat(tsv_name).join("/"); - } - - /** - * copy common chunk tsv to varied chunk tsv, returning an array of - * objects. - */ - function copy_chunk(g_info, varied_chunk) { - var varied_by_group = nest_by_group.map(varied_chunk); - var common_by_group = g_info.data[g_info.common_tsv]; - var new_varied_chunk = []; - for(group_id in varied_by_group){ - var varied_one_group = varied_by_group[group_id]; - var common_one_group = common_by_group[group_id]; - var common_i = 0; - for(var varied_i=0; varied_i < varied_one_group.length; varied_i++){ - // there are two cases: each group of varied data is of length - // 1, or of length of the common data. - if(common_one_group.length == varied_one_group.length){ - common_i = varied_i; - } - var varied_obj = varied_one_group[varied_i]; - var common_obj = common_one_group[common_i]; - for(col in common_obj){ - if(col != "group"){ - varied_obj[col] = common_obj[col]; - } - } - new_varied_chunk.push(varied_obj); - } - } - return new_varied_chunk; - } - - // update_geom is called from add_geom and update_selector. It - // downloads data if necessary, and then calls draw_geom. - var update_geom = function (g_name, selector_name) { - var g_info = Geoms[g_name]; - // First apply chunk_order selector variables. - var chunk_id = g_info.chunks; - g_info.chunk_order.forEach(function (v_name) { - if(chunk_id == null){ - return; // no data in a higher up chunk var. - } - var value = Selectors[v_name].selected; - if(chunk_id.hasOwnProperty(value)){ - chunk_id = chunk_id[value]; - }else{ - chunk_id = null; // no data to show in this subset. - } - }); - if(chunk_id == null){ - draw_panels(g_info, [], selector_name); //draw nothing. - return; - } - var tsv_name = get_tsv(g_info, chunk_id); - // get the data if it has not yet been downloaded. - g_info.tr.select("td.chunk").text(tsv_name); - if(g_info.data.hasOwnProperty(tsv_name)){ - draw_panels(g_info, g_info.data[tsv_name], selector_name); - }else{ - g_info.tr.select("td.status").text("downloading"); - var svg = SVGs[g_name]; - var loading = svg.append("text") - .attr("class", "loading"+tsv_name) - .text("Downloading "+tsv_name+"...") - .attr("font-size", 9) - //.attr("x", svg.attr("width")/2) - .attr("y", 10) - .style("fill", "red"); - download_chunk(g_info, tsv_name, function(chunk){ - loading.remove(); - draw_panels(g_info, chunk, selector_name); - }); - } - }; - var draw_panels = function(g_info, chunk, selector_name) { - // derive the plot name from the geometry name - var g_names = g_info.classed.split("_"); - var p_name = g_names[g_names.length - 1]; - var panels = Plots[p_name].layout.PANEL; - panels.forEach(function(panel) { - draw_geom(g_info, chunk, selector_name, panel); - }); - }; - - function download_next(g_name){ - var g_info = Geoms[g_name]; - var selector_value = Animation.sequence[g_info.seq_i]; - var chunk_id = g_info.chunks[selector_value]; - var tsv_name = get_tsv(g_info, chunk_id); - g_info.seq_count += 1; - if(Animation.sequence.length == g_info.seq_count){ - Animation.done_geoms[g_name] = 1; - return; - } - g_info.seq_i += 1; - if(g_info.seq_i == Animation.sequence.length){ - g_info.seq_i = 0; - } - if(typeof(chunk_id) == "string"){ - download_chunk(g_info, tsv_name, function(chunk){ - download_next(g_name); - }) - }else{ - download_next(g_name); - } - } - - // download_chunk is called from update_geom and download_next. - function download_chunk(g_info, tsv_name, funAfter){ - if(g_info.download_status.hasOwnProperty(tsv_name)){ - var chunk; - if(g_info.data_is_object){ - chunk = {}; - }else{ - chunk = []; - } - funAfter(chunk); - return; // do not download twice. - } - g_info.download_status[tsv_name] = "downloading"; - // prefix tsv file with appropriate path - var tsv_file = getTSVpath(tsv_name); - d3.tsv(tsv_file, function (error, response) { - // First convert to correct types. - g_info.download_status[tsv_name] = "processing"; - response = convert_R_types(response, g_info.types); - wait_until_then(500, function(){ - if(g_info.common_tsv) { - return g_info.data.hasOwnProperty(g_info.common_tsv); - }else{ - return true; - } - }, function(){ - if(g_info.common_tsv) { - // copy data from common tsv to varied tsv - response = copy_chunk(g_info, response); - } - var nest = d3.nest(); - g_info.nest_order.forEach(function (v_name) { - nest.key(function (d) { - return d[v_name]; - }); - }); - var chunk = nest.map(response); - g_info.data[tsv_name] = chunk; - g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); - g_info.download_status[tsv_name] = "saved"; - funAfter(chunk); - }); - }); - }//download_chunk. - - // update_geom is responsible for obtaining a chunk of downloaded - // data, and then calling draw_geom to actually draw it. - var draw_geom = function(g_info, chunk, selector_name, PANEL){ - g_info.tr.select("td.status").text("displayed"); - var svg = SVGs[g_info.classed]; - // derive the plot name from the geometry name - var g_names = g_info.classed.split("_"); - var p_name = g_names[g_names.length - 1]; - var scales = Plots[p_name].scales[PANEL]; - var selected_arrays = [ [] ]; //double array necessary. - var has_clickSelects = g_info.aes.hasOwnProperty("clickSelects"); - var has_clickSelects_variable = - g_info.aes.hasOwnProperty("clickSelects.variable"); - g_info.subset_order.forEach(function (aes_name) { - var selected, values; - var new_arrays = []; - if(0 < aes_name.indexOf(".variable")){ - selected_arrays.forEach(function(old_array){ - var some_data = chunk; - old_array.forEach(function(value){ - if(some_data.hasOwnProperty(value)) { - some_data = some_data[value]; - } else { - some_data = {}; - } - }) - values = d3.keys(some_data); - values.forEach(function(s_name){ - var selected = Selectors[s_name].selected; - var new_array = old_array.concat(s_name).concat(selected); - new_arrays.push(new_array); - }) - }) - }else{//not .variable aes: - if(aes_name == "PANEL"){ - selected = PANEL; - }else{ - var s_name = g_info.aes[aes_name]; - selected = Selectors[s_name].selected; - } - if(isArray(selected)){ - values = selected; //multiple selection. - }else{ - values = [selected]; //single selection. - } - values.forEach(function(value){ - selected_arrays.forEach(function(old_array){ - var new_array = old_array.concat(value); - new_arrays.push(new_array); - }) - }) - } - selected_arrays = new_arrays; - }); - // data can be either an array[] if it will be directly involved - // in a data-bind, or an object{} if it will be involved in a - // data-bind by group (e.g. geom_line). - var data; - if(g_info.data_is_object){ - data = {}; - }else{ - data = []; - } - selected_arrays.forEach(function(value_array){ - var some_data = chunk; - value_array.forEach(function(value){ - if (some_data.hasOwnProperty(value)) { - some_data = some_data[value]; - } else { - if(g_info.data_is_object){ - some_data = {}; - }else{ - some_data = []; - } - } - }); - if(g_info.data_is_object){ - if(isArray(some_data) && some_data.length){ - data["0"] = some_data; - }else{ - for(k in some_data){ - data[k] = some_data[k]; - } - } - }else{//some_data is an array. - data = data.concat(some_data); - } - }); - var aes = g_info.aes; - var toXY = function (xy, a) { - return function (d) { - return scales[xy](d[a]); - }; - }; - var layer_g_element = svg.select("g." + g_info.classed); - var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); - var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; - }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; - }; - var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; - } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; - - // stroke_width for geom_point - var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; - } - - var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; - } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } - return linetypesize2dasharray(lt, get_size(d)); - }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; - } - const get_angle = function(d) { - // x and y are the coordinates to rotate around, we choose the center - // point of the text because otherwise it will rotate around (0,0) of its - // coordinate system, which is the top left of the plot - x = scales["x"](d["x"]); - y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } - // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so - // we negate the angle. - return `rotate(${-angle}, ${x}, ${y})`; - }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - - // For aes(hjust) the compiler should make an "anchor" column. - var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } - var get_text_anchor; - if(g_info.aes.hasOwnProperty("hjust")) { - get_text_anchor = function(d){ - return d["anchor"]; - } - }else{ - get_text_anchor = function(d){ - return text_anchor; - } - } - - var eActions, eAppend, linkActions; - var key_fun = null; - var id_fun = function(d){ - return d.id; - }; - if(g_info.aes.hasOwnProperty("key")){ - key_fun = function(d){ - return d.key; - }; - } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; - if(g_info.data_is_object) { - - // Lines, paths, polygons, and ribbons are a bit special. For - // every unique value of the group variable, we take the - // corresponding data rows and make 1 path. The tricky part is - // that to use d3 I do a data-bind of some "fake" data which are - // just group ids, which is the kv variable in the code below - - // // case of only 1 line and no groups. - // if(!aes.hasOwnProperty("group")){ - // kv = [{"key":0,"value":0}]; - // data = {0:data}; - // }else{ - // // we need to use a path for each group. - // var kv = d3.entries(d3.keys(data)); - // kv = kv.map(function(d){ - // d[aes.group] = d.value; - // return d; - // }); - // } - - // For an example consider breakpointError$error which is - // defined using this R code - - // geom_line(aes(segments, error, group=bases.per.probe, - // clickSelects=bases.per.probe), data=only.error, lwd=4) - - // Inside update_geom the variables take the following values - // (pseudo-Javascript code) - - // var kv = [{"key":"0","value":"133","bases.per.probe":"133"}, - // {"key":"1","value":"2667","bases.per.probe":"2667"}]; - // var data = {"133":[array of 20 points used to draw the line for group 133], - // "2667":[array of 20 points used to draw the line for group 2667]}; - - // I do elements.data(kv) so that when I set the d attribute of - // each path, I need to select the correct group before - // returning anything. - - // e.attr("d",function(group_info){ - // var one_group = data[group_info.value]; - // return lineThing(one_group); - // }) - - // To make color work I think you just have to select the group - // and take the color of the first element, e.g. - - // .style("stroke",function(group_info){ - // var one_group = data[group_info.value]; - // var one_row = one_group[0]; - // return get_color(one_row); - // } - - // In order to get d3 lines to play nice, bind fake "data" (group - // id's) -- the kv variable. Then each separate object is plotted - // using path (case of only 1 thing and no groups). - - // we need to use a path for each group. - var keyed_data = {}, one_group, group_id, k; - for(group_id in data){ - one_group = data[group_id]; - one_row = one_group[0]; - if(one_row.hasOwnProperty("key")){ - k = one_row.key; - }else{ - k = group_id; - } - keyed_data[k] = one_group; - } - var kv_array = d3.entries(d3.keys(keyed_data)); - var kv = kv_array.map(function (d) { - //d[aes.group] = d.value; - - // Need to store the clickSelects value that will - // be passed to the selector when we click on this - // item. - d.clickSelects = keyed_data[d.value][0].clickSelects; - return d; - }); - - // line, path, and polygon use d3.svg.line(), - // ribbon uses d3.svg.area() - // we have to define lineThing accordingly. - if (g_info.geom == "ribbon") { - var lineThing = d3.svg.area() - .x(toXY("x", "x")) - .y(toXY("y", "ymax")) - .y0(toXY("y", "ymin")); - } else { - var lineThing = d3.svg.line() - .x(toXY("x", "x")) - .y(toXY("y", "y")); - } - // select the correct group before returning anything. - key_fun = function(group_info){ - return group_info.value; - }; - id_fun = function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; - }; - eActions = function (e) { - e.attr("d", function (d) { - var one_group = keyed_data[d.value]; - // filter NaN since they make the whole line disappear! - var no_na = one_group.filter(function(d){ - if(g_info.geom == "ribbon"){ - return !isNaN(d.x) && !isNaN(d.ymin) && !isNaN(d.ymax); - }else{ - return !isNaN(d.x) && !isNaN(d.y); - } - }); - return lineThing(no_na); - }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } - }; - eAppend = "path"; - }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; - } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; - } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - } - elements.exit().remove(); - var enter = elements.enter(); - if(g_info.aes.hasOwnProperty("href")){ - enter = enter.append("svg:a") - .append("svg:"+eAppend); - }else{ - enter = enter.append(eAppend) - .attr("class", "geom"); - } - if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; - elements.call(out_fun) - .on("mouseover", function (d) { - d3.select(this).call(over_fun); - }) - .on("mouseout", function (d) { - d3.select(this).call(out_fun); - }) - ; - if(has_clickSelects){ - elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. - var s_name = g_info.aes.clickSelects; - update_selector(s_name, d.clickSelects); - }); - }else{ - elements.on("click", function(d){ - var s_name = d["clickSelects.variable"]; - var s_value = d["clickSelects.value"]; - update_selector(s_name, s_value); - }); - } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } - } - var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); - if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } - if(has_tooltip){ - text_fun = function(d){ - return d.tooltip; - }; - }else if(has_clickSelects){ - text_fun = function(d){ - var v_name = g_info.aes.clickSelects; - return v_name + " " + d.clickSelects; - }; - }else{ //clickSelects_variable - text_fun = function(d){ - return d["clickSelects.variable"] + " " + d["clickSelects.value"]; - }; - } - // if elements have an existing title, remove it. - elements.selectAll("title").remove(); - elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) - ; - } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! - if(Selectors.hasOwnProperty(selector_name)){ - var milliseconds = Selectors[selector_name].duration; - elements = elements.transition().duration(milliseconds); - } - if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); - } - if(g_info.aes.hasOwnProperty("href")){ - // elements are , children are e.g. - var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); - }else{ - // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) - } - }; - - - - var value_tostring = function(selected_values) { - //function that is helpful to change the format of the string - var selector_url="#" - for (var selc_var in selected_values){ - if(selected_values.hasOwnProperty(selc_var)){ - var values_str=selected_values[selc_var].join(); - var sub_url=selc_var.concat("=","{",values_str,"}"); - selector_url=selector_url.concat(sub_url); - } - } - var url_nohash=window.location.href.match(/(^[^#]*)/)[0]; - selector_url=url_nohash.concat(selector_url); - return selector_url; - }; - - var get_values=function(){ - // function that is useful to get the selected values - var selected_values={} - for(var s_name in Selectors){ - var s_info=Selectors[s_name]; - var initial_selections = []; - if(s_info.type==="single"){ - initial_selections=[s_info.selected]; - } - else{ - for(var i in s_info.selected) { - initial_selections[i] = s_info.selected[i]; - } - } - selected_values[s_name]=initial_selections; - } - return selected_values; - }; - - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - - // update scales for the plots that have update_axes option in - // theme_animint - function update_scales(p_name, axes, v_name, value){ - // Get pre-computed domain - var axis_domains = Plots[p_name]["axis_domains"]; - if(!isArray(axes)){ - axes = [axes]; - } - if(axis_domains != null){ - axes.forEach(function(xyaxis){ - // For Each PANEL, update the axes - Plots[p_name].layout.PANEL.forEach(function(panel_i, i){ - // Determine whether this panel has a scale or not - // If not we just update the scales according to the common - // scale and skip the updating of axis - var draw_axes = Plots[p_name].layout["AXIS_"+ xyaxis.toUpperCase()][i]; - if(draw_axes){ - var use_panel = panel_i; - }else{ - var use_panel = Plots[p_name].layout.PANEL[0]; - } - // We update the current selection of the plot every time - // and use it to index the correct domain - var curr_select = axis_domains[xyaxis].curr_select; - if(axis_domains[xyaxis].selectors.indexOf(v_name) > -1){ - curr_select[v_name] = value; - var str = use_panel+"."; - for(selec in curr_select){ - str = str + curr_select[selec] + "_"; - } - str = str.substring(0, str.length - 1); // Strip off trailing underscore - var use_domain = axis_domains[xyaxis]["domains"][str]; - } - if(use_domain != null){ - Plots[p_name]["scales"][panel_i][xyaxis].domain(use_domain); - var scales = Plots[p_name]["scales"][panel_i][xyaxis]; - // major and minor grid lines as calculated in the compiler - var grid_vals = Plots[p_name]["axis_domains"][xyaxis]["grids"][str]; - - // Once scales are updated, update the axis ticks if needed - if(draw_axes){ - // Tick values are same as major grid lines - update_axes(p_name, xyaxis, panel_i, grid_vals[1]); - } - // Update major and minor grid lines - update_grids(p_name, xyaxis, panel_i, grid_vals, scales); - } - }); - }); - } - } - - // Update the axis ticks etc. once plot is zoomed in/out - // currently called from update_scales. - function update_axes(p_name, axes, panel_i, tick_vals){ - var orientation; - if(axes == "x"){ - orientation = "bottom"; - }else{ - orientation = "left"; - } - if(!isArray(tick_vals)){ - tick_vals = [tick_vals]; - } - var xyaxis = d3.svg.axis() - .scale(Plots[p_name]["scales"][panel_i][axes]) - .orient(orientation) - .tickValues(tick_vals); - // update existing axis - var xyaxis_g = element.select("#plot_"+p_name).select("."+axes+"axis_"+panel_i) - .transition() - .duration(1000) - .call(xyaxis); - } - - // Update major/minor grids once axes ticks have been updated - function update_grids(p_name, axes, panel_i, grid_vals, scales){ - // Select panel to update - var bgr = element.select("#plot_"+p_name).select(".bgr"+panel_i); - // Update major and minor grid lines - ["minor", "major"].forEach(function(grid_class, j){ - var lines = bgr.select(".grid_"+grid_class).select("."+axes); - var xy1, xy2; - if(axes == "x"){ - xy1 = lines.select("line").attr("y1"); - xy2 = lines.select("line").attr("y2"); - }else{ - xy1 = lines.select("line").attr("x1"); - xy2 = lines.select("line").attr("x2"); - } - - // Get default values for grid lines like colour, stroke etc. - var grid_background = Plots[p_name]["grid_"+grid_class]; - var col = grid_background.colour; - var lt = grid_background.linetype; - var size = grid_background.size; - var cap = grid_background.lineend; - - // Remove old lines - lines.selectAll("line") - .remove(); - - if(!isArray(grid_vals[j])){ - grid_vals[j] = [grid_vals[j]]; - } - - if(axes == "x"){ - lines.selectAll("line") - .data(grid_vals[j]) - .enter() - .append("line") - .attr("y1", xy1) - .attr("y2", xy2) - .attr("x1", function(d) { return scales(d); }) - .attr("x2", function(d) { return scales(d); }) - .style("stroke", col) - .style("stroke-linecap", cap) - .style("stroke-width", size) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(lt, size); - }); - }else{ - lines.selectAll("line") - .data(grid_vals[j]) - .enter() - .append("line") - .attr("x1", xy1) - .attr("x2", xy2) - .attr("y1", function(d) { return scales(d); }) - .attr("y2", function(d) { return scales(d); }) - .style("stroke", col) - .style("stroke-linecap", cap) - .style("stroke-width", size) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(lt, size); - }); - } - }); - } - - var update_selector = function (v_name, value) { - if(!Selectors.hasOwnProperty(v_name)){ - return; - } - value = value + ""; - var s_info = Selectors[v_name]; - if(s_info.type == "single"){ - // value is the new selection. - s_info.selected = value; - }else{ - // value should be added or removed from the selection. - var i_value = s_info.selected.indexOf(value); - if(i_value == -1){ - // not found, add to selection. - s_info.selected.push(value); - }else{ - // found, remove from selection. - s_info.selected.splice(i_value, 1); - } - } - // update_selector_url() - // if there are levels, then there is a selectize widget which - // should be updated. - if(isArray(s_info.levels)){ - // the jquery ids - if(s_info.type == "single") { - var selected_ids = v_name.concat("___", value); - } else { - var selected_ids = []; - for(i in s_info.selected) { - selected_ids[i] = v_name.concat("___", s_info.selected[i]); - } - } - // from - // https://github.com/brianreavis/selectize.js/blob/master/docs/api.md: - // setValue(value, silent) If "silent" is truthy, no change - // event will be fired on the original input. - selectized_array[v_name].setValue(selected_ids, true); - } - - // For each updated geom, check if the axes of the plot need to be - // updated and update them - s_info.update.forEach(function(g_name){ - var plot_name = g_name.split("_").pop(); - var axes = Plots[plot_name]["options"]["update_axes"]; - if(axes != null){ - update_scales(plot_name, axes, v_name, value); - } - }); - - update_legend_opacity(v_name); - s_info.update.forEach(function(g_name){ - update_geom(g_name, v_name); - }); - }; - - var ifSelectedElse = function (s_value, s_name, selected, not_selected) { - var is_selected; - var s_info = Selectors[s_name]; - if(s_info.type == "single"){ - is_selected = s_value == s_info.selected; - }else{ - is_selected = s_info.selected.indexOf(s_value) != -1; - } - if(is_selected){ - return selected; - } else { - return not_selected; - } - }; - - function update_next_animation(){ - var values = d3.values(Animation.done_geoms); - if(d3.sum(values) == values.length){ - // If the values in done_geoms are all 1, then we have loaded - // all of the animation-related chunks, and we can start - // playing the animation. - var v_name = Animation.variable; - var cur = Selectors[v_name].selected; - var next = Animation.next[cur]; - update_selector(v_name, next); - } - } - - // The main idea of how legends work: - - // 1. In getLegend in animint.R I export the legend entries as a - // list of rows that can be used in a data() bind in D3. - - // 2. Here in add_legend I create a for every legend, and - // then I bind the legend entries to ,
, and elements. - var add_legend = function(p_name, p_info){ - // case of multiple legends, d3 reads legend structure in as an array - var tdRight = element.select("td."+p_name+"_legend"); - var legendkeys = d3.keys(p_info.legend); - for(var i=0; i-1){ - // aesthetics that would draw a rect - legend_svgs.append("rect") - .attr("x", 2) - .attr("y", 2) - .attr("width", 10) - .attr("height", 10) - .style("stroke-width", function(d){return d["polygonsize"]||1;}) - .style("stroke-dasharray", function(d){ - return linetypesize2dasharray(d["polygonlinetype"], d["size"]||2); - }) - .style("stroke", function(d){return d["polygoncolour"] || "#000000";}) - .style("fill", function(d){return d["polygonfill"] || "#FFFFFF";}) - .style("opacity", function(d){return d["polygonalpha"]||1;}); - } - if(l_info.geoms.indexOf("text")>-1){ - // aesthetics that would draw a rect - legend_svgs.append("text") - .attr("x", 10) - .attr("y", 14) - .style("fill", function(d){return d["textcolour"]||1;}) - .style("text-anchor", "middle") - .attr("font-size", function(d){return d["textsize"]||1;}) - .text("a"); - } - if(l_info.geoms.indexOf("path")>-1){ - // aesthetics that would draw a line - legend_svgs.append("line") - .attr("x1", 1).attr("x2", 19).attr("y1", 7).attr("y2", 7) - .style("stroke-width", function(d){ - return linescale(d["pathsize"])||2; - }) - .style("stroke-dasharray", function(d){ - return linetypesize2dasharray(d["pathlinetype"], d["pathsize"] || 2); - }) - .style("stroke", function(d){return d["pathcolour"] || "#000000";}) - .style("opacity", function(d){return d["pathalpha"]||1;}); - } - if(l_info.geoms.indexOf("point")>-1){ - // aesthetics that would draw a point - legend_svgs.append("circle") - .attr("cx", 10) - .attr("cy", 7) - .attr("r", function(d){return pointscale(d["pointsize"])||4;}) - .style("stroke", function(d){return d["pointcolour"] || "#000000";}) - .style("fill", function(d){ - return d["pointfill"] || d["pointcolour"] || "#000000"; - }) - .style("opacity", function(d){return d["pointalpha"]||1;}); - } - legend_rows.append("td") - .attr("align", "left") // TODO: right for numbers? - .attr("class", "legend_entry_label") - .attr("id", function(d){ return d["id"]+"_label"; }) - .style("font-size", function(d){ return d["text_size"]}) - .text(function(d){ return d["label"];}); - } - } - - // Download the main description of the interactive plot. - d3.json(json_file, function (error, response) { - if(response.hasOwnProperty("title")){ - // This selects the title of the web page, outside of wherever - // the animint is defined, usually a
-- so it is OK to use - // global d3.select here. - d3.select("title").text(response.title); - } - // Add plots. - for (var p_name in response.plots) { - add_plot(p_name, response.plots[p_name]); - add_legend(p_name, response.plots[p_name]); - // Append style sheet to document head. - css.appendChild(document.createTextNode(styles.join(" "))); - document.head.appendChild(css); - } - // Then add selectors and start downloading the first data subset. - for (var s_name in response.selectors) { - add_selector(s_name, response.selectors[s_name]); - } - - // Update the scales/axes of the plots if needed - // We do this so that the plots zoom in initially after loading - for (var p_name in response.plots) { - if(response.plots[p_name].axis_domains !== null){ - for(var xy in response.plots[p_name].axis_domains){ - var selectors = response.plots[p_name].axis_domains[xy].selectors; - if(!isArray(selectors)){ - selectors = [selectors]; - } - update_scales(p_name, xy, selectors[0], - response.selectors[selectors[0]].selected); - } - } - } - - //////////////////////////////////////////// - // Widgets at bottom of page - //////////////////////////////////////////// - element.append("br"); - - // loading table. - var show_hide_table = element.append("button") - .text("Show download status table"); - show_hide_table - .on("click", function(){ - if(this.textContent == "Show download status table"){ - loading.style("display", ""); - show_hide_table.text("Hide download status table"); - }else{ - loading.style("display", "none"); - show_hide_table.text("Show download status table"); - } - }); - var loading = element.append("table") - .style("display", "none"); - Widgets["loading"] = loading; - var tr = loading.append("tr"); - tr.append("th").text("geom"); - tr.append("th").attr("class", "chunk").text("selected chunk"); - tr.append("th").attr("class", "downloaded").text("downloaded"); - tr.append("th").attr("class", "total").text("total"); - tr.append("th").attr("class", "status").text("status"); - - // Add geoms and construct nest operators. - for (var g_name in response.geoms) { - add_geom(g_name, response.geoms[g_name]); - } - - // Animation control widgets. - var show_message = "Show animation controls"; - // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") - .text(show_message) - .attr("id", viz_id + "_show_hide_animation_controls") - .on("click", function(){ - if(this.textContent == show_message){ - time_table.style("display", ""); - show_hide_animation_controls.text("Hide animation controls"); - }else{ - time_table.style("display", "none"); - show_hide_animation_controls.text(show_message); - } - }) - ; - // table of the animint widgets - var time_table = element.append("table") - .style("display", "none"); - var first_tr = time_table.append("tr"); - var first_th = first_tr.append("th"); - // if there's a time variable, add a button to pause the animint - if(response.time){ - Animation.next = {}; - Animation.ms = response.time.ms; - Animation.variable = response.time.variable; - Animation.sequence = response.time.sequence; - Widgets["play_pause"] = first_th.append("button") - .text("Play") - .attr("id", "play_pause") - .on("click", function(){ - if(this.textContent == "Play"){ - Animation.play(); - }else{ - Animation.pause(false); - } - }) - ; - } - first_tr.append("th").text("milliseconds"); - if(response.time){ - var second_tr = time_table.append("tr"); - second_tr.append("td").text("updates"); - second_tr.append("td").append("input") - .attr("id", "updates_ms") - .attr("type", "text") - .attr("value", Animation.ms) - .on("change", function(){ - Animation.pause(false); - Animation.ms = this.value; - Animation.play(); - }) - ; - } - for(s_name in Selectors){ - var s_info = Selectors[s_name]; - if(!s_info.hasOwnProperty("duration")){ - s_info.duration = 0; - } - } - var selector_array = d3.keys(Selectors); - var duration_rows = time_table.selectAll("tr.duration") - .data(selector_array) - .enter() - .append("tr"); - duration_rows - .append("td") - .text(function(s_name){return s_name;}); - var duration_tds = duration_rows.append("td"); - var duration_inputs = duration_tds - .append("input") - .attr("id", function(s_name){ - return viz_id + "_duration_ms_" + s_name; - }) - .attr("type", "text") - .on("change", function(s_name){ - Selectors[s_name].duration = this.value; - }) - .attr("value", function(s_name){ - return Selectors[s_name].duration; - }); - // selector widgets - var toggle_message = "Show selection menus"; - var show_or_hide_fun = function(){ - if(this.textContent == toggle_message){ - selector_table.style("display", ""); - show_hide_selector_widgets.text("Hide selection menus"); - d3.select(".urltable").style("display","") - }else{ - selector_table.style("display", "none"); - show_hide_selector_widgets.text(toggle_message); - d3.select(".urltable").style("display","none") - } - } - var show_hide_selector_widgets = element.append("button") - .text(toggle_message) - .attr("class", "show_hide_selector_widgets") - .on("click", show_or_hide_fun) - ; - // adding a table for selector widgets - var selector_table = element.append("table") - .style("display", "none") - .attr("class", "table_selector_widgets") - ; - var selector_first_tr = selector_table.append("tr"); - selector_first_tr - .append("th") - .text("Variable") - ; - selector_first_tr - .append("th") - .text("Selected value(s)") - ; - - // looping through and adding a row for each selector - for(s_name in Selectors) { - var s_info = Selectors[s_name]; - // for .variable .value selectors, levels is undefined and we do - // not want to make a selectize widget. - - // TODO: why does it take so long to initialize the selectize - // widget when there are many (>1000) values? - if(isArray(s_info.levels)){ - // If there were no geoms that specified clickSelects for this - // selector, then there is no way to select it other than the - // selectize widgets (and possibly legends). So in this case - // we show the selectize widgets by default. - var selector_widgets_hidden = - show_hide_selector_widgets.text() == toggle_message; - var has_no_clickSelects = - !Selectors[s_name].hasOwnProperty("clickSelects") - var has_no_legend = - !Selectors[s_name].hasOwnProperty("legend") - if(selector_widgets_hidden && has_no_clickSelects && has_no_legend){ - var node = show_hide_selector_widgets.node(); - show_or_hide_fun.apply(node); - } - // removing "." from name so it can be used in ids - var s_name_id = legend_class_name(s_name); - - // adding a row for each selector - var selector_widget_row = selector_table - .append("tr") - .attr("class", function() { return s_name_id + "_selector_widget"; }) - ; - selector_widget_row.append("td").text(s_name); - // adding the selector - var selector_widget_select = selector_widget_row - .append("td") - .append("select") - .attr("class", function() { return s_name_id + "_input"; }) - .attr("placeholder", function() { return "Toggle " + s_name; }); - // adding an option for each level of the variable - selector_widget_select.selectAll("option") - .data(s_info.levels) - .enter() - .append("option") - .attr("value", function(d) { return d; }) - .text(function(d) { return d; }); - // making sure that the first option is blank - selector_widget_select - .insert("option") - .attr("value", "") - .text(function() { return "Toggle " + s_name; }); - - // calling selectize - var selectize_selector = to_select + ' .' + s_name_id + "_input"; - if(s_info.type == "single") { - // setting up array of selector and options - var selector_values = []; - for(i in s_info.levels) { - selector_values[i] = { - id: s_name.concat("___", s_info.levels[i]), - text: s_info.levels[i] - }; - } - // the id of the first selector - var selected_id = s_name.concat("___", s_info.selected); - - // if single selection, only allow one item - var $temp = $(selectize_selector) - .selectize({ - create: false, - valueField: 'id', - labelField: 'text', - searchField: ['text'], - options: selector_values, - items: [selected_id], - maxItems: 1, - allowEmptyOption: true, - onChange: function(value) { - // extracting the name and the level to update - var selector_name = value.split("___")[0]; - var selected_level = value.split("___")[1]; - // updating the selector - update_selector(selector_name, selected_level); - } - }) - ; - } else { // multiple selection: - // setting up array of selector and options - var selector_values = []; - if(typeof s_info.levels == "object") { - for(i in s_info.levels) { - selector_values[i] = { - id: s_name.concat("___", s_info.levels[i]), - text: s_info.levels[i] - }; - } - } else { - selector_values[0] = { - id: s_name.concat("___", s_info.levels), - text: s_info.levels - }; - } - // setting up an array to contain the initally selected elements - var initial_selections = []; - for(i in s_info.selected) { - initial_selections[i] = s_name.concat("___", s_info.selected[i]); - } - - // construct the selectize - var $temp = $(selectize_selector) - .selectize({ - create: false, - valueField: 'id', - labelField: 'text', - searchField: ['text'], - options: selector_values, - items: initial_selections, - maxItems: s_info.levels.length, - allowEmptyOption: true, - onChange: function(value) { - // if nothing is selected, remove what is currently selected - if(value == null) { - // extracting the selector ids from the options - var the_ids = Object.keys($(this)[0].options); - // the name of the appropriate selector - var selector_name = the_ids[0].split("___")[0]; - // the previously selected elements - var old_selections = Selectors[selector_name].selected; - // updating the selector for each of the old selections - old_selections.forEach(function(element) { - update_selector(selector_name, element); - }); - } else { // value is not null: - // grabbing the name of the selector from the selected value - var selector_name = value[0].split("___")[0]; - // identifying the levels that should be selected - var specified_levels = []; - for(i in value) { - specified_levels[i] = value[i].split("___")[1]; - } - // the previously selected entries - old_selections = Selectors[selector_name].selected; - - // the levels that need to have selections turned on - specified_levels - .filter(function(n) { - return old_selections.indexOf(n) == -1; - }) - .forEach(function(element) { - update_selector(selector_name, element); - }) - ; - // the levels that need to be turned off - // - same approach - old_selections - .filter(function(n) { - return specified_levels.indexOf(n) == -1; - }) - .forEach(function(element) { - update_selector(selector_name, element); - }) - ; - }//value==null - }//onChange - })//selectize - ; - }//single or multiple selection. - selectized_array[s_name] = $temp[0].selectize; - }//levels, is.variable.value - } // close for loop through selector widgets - // If this is an animation, then start downloading all the rest of - // the data, and start the animation. - if (response.time) { - var i, prev, cur; - for (var i = 0; i < Animation.sequence.length; i++) { - if (i == 0) { - prev = Animation.sequence[Animation.sequence.length-1]; - } else { - prev = Animation.sequence[i - 1]; - } - cur = Animation.sequence[i]; - Animation.next[prev] = cur; - } - Animation.timer = null; - Animation.play = function(){ - if(Animation.timer == null){ // only play if not already playing. - // as shown on http://bl.ocks.org/mbostock/3808234 - Animation.timer = setInterval(update_next_animation, Animation.ms); - Widgets["play_pause"].text("Pause"); - } - }; - Animation.play_after_visible = false; - Animation.pause = function(play_after_visible){ - Animation.play_after_visible = play_after_visible; - clearInterval(Animation.timer); - Animation.timer = null; - Widgets["play_pause"].text("Play"); - }; - var s_info = Selectors[Animation.variable]; - Animation.done_geoms = {}; - s_info.update.forEach(function(g_name){ - var g_info = Geoms[g_name]; - if(g_info.chunk_order.length == 1 && - g_info.chunk_order[0] == Animation.variable){ - g_info.seq_i = Animation.sequence.indexOf(s_info.selected); - g_info.seq_count = 0; - Animation.done_geoms[g_name] = 0; - download_next(g_name); - } - }); - Animation.play(); - all_geom_names = d3.keys(response.geoms); - - // This code starts/stops the animation timer when the page is - // hidden, inspired by - // http://stackoverflow.com/questions/1060008 - function onchange (evt) { - if(document.visibilityState == "visible"){ - if(Animation.play_after_visible){ - Animation.play(); - } - }else{ - if(Widgets["play_pause"].text() == "Pause"){ - Animation.pause(true); - } - } - }; - document.addEventListener("visibilitychange", onchange); - } - // update_selector_url() - var check_func=function(){ - var status_array = $('.status').map(function(){ - return $.trim($(this).text()); - }).get(); - status_array=status_array.slice(1) - return status_array.every(function(elem){ return elem === "displayed"}); - } - if(window.location.hash) { - var fragment=window.location.hash; - fragment=fragment.slice(1); - fragment=decodeURI(fragment) - var frag_array=fragment.split(/(.*?})/); - frag_array=frag_array.filter(function(x){ return x!=""}) - frag_array.forEach(function(selector_string){ - var selector_hash=selector_string.split("="); - var selector_nam=selector_hash[0]; - var selector_values=selector_hash[1]; - var re = /\{(.*?)\}/; - selector_values = re.exec(selector_values)[1]; - var array_values = selector_values.split(','); - if(Selectors.hasOwnProperty(selector_nam)){ - var s_info = Selectors[selector_nam] - if(s_info.type=="single"){//TODO fix - array_values.forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time)Animation.pause(true) - }); - }else{ - var old_selections = Selectors[selector_nam].selected; - // the levels that need to have selections turned on - array_values - .filter(function(n) { - return old_selections.indexOf(n) == -1; - }) - .forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time){ - Animation.pause(true) - } - }); - old_selections - .filter(function(n) { - return array_values.indexOf(n) == -1; - }) - .forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time){ - Animation.pause(true) - } - }); - }//if(single) else multiple selection - }//if(Selectors.hasOwnProperty(selector_nam)) - })//frag_array.forEach - }//if(window.location.hash) - }); -}; - - diff --git a/docs/articles/linkedplots/geom1_point_associationsagain_chunk1.tsv b/docs/articles/linkedplots/geom1_point_associationsagain_chunk1.tsv deleted file mode 100644 index 71fdfac74..000000000 --- a/docs/articles/linkedplots/geom1_point_associationsagain_chunk1.tsv +++ /dev/null @@ -1,301 +0,0 @@ -colour x y key showSelectedlegendcolour clickSelects showSelected1 fill -#A3A500 0.16 4.5 Clifford Clifford Domestic Shorthair 1 #A3A500 -#00BFC4 0.36 3.7 Junebug Junebug Domestic Longhair 1 #00BFC4 -#00B0F6 0.41 0.47 Muffin Muffin Cornish Rex 1 #00B0F6 -#E76BF3 0.47 5.1 Teddy Bear Teddy Bear Domestic Shorthair 1 #E76BF3 -#39B600 0.61 9.6 Diana Diana Domestic Shorthair 1 #39B600 -#D89000 0.71 1.9 Bello Bello Domestic Shorthair 1 #D89000 -#00BF7D 0.71 4.9 Jellybean Jellybean Siamese 1 #00BF7D -#F8766D 0.72 9.1 Archibald Archibald Maine Coon 1 #F8766D -#9590FF 0.76 2.3 Saturday Saturday Domestic Longhair 1 #9590FF -#FF62BC 0.86 5.9 Wilbur Wilbur Domestic Shorthair 1 #FF62BC -#A3A500 1.2 8.2 Clifford Clifford Domestic Shorthair 2 #A3A500 -#00BFC4 1.3 2.6 Junebug Junebug Domestic Longhair 2 #00BFC4 -#00B0F6 1.3 5.1 Muffin Muffin Cornish Rex 2 #00B0F6 -#E76BF3 1.6 3.2 Teddy Bear Teddy Bear Domestic Shorthair 2 #E76BF3 -#39B600 1.7 2.6 Diana Diana Domestic Shorthair 2 #39B600 -#D89000 1.9 5.3 Bello Bello Domestic Shorthair 2 #D89000 -#00BF7D 2 8.8 Jellybean Jellybean Siamese 2 #00BF7D -#F8766D 2.1 2.6 Archibald Archibald Maine Coon 2 #F8766D -#9590FF 2.2 4.4 Saturday Saturday Domestic Longhair 2 #9590FF -#FF62BC 2.2 8 Wilbur Wilbur Domestic Shorthair 2 #FF62BC -#A3A500 2.3 2.7 Clifford Clifford Domestic Shorthair 3 #A3A500 -#00BFC4 2.6 5.7 Junebug Junebug Domestic Longhair 3 #00BFC4 -#00B0F6 2.6 6.1 Muffin Muffin Cornish Rex 3 #00B0F6 -#E76BF3 2.6 3 Teddy Bear Teddy Bear Domestic Shorthair 3 #E76BF3 -#39B600 2.6 4.2 Diana Diana Domestic Shorthair 3 #39B600 -#D89000 2.7 0.72 Bello Bello Domestic Shorthair 3 #D89000 -#00BF7D 2.7 3.1 Jellybean Jellybean Siamese 3 #00BF7D -#F8766D 2.7 4.6 Archibald Archibald Maine Coon 3 #F8766D -#9590FF 2.8 4.2 Saturday Saturday Domestic Longhair 3 #9590FF -#FF62BC 2.8 3.1 Wilbur Wilbur Domestic Shorthair 3 #FF62BC -#A3A500 2.9 5.1 Clifford Clifford Domestic Shorthair 4 #A3A500 -#00BFC4 2.9 3.4 Junebug Junebug Domestic Longhair 4 #00BFC4 -#00B0F6 2.9 3.2 Muffin Muffin Cornish Rex 4 #00B0F6 -#E76BF3 3 5.1 Teddy Bear Teddy Bear Domestic Shorthair 4 #E76BF3 -#39B600 3 7.5 Diana Diana Domestic Shorthair 4 #39B600 -#D89000 3 3.4 Bello Bello Domestic Shorthair 4 #D89000 -#00BF7D 3 4.8 Jellybean Jellybean Siamese 4 #00BF7D -#F8766D 3 2.2 Archibald Archibald Maine Coon 4 #F8766D -#9590FF 3.1 3.4 Saturday Saturday Domestic Longhair 4 #9590FF -#FF62BC 3.1 5.7 Wilbur Wilbur Domestic Shorthair 4 #FF62BC -#A3A500 3.1 2.9 Clifford Clifford Domestic Shorthair 5 #A3A500 -#00BFC4 3.1 3.5 Junebug Junebug Domestic Longhair 5 #00BFC4 -#00B0F6 3.2 5.1 Muffin Muffin Cornish Rex 5 #00B0F6 -#E76BF3 3.2 3.6 Teddy Bear Teddy Bear Domestic Shorthair 5 #E76BF3 -#39B600 3.2 3.5 Diana Diana Domestic Shorthair 5 #39B600 -#D89000 3.2 5 Bello Bello Domestic Shorthair 5 #D89000 -#00BF7D 3.2 6.3 Jellybean Jellybean Siamese 5 #00BF7D -#F8766D 3.2 3.5 Archibald Archibald Maine Coon 5 #F8766D -#9590FF 3.3 4.6 Saturday Saturday Domestic Longhair 5 #9590FF -#FF62BC 3.3 8.9 Wilbur Wilbur Domestic Shorthair 5 #FF62BC -#A3A500 3.4 3.7 Clifford Clifford Domestic Shorthair 6 #A3A500 -#00BFC4 3.4 5.5 Junebug Junebug Domestic Longhair 6 #00BFC4 -#00B0F6 3.4 7.4 Muffin Muffin Cornish Rex 6 #00B0F6 -#E76BF3 3.4 3.9 Teddy Bear Teddy Bear Domestic Shorthair 6 #E76BF3 -#39B600 3.4 4.1 Diana Diana Domestic Shorthair 6 #39B600 -#D89000 3.5 4.6 Bello Bello Domestic Shorthair 6 #D89000 -#00BF7D 3.5 4 Jellybean Jellybean Siamese 6 #00BF7D -#F8766D 3.5 7.3 Archibald Archibald Maine Coon 6 #F8766D -#9590FF 3.6 0.36 Saturday Saturday Domestic Longhair 6 #9590FF -#FF62BC 3.6 4.1 Wilbur Wilbur Domestic Shorthair 6 #FF62BC -#A3A500 3.7 4.6 Clifford Clifford Domestic Shorthair 7 #A3A500 -#00BFC4 3.7 5.7 Junebug Junebug Domestic Longhair 7 #00BFC4 -#00B0F6 3.7 4.1 Muffin Muffin Cornish Rex 7 #00B0F6 -#E76BF3 3.7 5.8 Teddy Bear Teddy Bear Domestic Shorthair 7 #E76BF3 -#39B600 3.7 4.4 Diana Diana Domestic Shorthair 7 #39B600 -#D89000 3.7 4.1 Bello Bello Domestic Shorthair 7 #D89000 -#00BF7D 3.8 5.3 Jellybean Jellybean Siamese 7 #00BF7D -#F8766D 3.8 6 Archibald Archibald Maine Coon 7 #F8766D -#9590FF 3.8 4.1 Saturday Saturday Domestic Longhair 7 #9590FF -#FF62BC 3.8 5.8 Wilbur Wilbur Domestic Shorthair 7 #FF62BC -#A3A500 3.8 9.5 Clifford Clifford Domestic Shorthair 8 #A3A500 -#00BFC4 3.8 4.1 Junebug Junebug Domestic Longhair 8 #00BFC4 -#00B0F6 3.8 4.2 Muffin Muffin Cornish Rex 8 #00B0F6 -#E76BF3 3.9 2.7 Teddy Bear Teddy Bear Domestic Shorthair 8 #E76BF3 -#39B600 3.9 4.2 Diana Diana Domestic Shorthair 8 #39B600 -#D89000 3.9 4.6 Bello Bello Domestic Shorthair 8 #D89000 -#00BF7D 3.9 6.6 Jellybean Jellybean Siamese 8 #00BF7D -#F8766D 4 4.2 Archibald Archibald Maine Coon 8 #F8766D -#9590FF 4 4.3 Saturday Saturday Domestic Longhair 8 #9590FF -#FF62BC 4.1 0.76 Wilbur Wilbur Domestic Shorthair 8 #FF62BC -#A3A500 4.1 4.4 Clifford Clifford Domestic Shorthair 9 #A3A500 -#00BFC4 4.1 5.2 Junebug Junebug Domestic Longhair 9 #00BFC4 -#00B0F6 4.1 0.71 Muffin Muffin Cornish Rex 9 #00B0F6 -#E76BF3 4.1 4.4 Teddy Bear Teddy Bear Domestic Shorthair 9 #E76BF3 -#39B600 4.1 3.8 Diana Diana Domestic Shorthair 9 #39B600 -#D89000 4.1 3.7 Bello Bello Domestic Shorthair 9 #D89000 -#00BF7D 4.2 4.4 Jellybean Jellybean Siamese 9 #00BF7D -#F8766D 4.2 5.2 Archibald Archibald Maine Coon 9 #F8766D -#9590FF 4.2 3 Saturday Saturday Domestic Longhair 9 #9590FF -#FF62BC 4.2 4.4 Wilbur Wilbur Domestic Shorthair 9 #FF62BC -#A3A500 4.2 4.9 Clifford Clifford Domestic Shorthair 10 #A3A500 -#00BFC4 4.2 5.5 Junebug Junebug Domestic Longhair 10 #00BFC4 -#00B0F6 4.2 4.5 Muffin Muffin Cornish Rex 10 #00B0F6 -#E76BF3 4.3 6.8 Teddy Bear Teddy Bear Domestic Shorthair 10 #E76BF3 -#39B600 4.3 3.7 Diana Diana Domestic Shorthair 10 #39B600 -#D89000 4.3 4.5 Bello Bello Domestic Shorthair 10 #D89000 -#00BF7D 4.4 4.9 Jellybean Jellybean Siamese 10 #00BF7D -#F8766D 4.4 8.5 Archibald Archibald Maine Coon 10 #F8766D -#9590FF 4.4 4.5 Saturday Saturday Domestic Longhair 10 #9590FF -#FF62BC 4.4 4.9 Wilbur Wilbur Domestic Shorthair 10 #FF62BC -#A3A500 4.4 6.2 Clifford Clifford Domestic Shorthair 11 #A3A500 -#00BFC4 4.4 4.5 Junebug Junebug Domestic Longhair 11 #00BFC4 -#00B0F6 4.4 4.3 Muffin Muffin Cornish Rex 11 #00B0F6 -#E76BF3 4.4 4 Teddy Bear Teddy Bear Domestic Shorthair 11 #E76BF3 -#39B600 4.5 4.5 Diana Diana Domestic Shorthair 11 #39B600 -#D89000 4.5 4.8 Bello Bello Domestic Shorthair 11 #D89000 -#00BF7D 4.5 3 Jellybean Jellybean Siamese 11 #00BF7D -#F8766D 4.5 4.6 Archibald Archibald Maine Coon 11 #F8766D -#9590FF 4.5 5.2 Saturday Saturday Domestic Longhair 11 #9590FF -#FF62BC 4.5 3.8 Wilbur Wilbur Domestic Shorthair 11 #FF62BC -#A3A500 4.5 4.6 Clifford Clifford Domestic Shorthair 12 #A3A500 -#00BFC4 4.5 5.4 Junebug Junebug Domestic Longhair 12 #00BFC4 -#00B0F6 4.6 7 Muffin Muffin Cornish Rex 12 #00B0F6 -#E76BF3 4.6 4.6 Teddy Bear Teddy Bear Domestic Shorthair 12 #E76BF3 -#39B600 4.6 6.1 Diana Diana Domestic Shorthair 12 #39B600 -#D89000 4.6 9.5 Bello Bello Domestic Shorthair 12 #D89000 -#00BF7D 4.6 4.6 Jellybean Jellybean Siamese 12 #00BF7D -#F8766D 4.6 6 Archibald Archibald Maine Coon 12 #F8766D -#9590FF 4.6 7.7 Saturday Saturday Domestic Longhair 12 #9590FF -#FF62BC 4.6 4.6 Wilbur Wilbur Domestic Shorthair 12 #FF62BC -#A3A500 4.6 4.9 Clifford Clifford Domestic Shorthair 13 #A3A500 -#00BFC4 4.6 2.2 Junebug Junebug Domestic Longhair 13 #00BFC4 -#00B0F6 4.6 4.6 Muffin Muffin Cornish Rex 13 #00B0F6 -#E76BF3 4.6 6.4 Teddy Bear Teddy Bear Domestic Shorthair 13 #E76BF3 -#39B600 4.6 7.2 Diana Diana Domestic Shorthair 13 #39B600 -#D89000 4.6 4.6 Bello Bello Domestic Shorthair 13 #D89000 -#00BF7D 4.6 3.2 Jellybean Jellybean Siamese 13 #00BF7D -#F8766D 4.7 6.6 Archibald Archibald Maine Coon 13 #F8766D -#9590FF 4.7 4.7 Saturday Saturday Domestic Longhair 13 #9590FF -#FF62BC 4.7 5.6 Wilbur Wilbur Domestic Shorthair 13 #FF62BC -#A3A500 4.8 7.1 Clifford Clifford Domestic Shorthair 14 #A3A500 -#00BFC4 4.8 4.7 Junebug Junebug Domestic Longhair 14 #00BFC4 -#00B0F6 4.8 4.5 Muffin Muffin Cornish Rex 14 #00B0F6 -#E76BF3 4.8 2.8 Teddy Bear Teddy Bear Domestic Shorthair 14 #E76BF3 -#39B600 4.8 4.8 Diana Diana Domestic Shorthair 14 #39B600 -#D89000 4.9 6.3 Bello Bello Domestic Shorthair 14 #D89000 -#00BF7D 4.9 7.1 Jellybean Jellybean Siamese 14 #00BF7D -#F8766D 4.9 4.9 Archibald Archibald Maine Coon 14 #F8766D -#9590FF 4.9 4.6 Saturday Saturday Domestic Longhair 14 #9590FF -#FF62BC 4.9 6.6 Wilbur Wilbur Domestic Shorthair 14 #FF62BC -#A3A500 4.9 4.9 Clifford Clifford Domestic Shorthair 15 #A3A500 -#00BFC4 4.9 6.3 Junebug Junebug Domestic Longhair 15 #00BFC4 -#00B0F6 4.9 0.41 Muffin Muffin Cornish Rex 15 #00B0F6 -#E76BF3 4.9 4.9 Teddy Bear Teddy Bear Domestic Shorthair 15 #E76BF3 -#39B600 4.9 5 Diana Diana Domestic Shorthair 15 #39B600 -#D89000 4.9 0.61 Bello Bello Domestic Shorthair 15 #D89000 -#00BF7D 4.9 4.9 Jellybean Jellybean Siamese 15 #00BF7D -#F8766D 4.9 3.1 Archibald Archibald Maine Coon 15 #F8766D -#9590FF 5 2.8 Saturday Saturday Domestic Longhair 15 #9590FF -#FF62BC 5 5 Wilbur Wilbur Domestic Shorthair 15 #FF62BC -#A3A500 5 4.6 Clifford Clifford Domestic Shorthair 16 #A3A500 -#00BFC4 5 3 Junebug Junebug Domestic Longhair 16 #00BFC4 -#00B0F6 5 5 Muffin Muffin Cornish Rex 16 #00B0F6 -#E76BF3 5 3.3 Teddy Bear Teddy Bear Domestic Shorthair 16 #E76BF3 -#39B600 5 9.6 Diana Diana Domestic Shorthair 16 #39B600 -#D89000 5 5 Bello Bello Domestic Shorthair 16 #D89000 -#00BF7D 5 5.2 Jellybean Jellybean Siamese 16 #00BF7D -#F8766D 5 3.9 Archibald Archibald Maine Coon 16 #F8766D -#9590FF 5.1 5 Saturday Saturday Domestic Longhair 16 #9590FF -#FF62BC 5.1 6.9 Wilbur Wilbur Domestic Shorthair 16 #FF62BC -#A3A500 5.1 3.7 Clifford Clifford Domestic Shorthair 17 #A3A500 -#00BFC4 5.1 5 Junebug Junebug Domestic Longhair 17 #00BFC4 -#00B0F6 5.1 2.7 Muffin Muffin Cornish Rex 17 #00B0F6 -#E76BF3 5.1 8.4 Teddy Bear Teddy Bear Domestic Shorthair 17 #E76BF3 -#39B600 5.1 5 Diana Diana Domestic Shorthair 17 #39B600 -#D89000 5.2 6 Bello Bello Domestic Shorthair 17 #D89000 -#00BF7D 5.2 8.5 Jellybean Jellybean Siamese 17 #00BF7D -#F8766D 5.2 5.1 Archibald Archibald Maine Coon 17 #F8766D -#9590FF 5.2 3.6 Saturday Saturday Domestic Longhair 17 #9590FF -#FF62BC 5.2 3.2 Wilbur Wilbur Domestic Shorthair 17 #FF62BC -#A3A500 5.2 5.2 Clifford Clifford Domestic Shorthair 18 #A3A500 -#00BFC4 5.2 6.8 Junebug Junebug Domestic Longhair 18 #00BFC4 -#00B0F6 5.2 1.3 Muffin Muffin Cornish Rex 18 #00B0F6 -#E76BF3 5.2 5.2 Teddy Bear Teddy Bear Domestic Shorthair 18 #E76BF3 -#39B600 5.2 6.4 Diana Diana Domestic Shorthair 18 #39B600 -#D89000 5.3 6.2 Bello Bello Domestic Shorthair 18 #D89000 -#00BF7D 5.3 5.2 Jellybean Jellybean Siamese 18 #00BF7D -#F8766D 5.3 4.2 Archibald Archibald Maine Coon 18 #F8766D -#9590FF 5.3 7.9 Saturday Saturday Domestic Longhair 18 #9590FF -#FF62BC 5.3 5.2 Wilbur Wilbur Domestic Shorthair 18 #FF62BC -#A3A500 5.4 4.7 Clifford Clifford Domestic Shorthair 19 #A3A500 -#00BFC4 5.4 3.4 Junebug Junebug Domestic Longhair 19 #00BFC4 -#00B0F6 5.4 5.3 Muffin Muffin Cornish Rex 19 #00B0F6 -#E76BF3 5.4 4.9 Teddy Bear Teddy Bear Domestic Shorthair 19 #E76BF3 -#39B600 5.4 9.1 Diana Diana Domestic Shorthair 19 #39B600 -#D89000 5.4 5.3 Bello Bello Domestic Shorthair 19 #D89000 -#00BF7D 5.4 4.6 Jellybean Jellybean Siamese 19 #00BF7D -#F8766D 5.4 2 Archibald Archibald Maine Coon 19 #F8766D -#9590FF 5.5 5.4 Saturday Saturday Domestic Longhair 19 #9590FF -#FF62BC 5.5 7.6 Wilbur Wilbur Domestic Shorthair 19 #FF62BC -#A3A500 5.5 7.9 Clifford Clifford Domestic Shorthair 20 #A3A500 -#00BFC4 5.5 5.4 Junebug Junebug Domestic Longhair 20 #00BFC4 -#00B0F6 5.5 5.1 Muffin Muffin Cornish Rex 20 #00B0F6 -#E76BF3 5.5 7.5 Teddy Bear Teddy Bear Domestic Shorthair 20 #E76BF3 -#39B600 5.6 5.4 Diana Diana Domestic Shorthair 20 #39B600 -#D89000 5.6 4.3 Bello Bello Domestic Shorthair 20 #D89000 -#00BF7D 5.6 9.1 Jellybean Jellybean Siamese 20 #00BF7D -#F8766D 5.6 5.4 Archibald Archibald Maine Coon 20 #F8766D -#9590FF 5.7 5.6 Saturday Saturday Domestic Longhair 20 #9590FF -#FF62BC 5.7 3.2 Wilbur Wilbur Domestic Shorthair 20 #FF62BC -#A3A500 5.7 5.5 Clifford Clifford Domestic Shorthair 21 #A3A500 -#00BFC4 5.7 5.2 Junebug Junebug Domestic Longhair 21 #00BFC4 -#00B0F6 5.7 0.86 Muffin Muffin Cornish Rex 21 #00B0F6 -#E76BF3 5.8 5.5 Teddy Bear Teddy Bear Domestic Shorthair 21 #E76BF3 -#39B600 5.8 4.9 Diana Diana Domestic Shorthair 21 #39B600 -#D89000 5.8 9.1 Bello Bello Domestic Shorthair 21 #D89000 -#00BF7D 5.8 5.5 Jellybean Jellybean Siamese 21 #00BF7D -#F8766D 5.9 4.9 Archibald Archibald Maine Coon 21 #F8766D -#9590FF 5.9 9.6 Saturday Saturday Domestic Longhair 21 #9590FF -#FF62BC 5.9 5.6 Wilbur Wilbur Domestic Shorthair 21 #FF62BC -#A3A500 5.9 5.4 Clifford Clifford Domestic Shorthair 22 #A3A500 -#00BFC4 5.9 6.7 Junebug Junebug Domestic Longhair 22 #00BFC4 -#00B0F6 5.9 5.7 Muffin Muffin Cornish Rex 22 #00B0F6 -#E76BF3 5.9 3.9 Teddy Bear Teddy Bear Domestic Shorthair 22 #E76BF3 -#39B600 6 7.4 Diana Diana Domestic Shorthair 22 #39B600 -#D89000 6 5.8 Bello Bello Domestic Shorthair 22 #D89000 -#00BF7D 6 3.8 Jellybean Jellybean Siamese 22 #00BF7D -#F8766D 6 4.4 Archibald Archibald Maine Coon 22 #F8766D -#9590FF 6 5.9 Saturday Saturday Domestic Longhair 22 #9590FF -#FF62BC 6 6.6 Wilbur Wilbur Domestic Shorthair 22 #FF62BC -#A3A500 6 1.2 Clifford Clifford Domestic Shorthair 23 #A3A500 -#00BFC4 6.1 5.9 Junebug Junebug Domestic Longhair 23 #00BFC4 -#00B0F6 6.1 2.9 Muffin Muffin Cornish Rex 23 #00B0F6 -#E76BF3 6.1 6.8 Teddy Bear Teddy Bear Domestic Shorthair 23 #E76BF3 -#39B600 6.2 5.9 Diana Diana Domestic Shorthair 23 #39B600 -#D89000 6.2 5 Bello Bello Domestic Shorthair 23 #D89000 -#00BF7D 6.2 7.3 Jellybean Jellybean Siamese 23 #00BF7D -#F8766D 6.3 5.9 Archibald Archibald Maine Coon 23 #F8766D -#9590FF 6.3 3.9 Saturday Saturday Domestic Longhair 23 #9590FF -#FF62BC 6.3 4.8 Wilbur Wilbur Domestic Shorthair 23 #FF62BC -#A3A500 6.3 5.9 Clifford Clifford Domestic Shorthair 24 #A3A500 -#00BFC4 6.3 5.3 Junebug Junebug Domestic Longhair 24 #00BFC4 -#00B0F6 6.3 1.7 Muffin Muffin Cornish Rex 24 #00B0F6 -#E76BF3 6.3 6 Teddy Bear Teddy Bear Domestic Shorthair 24 #E76BF3 -#39B600 6.4 6 Diana Diana Domestic Shorthair 24 #39B600 -#D89000 6.4 6.8 Bello Bello Domestic Shorthair 24 #D89000 -#00BF7D 6.4 6 Jellybean Jellybean Siamese 24 #00BF7D -#F8766D 6.4 2.9 Archibald Archibald Maine Coon 24 #F8766D -#9590FF 6.4 2.6 Saturday Saturday Domestic Longhair 24 #9590FF -#FF62BC 6.5 6 Wilbur Wilbur Domestic Shorthair 24 #FF62BC -#A3A500 6.5 5.9 Clifford Clifford Domestic Shorthair 25 #A3A500 -#00BFC4 6.6 3.4 Junebug Junebug Domestic Longhair 25 #00BFC4 -#00B0F6 6.6 6.1 Muffin Muffin Cornish Rex 25 #00B0F6 -#E76BF3 6.6 5 Teddy Bear Teddy Bear Domestic Shorthair 25 #E76BF3 -#39B600 6.6 2.1 Diana Diana Domestic Shorthair 25 #39B600 -#D89000 6.6 6.2 Bello Bello Domestic Shorthair 25 #D89000 -#00BF7D 6.6 3.7 Jellybean Jellybean Siamese 25 #00BF7D -#F8766D 6.7 0.16 Archibald Archibald Maine Coon 25 #F8766D -#9590FF 6.7 6.3 Saturday Saturday Domestic Longhair 25 #9590FF -#FF62BC 6.8 3.1 Wilbur Wilbur Domestic Shorthair 25 #FF62BC -#A3A500 6.8 3.8 Clifford Clifford Domestic Shorthair 26 #A3A500 -#00BFC4 6.8 6.3 Junebug Junebug Domestic Longhair 26 #00BFC4 -#00B0F6 6.8 5.7 Muffin Muffin Cornish Rex 26 #00B0F6 -#E76BF3 6.8 5.6 Teddy Bear Teddy Bear Domestic Shorthair 26 #E76BF3 -#39B600 6.8 6.3 Diana Diana Domestic Shorthair 26 #39B600 -#D89000 6.9 4.8 Bello Bello Domestic Shorthair 26 #D89000 -#00BF7D 6.9 6.8 Jellybean Jellybean Siamese 26 #00BF7D -#F8766D 6.9 6.3 Archibald Archibald Maine Coon 26 #F8766D -#9590FF 7 5.2 Saturday Saturday Domestic Longhair 26 #9590FF -#FF62BC 7 7.5 Wilbur Wilbur Domestic Shorthair 26 #FF62BC -#A3A500 7.1 6.4 Clifford Clifford Domestic Shorthair 27 #A3A500 -#00BFC4 7.1 5.8 Junebug Junebug Domestic Longhair 27 #00BFC4 -#00B0F6 7.2 9.5 Muffin Muffin Cornish Rex 27 #00B0F6 -#E76BF3 7.3 6.5 Teddy Bear Teddy Bear Domestic Shorthair 27 #E76BF3 -#39B600 7.3 6.7 Diana Diana Domestic Shorthair 27 #39B600 -#D89000 7.4 1.6 Bello Bello Domestic Shorthair 27 #D89000 -#00BF7D 7.4 6.6 Jellybean Jellybean Siamese 27 #00BF7D -#F8766D 7.4 4.9 Archibald Archibald Maine Coon 27 #F8766D -#9590FF 7.4 3.2 Saturday Saturday Domestic Longhair 27 #9590FF -#FF62BC 7.5 6.8 Wilbur Wilbur Domestic Shorthair 27 #FF62BC -#A3A500 7.5 4.4 Clifford Clifford Domestic Shorthair 28 #A3A500 -#00BFC4 7.5 1.3 Junebug Junebug Domestic Longhair 28 #00BFC4 -#00B0F6 7.5 6.9 Muffin Muffin Cornish Rex 28 #00B0F6 -#E76BF3 7.6 6.4 Teddy Bear Teddy Bear Domestic Shorthair 28 #E76BF3 -#39B600 7.6 6.4 Diana Diana Domestic Shorthair 28 #39B600 -#D89000 7.7 6.9 Bello Bello Domestic Shorthair 28 #D89000 -#00BF7D 7.8 4.1 Jellybean Jellybean Siamese 28 #00BF7D -#F8766D 7.9 3.3 Archibald Archibald Maine Coon 28 #F8766D -#9590FF 7.9 7 Saturday Saturday Domestic Longhair 28 #9590FF -#FF62BC 8 3.8 Wilbur Wilbur Domestic Shorthair 28 #FF62BC -#A3A500 8.2 6.5 Clifford Clifford Domestic Shorthair 29 #A3A500 -#00BFC4 8.3 7.4 Junebug Junebug Domestic Longhair 29 #00BFC4 -#00B0F6 8.4 4.5 Muffin Muffin Cornish Rex 29 #00B0F6 -#E76BF3 8.5 3 Teddy Bear Teddy Bear Domestic Shorthair 29 #E76BF3 -#39B600 8.5 7.5 Diana Diana Domestic Shorthair 29 #39B600 -#D89000 8.8 7.4 Bello Bello Domestic Shorthair 29 #D89000 -#00BF7D 8.8 0.71 Jellybean Jellybean Siamese 29 #00BF7D -#F8766D 8.9 7.8 Archibald Archibald Maine Coon 29 #F8766D -#9590FF 8.9 4.2 Saturday Saturday Domestic Longhair 29 #9590FF -#FF62BC 9.1 6.6 Wilbur Wilbur Domestic Shorthair 29 #FF62BC -#A3A500 9.1 8.3 Clifford Clifford Domestic Shorthair 30 #A3A500 -#00BFC4 9.1 5.4 Junebug Junebug Domestic Longhair 30 #00BFC4 -#00B0F6 9.1 7.6 Muffin Muffin Cornish Rex 30 #00B0F6 -#E76BF3 9.1 8.8 Teddy Bear Teddy Bear Domestic Shorthair 30 #E76BF3 -#39B600 9.5 3.8 Diana Diana Domestic Shorthair 30 #39B600 -#D89000 9.5 5.5 Bello Bello Domestic Shorthair 30 #D89000 -#00BF7D 9.5 8.9 Jellybean Jellybean Siamese 30 #00BF7D -#F8766D 9.6 3.8 Archibald Archibald Maine Coon 30 #F8766D -#9590FF 9.6 5.4 Saturday Saturday Domestic Longhair 30 #9590FF -#FF62BC 9.6 9.1 Wilbur Wilbur Domestic Shorthair 30 #FF62BC diff --git a/docs/articles/showselectedanimatedassociations/animint.js b/docs/articles/showselectedanimatedassociations/animint.js deleted file mode 100644 index 01dd1e740..000000000 --- a/docs/articles/showselectedanimatedassociations/animint.js +++ /dev/null @@ -1,2690 +0,0 @@ -// Define functions to render linked interactive plots using d3. -// Another script should define e.g. -// -// Constructor for animint Object. -var animint = function (to_select, json_file) { - - var default_axis_px = 16; - - function wait_until_then(timeout, condFun, readyFun) { - var args=arguments - function checkFun() { - if(condFun()) { - readyFun(args[3],args[4]); - } else{ - setTimeout(checkFun, timeout); - } - } - checkFun(); - } - - function convert_R_types(resp_array, types){ - return resp_array.map(function (d) { - for (var v_name in d) { - if(!is_interactive_aes(v_name)){ - var r_type = types[v_name]; - if (r_type == "integer") { - d[v_name] = parseInt(d[v_name]); - } else if (r_type == "numeric") { - d[v_name] = parseFloat(d[v_name]); - } else if (r_type == "factor" || r_type == "rgb" - || r_type == "linetype" || r_type == "label" - || r_type == "character") { - // keep it as a character - } else if (r_type == "character" & v_name == "outliers") { - d[v_name] = parseFloat(d[v_name].split(" @ ")); - } - } - } - return d; - }); - } - - // replacing periods in variable with an underscore this makes sure - // that selector doesn't confuse . in name with css selectors - function safe_name(unsafe_name){ - return unsafe_name.replace(/[ .]/g, '_'); - } - function legend_class_name(selector_name){ - return safe_name(selector_name) + "_variable"; - } - - function is_interactive_aes(v_name){ - if(v_name.indexOf("clickSelects") > -1){ - return true; - } - if(v_name.indexOf("showSelected") > -1){ - return true; - } - return false; - } - - var linetypesize2dasharray = function (lt, size) { - var isInt = function(n) { - return typeof n === 'number' && parseFloat(n) == parseInt(n, 10) && !isNaN(n); - }; - if(isInt(lt)){ // R integer line types. - if(lt == 1){ - return null; - } - var o = { - 0: size * 0 + "," + size * 10, - 2: size * 4 + "," + size * 4, - 3: size + "," + size * 2, - 4: size + "," + size * 2 + "," + size * 4 + "," + size * 2, - 5: size * 8 + "," + size * 4, - 6: size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2 - }; - } else { // R defined line types - if(lt == "solid" || lt === null){ - return null; - } - var o = { - "blank": size * 0 + "," + size * 10, - "none": size * 0 + "," + size * 10, - "dashed": size * 4 + "," + size * 4, - "dotted": size + "," + size * 2, - "dotdash": size + "," + size * 2 + "," + size * 4 + "," + size * 2, - "longdash": size * 8 + "," + size * 4, - "twodash": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, - "22": size * 2 + "," + size * 2, - "42": size * 4 + "," + size * 2, - "44": size * 4 + "," + size * 4,"13": size + "," + size * 3, - "1343": size + "," + size * 3 + "," + size * 4 + "," + size * 3, - "73": size * 7 + "," + size * 3, - "2262": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, - "12223242": size + "," + size * 2 + "," + size * 2 + "," + size * 2 + "," + size * 3 + "," + size * 2 + "," + size * 4 + "," + size * 2, - "F282": size * 15 + "," + size * 2 + "," + size * 8 + "," + size * 2, - "F4448444": size * 15 + "," + size * 4 + "," + size * 4 + "," + size * 4 + "," + size * 8 + "," + size * 4 + "," + size * 4 + "," + size * 4, - "224282F2": size * 2 + "," + size * 2 + "," + size * 4 + "," + size * 2 + "," + size * 8 + "," + size * 2 + "," + size * 16 + "," + size * 2, - "F1": size * 16 + "," + size - }; - } - - if (lt in o){ - return o[lt]; - } else{ // manually specified line types - str = lt.split(""); - strnum = str.map(function (d) { - return size * parseInt(d, 16); - }); - return strnum; - } - }; - - var isArray = function(o) { - return Object.prototype.toString.call(o) === '[object Array]'; - }; - - // create a dummy element, apply the appropriate classes, - // and then measure the element - // Inspired from http://jsfiddle.net/uzddx/2/ - var measureText = function(pText, pFontSize, pAngle, pStyle) { - if (!pText || pText.length === 0) return {height: 0, width: 0}; - if (pAngle === null || isNaN(pAngle)) pAngle = 0; - - var container = element.append('svg'); - // do we need to set the class so that styling is applied? - //.attr('class', classname); - - container.append('text') - .attr({x: -1000, y: -1000}) - .attr("transform", "rotate(" + pAngle + ")") - .attr("style", pStyle) - .attr("font-size", pFontSize) - .text(pText); - - var bbox = container.node().getBBox(); - container.remove(); - - return {height: bbox.height, width: bbox.width}; - }; - - var nest_by_group = d3.nest().key(function(d){ return d.group; }); - var dirs = json_file.split("/"); - dirs.pop(); //if a directory path exists, remove the JSON file from dirs - var element = d3.select(to_select); - this.element = element; - var viz_id = element.attr("id"); - var Widgets = {}; - this.Widgets = Widgets; - var Selectors = {}; - this.Selectors = Selectors; - var Plots = {}; - this.Plots = Plots; - var Geoms = {}; - this.Geoms = Geoms; - // SVGs must be stored separately from Geoms since they are - // initialized first, with the Plots. - var SVGs = {}; - this.SVGs = SVGs; - var Animation = {}; - this.Animation = Animation; - var all_geom_names = {}; - this.all_geom_names = all_geom_names; - - //creating an array to contain the selectize widgets - var selectized_array = []; - var data_object_geoms = { - "line":true, - "path":true, - "ribbon":true, - "polygon":true - }; - var css = document.createElement('style'); - css.type = 'text/css'; - var styles = [".axis path{fill: none;stroke: black;shape-rendering: crispEdges;}", - ".axis line{fill: none;stroke: black;shape-rendering: crispEdges;}", - ".axis text {font-family: sans-serif;font-size: 11px;}"]; - - var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; - // Determine if data will be an object or an array. - if(g_info.geom in data_object_geoms){ - g_info.data_is_object = true; - }else{ - g_info.data_is_object = false; - } - // Add a row to the loading table. - g_info.tr = Widgets["loading"].append("tr"); - g_info.tr.append("td").text(g_name); - g_info.tr.append("td").attr("class", "chunk"); - g_info.tr.append("td").attr("class", "downloaded").text(0); - g_info.tr.append("td").text(g_info.total); - g_info.tr.append("td").attr("class", "status").text("initialized"); - - // load chunk tsv - g_info.data = {}; - g_info.download_status = {}; - Geoms[g_name] = g_info; - // Determine whether common chunk tsv exists - // If yes, load it - if(g_info.hasOwnProperty("columns") && g_info.columns.common){ - var common_tsv = get_tsv(g_info, "_common"); - g_info.common_tsv = common_tsv; - var common_path = getTSVpath(common_tsv); - d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); - }); - } else { - g_info.common_tsv = null; - } - // Save this geom and load it! - update_geom(g_name, null); - }; - var add_plot = function (p_name, p_info) { - // Each plot may have one or more legends. To make space for the - // legends, we put each plot in a table with one row and two - // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); - var plot_tr = plot_table.append("tr"); - var tdLeft = plot_tr.append("td"); - var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); - if(viz_id === null){ - p_info.plot_id = p_name; - }else{ - p_info.plot_id = viz_id + "_" + p_name; - } - var svg = tdLeft.append("svg") - .attr("id", p_info.plot_id) - .attr("height", p_info.options.height) - .attr("width", p_info.options.width); - - // divvy up width/height based on the panel layout - var nrows = Math.max.apply(null, p_info.layout.ROW); - var ncols = Math.max.apply(null, p_info.layout.COL); - var panel_names = p_info.layout.PANEL; - var npanels = Math.max.apply(null, panel_names); - - // Note axis names are "shared" across panels (just like the title) - var xtitlepadding = 5 + measureText(p_info["xtitle"], default_axis_px).height; - var ytitlepadding = 5 + measureText(p_info["ytitle"], default_axis_px).height; - - // 'margins' are fixed across panels and do not - // include title/axis/label padding (since these are not - // fixed across panels). They do, however, account for - // spacing between panels - var text_height_pixels = measureText("foo", 11).height; - var margin = { - left: 0, - right: text_height_pixels * p_info.panel_margin_lines, - top: text_height_pixels * p_info.panel_margin_lines, - bottom: 0 - }; - var plotdim = { - width: 0, - height: 0, - xstart: 0, - xend: 0, - ystart: 0, - yend: 0, - graph: { - width: 0, - height: 0 - }, - margin: margin, - xlab: { - x: 0, - y: 0 - }, - ylab: { - x: 0, - y: 0 - }, - title: { - x: 0, - y: 0 - } - }; - - // Draw the title - var titlepadding = measureText(p_info.title, p_info.title_size).height; - // why are we giving the title padding if it is undefined? - if (p_info.title === undefined) titlepadding = 0; - plotdim.title.x = p_info.options.width / 2; - plotdim.title.y = titlepadding; - svg.append("text") - .text(p_info.title) - .attr("class", "plottitle") - .attr("font-family", "sans-serif") - .attr("font-size", p_info.title_size) - .attr("transform", "translate(" + plotdim.title.x + "," + - plotdim.title.y + ")") - .style("text-anchor", "middle"); - - // grab max text size over axis labels and facet strip labels - var axispaddingy = 5; - if(p_info.hasOwnProperty("ylabs") && p_info.ylabs.length){ - axispaddingy += Math.max.apply(null, p_info.ylabs.map(function(entry){ - // + 5 to give a little extra space to avoid bad axis labels - // in shiny. - return measureText(entry, p_info.ysize).width + 5; - })); - } - var axispaddingx = 10 + 20; - if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ - // TODO: throw warning if text height is large portion of plot height? - axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ - return measureText(entry, p_info.xsize, p_info.xangle).height; - })); - // TODO: carefully calculating this gets complicated with rotating xlabs - //margin.right += 5; - } - plotdim.margin = margin; - - var strip_heights = p_info.strips.top.map(function(entry){ - return measureText(entry, p_info.strip_text_xsize).height; - }); - var strip_widths = p_info.strips.right.map(function(entry){ - return measureText(entry, p_info.strip_text_ysize).height; - }); - - // compute the number of x/y axes, max strip height per row, and - // max strip width per columns, for calculating height/width of - // graphing region. - var row_strip_heights = []; - var col_strip_widths = []; - var n_xaxes = 0; - var n_yaxes = 0; - var current_row, current_col; - for (var layout_i = 0; layout_i < npanels; layout_i++) { - current_row = p_info.layout.ROW[layout_i] - 1; - current_col = p_info.layout.COL[layout_i] - 1; - if(row_strip_heights[current_row] === undefined){ - row_strip_heights[current_row] = []; - } - if(col_strip_widths[current_col] === undefined){ - col_strip_widths[current_col] = []; - } - row_strip_heights[current_row].push(strip_heights[layout_i]); - col_strip_widths[current_col].push(strip_widths[layout_i]); - if (p_info.layout.COL[layout_i] == 1) { - n_xaxes += p_info.layout.AXIS_X[layout_i]; - } - if (p_info.layout.ROW[layout_i] == 1) { - n_yaxes += p_info.layout.AXIS_Y[layout_i]; - } - } - function cumsum_array(array_of_arrays){ - var cumsum = [], max_value, cumsum_value = 0; - for(var i=0; i 1) { - background.append("rect") - .attr("x", plotdim.xstart) - .attr("y", plotdim.ystart) - .attr("width", plotdim.xend - plotdim.xstart) - .attr("height", plotdim.yend - plotdim.ystart) - .attr("class", "background_rect") - .style("fill", p_info.panel_background.fill) - .style("stroke", p_info.panel_background.colour) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(p_info.panel_background.linetype, - p_info.panel_background.size); - }); - } - - // drawing the grid lines - ["grid_minor", "grid_major"].forEach(function(grid_class){ - var grid_background = p_info[grid_class]; - // if grid lines are defined - if(grid_background.hasOwnProperty("size")) { - var grid = background.append("g") - .attr("class", grid_class); - ["x","y"].forEach(function(scale_var){ - var const_var; - if(scale_var == "x"){ - const_var = "y"; - }else{ - const_var = "x"; - } - grid.append("g") - .attr("class", scale_var) - .selectAll("line") - .data(grid_background.loc[scale_var][layout_i]) - .enter() - .append("line") - .attr(const_var + "1", plotdim[const_var + "start"]) - .attr(const_var + "2", plotdim[const_var + "end"]) - .attr(scale_var + "1", function(d) { - return scales[panel_i][scale_var](d); - }) - .attr(scale_var + "2", function(d) { - return scales[panel_i][scale_var](d); - }) - .style("stroke", grid_background.colour) - .style("stroke-linecap", grid_background.lineend) - .style("stroke-width", grid_background.size) - .style("stroke-dasharray", linetypesize2dasharray( - grid_background.linetype, grid_background.size)) - ; - }); - } - }); - - // drawing border - // uses insert to draw it right before the #plottitle - if(Object.keys(p_info.panel_border).length > 1) { - background.append("rect") - .attr("x", plotdim.xstart) - .attr("y", plotdim.ystart) - .attr("width", plotdim.xend - plotdim.xstart) - .attr("height", plotdim.yend - plotdim.ystart) - .attr("class", "border_rect") - .style("fill", p_info.panel_border.fill) - .style("stroke", p_info.panel_border.colour) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(p_info.panel_border.linetype, - p_info.panel_border.size); - }); - } - - } //end of for(layout_i - // After drawing all backgrounds, we can draw the axis labels. - if(p_info["ytitle"]){ - svg.append("text") - .text(p_info["ytitle"]) - .attr("class", "ytitle") - .style("text-anchor", "middle") - .style("font-size", default_axis_px + "px") - .attr("transform", "translate(" + - ytitle_x + - "," + - (ytitle_top + ytitle_bottom)/2 + - ")rotate(270)") - ; - } - if(p_info["xtitle"]){ - svg.append("text") - .text(p_info["xtitle"]) - .attr("class", "xtitle") - .style("text-anchor", "middle") - .style("font-size", default_axis_px + "px") - .attr("transform", "translate(" + - (xtitle_left + xtitle_right)/2 + - "," + - xtitle_y + - ")") - ; - } - Plots[p_name].scales = scales; - }; //end of add_plot() - - function update_legend_opacity(v_name){ - var s_info = Selectors[v_name]; - s_info.legend_tds.style("opacity", s_info.legend_update_fun); - } - - var add_selector = function (s_name, s_info) { - Selectors[s_name] = s_info; - if(s_info.type == "multiple"){ - if(!isArray(s_info.selected)){ - s_info.selected = [s_info.selected]; - } - // legend_update_fun is evaluated in the context of the - // td.legend_entry_label. - s_info.legend_update_fun = function(d){ - var i_value = s_info.selected.indexOf(this.textContent); - if(i_value == -1){ - return 0.5; - }else{ - return 1; - } - } - }else{ - s_info.legend_update_fun = function(d){ - if(this.textContent == s_info.selected){ - return 1; - }else{ - return 0.5; - } - } - } - s_info.legend_tds = - element.selectAll("tr."+legend_class_name(s_name)+" td.legend_entry_label") - ; - update_legend_opacity(s_name); - }; //end of add_selector() - - function get_tsv(g_info, chunk_id){ - return g_info.classed + "_chunk" + chunk_id + ".tsv"; - } - function getTSVpath(tsv_name){ - return dirs.concat(tsv_name).join("/"); - } - - /** - * copy common chunk tsv to varied chunk tsv, returning an array of - * objects. - */ - function copy_chunk(g_info, varied_chunk) { - var varied_by_group = nest_by_group.map(varied_chunk); - var common_by_group = g_info.data[g_info.common_tsv]; - var new_varied_chunk = []; - for(group_id in varied_by_group){ - var varied_one_group = varied_by_group[group_id]; - var common_one_group = common_by_group[group_id]; - var common_i = 0; - for(var varied_i=0; varied_i < varied_one_group.length; varied_i++){ - // there are two cases: each group of varied data is of length - // 1, or of length of the common data. - if(common_one_group.length == varied_one_group.length){ - common_i = varied_i; - } - var varied_obj = varied_one_group[varied_i]; - var common_obj = common_one_group[common_i]; - for(col in common_obj){ - if(col != "group"){ - varied_obj[col] = common_obj[col]; - } - } - new_varied_chunk.push(varied_obj); - } - } - return new_varied_chunk; - } - - // update_geom is called from add_geom and update_selector. It - // downloads data if necessary, and then calls draw_geom. - var update_geom = function (g_name, selector_name) { - var g_info = Geoms[g_name]; - // First apply chunk_order selector variables. - var chunk_id = g_info.chunks; - g_info.chunk_order.forEach(function (v_name) { - if(chunk_id == null){ - return; // no data in a higher up chunk var. - } - var value = Selectors[v_name].selected; - if(chunk_id.hasOwnProperty(value)){ - chunk_id = chunk_id[value]; - }else{ - chunk_id = null; // no data to show in this subset. - } - }); - if(chunk_id == null){ - draw_panels(g_info, [], selector_name); //draw nothing. - return; - } - var tsv_name = get_tsv(g_info, chunk_id); - // get the data if it has not yet been downloaded. - g_info.tr.select("td.chunk").text(tsv_name); - if(g_info.data.hasOwnProperty(tsv_name)){ - draw_panels(g_info, g_info.data[tsv_name], selector_name); - }else{ - g_info.tr.select("td.status").text("downloading"); - var svg = SVGs[g_name]; - var loading = svg.append("text") - .attr("class", "loading"+tsv_name) - .text("Downloading "+tsv_name+"...") - .attr("font-size", 9) - //.attr("x", svg.attr("width")/2) - .attr("y", 10) - .style("fill", "red"); - download_chunk(g_info, tsv_name, function(chunk){ - loading.remove(); - draw_panels(g_info, chunk, selector_name); - }); - } - }; - var draw_panels = function(g_info, chunk, selector_name) { - // derive the plot name from the geometry name - var g_names = g_info.classed.split("_"); - var p_name = g_names[g_names.length - 1]; - var panels = Plots[p_name].layout.PANEL; - panels.forEach(function(panel) { - draw_geom(g_info, chunk, selector_name, panel); - }); - }; - - function download_next(g_name){ - var g_info = Geoms[g_name]; - var selector_value = Animation.sequence[g_info.seq_i]; - var chunk_id = g_info.chunks[selector_value]; - var tsv_name = get_tsv(g_info, chunk_id); - g_info.seq_count += 1; - if(Animation.sequence.length == g_info.seq_count){ - Animation.done_geoms[g_name] = 1; - return; - } - g_info.seq_i += 1; - if(g_info.seq_i == Animation.sequence.length){ - g_info.seq_i = 0; - } - if(typeof(chunk_id) == "string"){ - download_chunk(g_info, tsv_name, function(chunk){ - download_next(g_name); - }) - }else{ - download_next(g_name); - } - } - - // download_chunk is called from update_geom and download_next. - function download_chunk(g_info, tsv_name, funAfter){ - if(g_info.download_status.hasOwnProperty(tsv_name)){ - var chunk; - if(g_info.data_is_object){ - chunk = {}; - }else{ - chunk = []; - } - funAfter(chunk); - return; // do not download twice. - } - g_info.download_status[tsv_name] = "downloading"; - // prefix tsv file with appropriate path - var tsv_file = getTSVpath(tsv_name); - d3.tsv(tsv_file, function (error, response) { - // First convert to correct types. - g_info.download_status[tsv_name] = "processing"; - response = convert_R_types(response, g_info.types); - wait_until_then(500, function(){ - if(g_info.common_tsv) { - return g_info.data.hasOwnProperty(g_info.common_tsv); - }else{ - return true; - } - }, function(){ - if(g_info.common_tsv) { - // copy data from common tsv to varied tsv - response = copy_chunk(g_info, response); - } - var nest = d3.nest(); - g_info.nest_order.forEach(function (v_name) { - nest.key(function (d) { - return d[v_name]; - }); - }); - var chunk = nest.map(response); - g_info.data[tsv_name] = chunk; - g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); - g_info.download_status[tsv_name] = "saved"; - funAfter(chunk); - }); - }); - }//download_chunk. - - // update_geom is responsible for obtaining a chunk of downloaded - // data, and then calling draw_geom to actually draw it. - var draw_geom = function(g_info, chunk, selector_name, PANEL){ - g_info.tr.select("td.status").text("displayed"); - var svg = SVGs[g_info.classed]; - // derive the plot name from the geometry name - var g_names = g_info.classed.split("_"); - var p_name = g_names[g_names.length - 1]; - var scales = Plots[p_name].scales[PANEL]; - var selected_arrays = [ [] ]; //double array necessary. - var has_clickSelects = g_info.aes.hasOwnProperty("clickSelects"); - var has_clickSelects_variable = - g_info.aes.hasOwnProperty("clickSelects.variable"); - g_info.subset_order.forEach(function (aes_name) { - var selected, values; - var new_arrays = []; - if(0 < aes_name.indexOf(".variable")){ - selected_arrays.forEach(function(old_array){ - var some_data = chunk; - old_array.forEach(function(value){ - if(some_data.hasOwnProperty(value)) { - some_data = some_data[value]; - } else { - some_data = {}; - } - }) - values = d3.keys(some_data); - values.forEach(function(s_name){ - var selected = Selectors[s_name].selected; - var new_array = old_array.concat(s_name).concat(selected); - new_arrays.push(new_array); - }) - }) - }else{//not .variable aes: - if(aes_name == "PANEL"){ - selected = PANEL; - }else{ - var s_name = g_info.aes[aes_name]; - selected = Selectors[s_name].selected; - } - if(isArray(selected)){ - values = selected; //multiple selection. - }else{ - values = [selected]; //single selection. - } - values.forEach(function(value){ - selected_arrays.forEach(function(old_array){ - var new_array = old_array.concat(value); - new_arrays.push(new_array); - }) - }) - } - selected_arrays = new_arrays; - }); - // data can be either an array[] if it will be directly involved - // in a data-bind, or an object{} if it will be involved in a - // data-bind by group (e.g. geom_line). - var data; - if(g_info.data_is_object){ - data = {}; - }else{ - data = []; - } - selected_arrays.forEach(function(value_array){ - var some_data = chunk; - value_array.forEach(function(value){ - if (some_data.hasOwnProperty(value)) { - some_data = some_data[value]; - } else { - if(g_info.data_is_object){ - some_data = {}; - }else{ - some_data = []; - } - } - }); - if(g_info.data_is_object){ - if(isArray(some_data) && some_data.length){ - data["0"] = some_data; - }else{ - for(k in some_data){ - data[k] = some_data[k]; - } - } - }else{//some_data is an array. - data = data.concat(some_data); - } - }); - var aes = g_info.aes; - var toXY = function (xy, a) { - return function (d) { - return scales[xy](d[a]); - }; - }; - var layer_g_element = svg.select("g." + g_info.classed); - var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); - var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; - }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; - }; - var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; - } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; - - // stroke_width for geom_point - var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; - } - - var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; - } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } - return linetypesize2dasharray(lt, get_size(d)); - }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; - } - const get_angle = function(d) { - // x and y are the coordinates to rotate around, we choose the center - // point of the text because otherwise it will rotate around (0,0) of its - // coordinate system, which is the top left of the plot - x = scales["x"](d["x"]); - y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } - // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so - // we negate the angle. - return `rotate(${-angle}, ${x}, ${y})`; - }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - - // For aes(hjust) the compiler should make an "anchor" column. - var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } - var get_text_anchor; - if(g_info.aes.hasOwnProperty("hjust")) { - get_text_anchor = function(d){ - return d["anchor"]; - } - }else{ - get_text_anchor = function(d){ - return text_anchor; - } - } - - var eActions, eAppend, linkActions; - var key_fun = null; - var id_fun = function(d){ - return d.id; - }; - if(g_info.aes.hasOwnProperty("key")){ - key_fun = function(d){ - return d.key; - }; - } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; - if(g_info.data_is_object) { - - // Lines, paths, polygons, and ribbons are a bit special. For - // every unique value of the group variable, we take the - // corresponding data rows and make 1 path. The tricky part is - // that to use d3 I do a data-bind of some "fake" data which are - // just group ids, which is the kv variable in the code below - - // // case of only 1 line and no groups. - // if(!aes.hasOwnProperty("group")){ - // kv = [{"key":0,"value":0}]; - // data = {0:data}; - // }else{ - // // we need to use a path for each group. - // var kv = d3.entries(d3.keys(data)); - // kv = kv.map(function(d){ - // d[aes.group] = d.value; - // return d; - // }); - // } - - // For an example consider breakpointError$error which is - // defined using this R code - - // geom_line(aes(segments, error, group=bases.per.probe, - // clickSelects=bases.per.probe), data=only.error, lwd=4) - - // Inside update_geom the variables take the following values - // (pseudo-Javascript code) - - // var kv = [{"key":"0","value":"133","bases.per.probe":"133"}, - // {"key":"1","value":"2667","bases.per.probe":"2667"}]; - // var data = {"133":[array of 20 points used to draw the line for group 133], - // "2667":[array of 20 points used to draw the line for group 2667]}; - - // I do elements.data(kv) so that when I set the d attribute of - // each path, I need to select the correct group before - // returning anything. - - // e.attr("d",function(group_info){ - // var one_group = data[group_info.value]; - // return lineThing(one_group); - // }) - - // To make color work I think you just have to select the group - // and take the color of the first element, e.g. - - // .style("stroke",function(group_info){ - // var one_group = data[group_info.value]; - // var one_row = one_group[0]; - // return get_color(one_row); - // } - - // In order to get d3 lines to play nice, bind fake "data" (group - // id's) -- the kv variable. Then each separate object is plotted - // using path (case of only 1 thing and no groups). - - // we need to use a path for each group. - var keyed_data = {}, one_group, group_id, k; - for(group_id in data){ - one_group = data[group_id]; - one_row = one_group[0]; - if(one_row.hasOwnProperty("key")){ - k = one_row.key; - }else{ - k = group_id; - } - keyed_data[k] = one_group; - } - var kv_array = d3.entries(d3.keys(keyed_data)); - var kv = kv_array.map(function (d) { - //d[aes.group] = d.value; - - // Need to store the clickSelects value that will - // be passed to the selector when we click on this - // item. - d.clickSelects = keyed_data[d.value][0].clickSelects; - return d; - }); - - // line, path, and polygon use d3.svg.line(), - // ribbon uses d3.svg.area() - // we have to define lineThing accordingly. - if (g_info.geom == "ribbon") { - var lineThing = d3.svg.area() - .x(toXY("x", "x")) - .y(toXY("y", "ymax")) - .y0(toXY("y", "ymin")); - } else { - var lineThing = d3.svg.line() - .x(toXY("x", "x")) - .y(toXY("y", "y")); - } - // select the correct group before returning anything. - key_fun = function(group_info){ - return group_info.value; - }; - id_fun = function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; - }; - eActions = function (e) { - e.attr("d", function (d) { - var one_group = keyed_data[d.value]; - // filter NaN since they make the whole line disappear! - var no_na = one_group.filter(function(d){ - if(g_info.geom == "ribbon"){ - return !isNaN(d.x) && !isNaN(d.ymin) && !isNaN(d.ymax); - }else{ - return !isNaN(d.x) && !isNaN(d.y); - } - }); - return lineThing(no_na); - }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } - }; - eAppend = "path"; - }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; - } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; - } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - } - elements.exit().remove(); - var enter = elements.enter(); - if(g_info.aes.hasOwnProperty("href")){ - enter = enter.append("svg:a") - .append("svg:"+eAppend); - }else{ - enter = enter.append(eAppend) - .attr("class", "geom"); - } - if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; - elements.call(out_fun) - .on("mouseover", function (d) { - d3.select(this).call(over_fun); - }) - .on("mouseout", function (d) { - d3.select(this).call(out_fun); - }) - ; - if(has_clickSelects){ - elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. - var s_name = g_info.aes.clickSelects; - update_selector(s_name, d.clickSelects); - }); - }else{ - elements.on("click", function(d){ - var s_name = d["clickSelects.variable"]; - var s_value = d["clickSelects.value"]; - update_selector(s_name, s_value); - }); - } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } - } - var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); - if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } - if(has_tooltip){ - text_fun = function(d){ - return d.tooltip; - }; - }else if(has_clickSelects){ - text_fun = function(d){ - var v_name = g_info.aes.clickSelects; - return v_name + " " + d.clickSelects; - }; - }else{ //clickSelects_variable - text_fun = function(d){ - return d["clickSelects.variable"] + " " + d["clickSelects.value"]; - }; - } - // if elements have an existing title, remove it. - elements.selectAll("title").remove(); - elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) - ; - } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! - if(Selectors.hasOwnProperty(selector_name)){ - var milliseconds = Selectors[selector_name].duration; - elements = elements.transition().duration(milliseconds); - } - if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); - } - if(g_info.aes.hasOwnProperty("href")){ - // elements are , children are e.g. - var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); - }else{ - // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) - } - }; - - - - var value_tostring = function(selected_values) { - //function that is helpful to change the format of the string - var selector_url="#" - for (var selc_var in selected_values){ - if(selected_values.hasOwnProperty(selc_var)){ - var values_str=selected_values[selc_var].join(); - var sub_url=selc_var.concat("=","{",values_str,"}"); - selector_url=selector_url.concat(sub_url); - } - } - var url_nohash=window.location.href.match(/(^[^#]*)/)[0]; - selector_url=url_nohash.concat(selector_url); - return selector_url; - }; - - var get_values=function(){ - // function that is useful to get the selected values - var selected_values={} - for(var s_name in Selectors){ - var s_info=Selectors[s_name]; - var initial_selections = []; - if(s_info.type==="single"){ - initial_selections=[s_info.selected]; - } - else{ - for(var i in s_info.selected) { - initial_selections[i] = s_info.selected[i]; - } - } - selected_values[s_name]=initial_selections; - } - return selected_values; - }; - - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - - // update scales for the plots that have update_axes option in - // theme_animint - function update_scales(p_name, axes, v_name, value){ - // Get pre-computed domain - var axis_domains = Plots[p_name]["axis_domains"]; - if(!isArray(axes)){ - axes = [axes]; - } - if(axis_domains != null){ - axes.forEach(function(xyaxis){ - // For Each PANEL, update the axes - Plots[p_name].layout.PANEL.forEach(function(panel_i, i){ - // Determine whether this panel has a scale or not - // If not we just update the scales according to the common - // scale and skip the updating of axis - var draw_axes = Plots[p_name].layout["AXIS_"+ xyaxis.toUpperCase()][i]; - if(draw_axes){ - var use_panel = panel_i; - }else{ - var use_panel = Plots[p_name].layout.PANEL[0]; - } - // We update the current selection of the plot every time - // and use it to index the correct domain - var curr_select = axis_domains[xyaxis].curr_select; - if(axis_domains[xyaxis].selectors.indexOf(v_name) > -1){ - curr_select[v_name] = value; - var str = use_panel+"."; - for(selec in curr_select){ - str = str + curr_select[selec] + "_"; - } - str = str.substring(0, str.length - 1); // Strip off trailing underscore - var use_domain = axis_domains[xyaxis]["domains"][str]; - } - if(use_domain != null){ - Plots[p_name]["scales"][panel_i][xyaxis].domain(use_domain); - var scales = Plots[p_name]["scales"][panel_i][xyaxis]; - // major and minor grid lines as calculated in the compiler - var grid_vals = Plots[p_name]["axis_domains"][xyaxis]["grids"][str]; - - // Once scales are updated, update the axis ticks if needed - if(draw_axes){ - // Tick values are same as major grid lines - update_axes(p_name, xyaxis, panel_i, grid_vals[1]); - } - // Update major and minor grid lines - update_grids(p_name, xyaxis, panel_i, grid_vals, scales); - } - }); - }); - } - } - - // Update the axis ticks etc. once plot is zoomed in/out - // currently called from update_scales. - function update_axes(p_name, axes, panel_i, tick_vals){ - var orientation; - if(axes == "x"){ - orientation = "bottom"; - }else{ - orientation = "left"; - } - if(!isArray(tick_vals)){ - tick_vals = [tick_vals]; - } - var xyaxis = d3.svg.axis() - .scale(Plots[p_name]["scales"][panel_i][axes]) - .orient(orientation) - .tickValues(tick_vals); - // update existing axis - var xyaxis_g = element.select("#plot_"+p_name).select("."+axes+"axis_"+panel_i) - .transition() - .duration(1000) - .call(xyaxis); - } - - // Update major/minor grids once axes ticks have been updated - function update_grids(p_name, axes, panel_i, grid_vals, scales){ - // Select panel to update - var bgr = element.select("#plot_"+p_name).select(".bgr"+panel_i); - // Update major and minor grid lines - ["minor", "major"].forEach(function(grid_class, j){ - var lines = bgr.select(".grid_"+grid_class).select("."+axes); - var xy1, xy2; - if(axes == "x"){ - xy1 = lines.select("line").attr("y1"); - xy2 = lines.select("line").attr("y2"); - }else{ - xy1 = lines.select("line").attr("x1"); - xy2 = lines.select("line").attr("x2"); - } - - // Get default values for grid lines like colour, stroke etc. - var grid_background = Plots[p_name]["grid_"+grid_class]; - var col = grid_background.colour; - var lt = grid_background.linetype; - var size = grid_background.size; - var cap = grid_background.lineend; - - // Remove old lines - lines.selectAll("line") - .remove(); - - if(!isArray(grid_vals[j])){ - grid_vals[j] = [grid_vals[j]]; - } - - if(axes == "x"){ - lines.selectAll("line") - .data(grid_vals[j]) - .enter() - .append("line") - .attr("y1", xy1) - .attr("y2", xy2) - .attr("x1", function(d) { return scales(d); }) - .attr("x2", function(d) { return scales(d); }) - .style("stroke", col) - .style("stroke-linecap", cap) - .style("stroke-width", size) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(lt, size); - }); - }else{ - lines.selectAll("line") - .data(grid_vals[j]) - .enter() - .append("line") - .attr("x1", xy1) - .attr("x2", xy2) - .attr("y1", function(d) { return scales(d); }) - .attr("y2", function(d) { return scales(d); }) - .style("stroke", col) - .style("stroke-linecap", cap) - .style("stroke-width", size) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(lt, size); - }); - } - }); - } - - var update_selector = function (v_name, value) { - if(!Selectors.hasOwnProperty(v_name)){ - return; - } - value = value + ""; - var s_info = Selectors[v_name]; - if(s_info.type == "single"){ - // value is the new selection. - s_info.selected = value; - }else{ - // value should be added or removed from the selection. - var i_value = s_info.selected.indexOf(value); - if(i_value == -1){ - // not found, add to selection. - s_info.selected.push(value); - }else{ - // found, remove from selection. - s_info.selected.splice(i_value, 1); - } - } - // update_selector_url() - // if there are levels, then there is a selectize widget which - // should be updated. - if(isArray(s_info.levels)){ - // the jquery ids - if(s_info.type == "single") { - var selected_ids = v_name.concat("___", value); - } else { - var selected_ids = []; - for(i in s_info.selected) { - selected_ids[i] = v_name.concat("___", s_info.selected[i]); - } - } - // from - // https://github.com/brianreavis/selectize.js/blob/master/docs/api.md: - // setValue(value, silent) If "silent" is truthy, no change - // event will be fired on the original input. - selectized_array[v_name].setValue(selected_ids, true); - } - - // For each updated geom, check if the axes of the plot need to be - // updated and update them - s_info.update.forEach(function(g_name){ - var plot_name = g_name.split("_").pop(); - var axes = Plots[plot_name]["options"]["update_axes"]; - if(axes != null){ - update_scales(plot_name, axes, v_name, value); - } - }); - - update_legend_opacity(v_name); - s_info.update.forEach(function(g_name){ - update_geom(g_name, v_name); - }); - }; - - var ifSelectedElse = function (s_value, s_name, selected, not_selected) { - var is_selected; - var s_info = Selectors[s_name]; - if(s_info.type == "single"){ - is_selected = s_value == s_info.selected; - }else{ - is_selected = s_info.selected.indexOf(s_value) != -1; - } - if(is_selected){ - return selected; - } else { - return not_selected; - } - }; - - function update_next_animation(){ - var values = d3.values(Animation.done_geoms); - if(d3.sum(values) == values.length){ - // If the values in done_geoms are all 1, then we have loaded - // all of the animation-related chunks, and we can start - // playing the animation. - var v_name = Animation.variable; - var cur = Selectors[v_name].selected; - var next = Animation.next[cur]; - update_selector(v_name, next); - } - } - - // The main idea of how legends work: - - // 1. In getLegend in animint.R I export the legend entries as a - // list of rows that can be used in a data() bind in D3. - - // 2. Here in add_legend I create a for every legend, and - // then I bind the legend entries to ,
, and elements. - var add_legend = function(p_name, p_info){ - // case of multiple legends, d3 reads legend structure in as an array - var tdRight = element.select("td."+p_name+"_legend"); - var legendkeys = d3.keys(p_info.legend); - for(var i=0; i-1){ - // aesthetics that would draw a rect - legend_svgs.append("rect") - .attr("x", 2) - .attr("y", 2) - .attr("width", 10) - .attr("height", 10) - .style("stroke-width", function(d){return d["polygonsize"]||1;}) - .style("stroke-dasharray", function(d){ - return linetypesize2dasharray(d["polygonlinetype"], d["size"]||2); - }) - .style("stroke", function(d){return d["polygoncolour"] || "#000000";}) - .style("fill", function(d){return d["polygonfill"] || "#FFFFFF";}) - .style("opacity", function(d){return d["polygonalpha"]||1;}); - } - if(l_info.geoms.indexOf("text")>-1){ - // aesthetics that would draw a rect - legend_svgs.append("text") - .attr("x", 10) - .attr("y", 14) - .style("fill", function(d){return d["textcolour"]||1;}) - .style("text-anchor", "middle") - .attr("font-size", function(d){return d["textsize"]||1;}) - .text("a"); - } - if(l_info.geoms.indexOf("path")>-1){ - // aesthetics that would draw a line - legend_svgs.append("line") - .attr("x1", 1).attr("x2", 19).attr("y1", 7).attr("y2", 7) - .style("stroke-width", function(d){ - return linescale(d["pathsize"])||2; - }) - .style("stroke-dasharray", function(d){ - return linetypesize2dasharray(d["pathlinetype"], d["pathsize"] || 2); - }) - .style("stroke", function(d){return d["pathcolour"] || "#000000";}) - .style("opacity", function(d){return d["pathalpha"]||1;}); - } - if(l_info.geoms.indexOf("point")>-1){ - // aesthetics that would draw a point - legend_svgs.append("circle") - .attr("cx", 10) - .attr("cy", 7) - .attr("r", function(d){return pointscale(d["pointsize"])||4;}) - .style("stroke", function(d){return d["pointcolour"] || "#000000";}) - .style("fill", function(d){ - return d["pointfill"] || d["pointcolour"] || "#000000"; - }) - .style("opacity", function(d){return d["pointalpha"]||1;}); - } - legend_rows.append("td") - .attr("align", "left") // TODO: right for numbers? - .attr("class", "legend_entry_label") - .attr("id", function(d){ return d["id"]+"_label"; }) - .style("font-size", function(d){ return d["text_size"]}) - .text(function(d){ return d["label"];}); - } - } - - // Download the main description of the interactive plot. - d3.json(json_file, function (error, response) { - if(response.hasOwnProperty("title")){ - // This selects the title of the web page, outside of wherever - // the animint is defined, usually a
-- so it is OK to use - // global d3.select here. - d3.select("title").text(response.title); - } - // Add plots. - for (var p_name in response.plots) { - add_plot(p_name, response.plots[p_name]); - add_legend(p_name, response.plots[p_name]); - // Append style sheet to document head. - css.appendChild(document.createTextNode(styles.join(" "))); - document.head.appendChild(css); - } - // Then add selectors and start downloading the first data subset. - for (var s_name in response.selectors) { - add_selector(s_name, response.selectors[s_name]); - } - - // Update the scales/axes of the plots if needed - // We do this so that the plots zoom in initially after loading - for (var p_name in response.plots) { - if(response.plots[p_name].axis_domains !== null){ - for(var xy in response.plots[p_name].axis_domains){ - var selectors = response.plots[p_name].axis_domains[xy].selectors; - if(!isArray(selectors)){ - selectors = [selectors]; - } - update_scales(p_name, xy, selectors[0], - response.selectors[selectors[0]].selected); - } - } - } - - //////////////////////////////////////////// - // Widgets at bottom of page - //////////////////////////////////////////// - element.append("br"); - - // loading table. - var show_hide_table = element.append("button") - .text("Show download status table"); - show_hide_table - .on("click", function(){ - if(this.textContent == "Show download status table"){ - loading.style("display", ""); - show_hide_table.text("Hide download status table"); - }else{ - loading.style("display", "none"); - show_hide_table.text("Show download status table"); - } - }); - var loading = element.append("table") - .style("display", "none"); - Widgets["loading"] = loading; - var tr = loading.append("tr"); - tr.append("th").text("geom"); - tr.append("th").attr("class", "chunk").text("selected chunk"); - tr.append("th").attr("class", "downloaded").text("downloaded"); - tr.append("th").attr("class", "total").text("total"); - tr.append("th").attr("class", "status").text("status"); - - // Add geoms and construct nest operators. - for (var g_name in response.geoms) { - add_geom(g_name, response.geoms[g_name]); - } - - // Animation control widgets. - var show_message = "Show animation controls"; - // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") - .text(show_message) - .attr("id", viz_id + "_show_hide_animation_controls") - .on("click", function(){ - if(this.textContent == show_message){ - time_table.style("display", ""); - show_hide_animation_controls.text("Hide animation controls"); - }else{ - time_table.style("display", "none"); - show_hide_animation_controls.text(show_message); - } - }) - ; - // table of the animint widgets - var time_table = element.append("table") - .style("display", "none"); - var first_tr = time_table.append("tr"); - var first_th = first_tr.append("th"); - // if there's a time variable, add a button to pause the animint - if(response.time){ - Animation.next = {}; - Animation.ms = response.time.ms; - Animation.variable = response.time.variable; - Animation.sequence = response.time.sequence; - Widgets["play_pause"] = first_th.append("button") - .text("Play") - .attr("id", "play_pause") - .on("click", function(){ - if(this.textContent == "Play"){ - Animation.play(); - }else{ - Animation.pause(false); - } - }) - ; - } - first_tr.append("th").text("milliseconds"); - if(response.time){ - var second_tr = time_table.append("tr"); - second_tr.append("td").text("updates"); - second_tr.append("td").append("input") - .attr("id", "updates_ms") - .attr("type", "text") - .attr("value", Animation.ms) - .on("change", function(){ - Animation.pause(false); - Animation.ms = this.value; - Animation.play(); - }) - ; - } - for(s_name in Selectors){ - var s_info = Selectors[s_name]; - if(!s_info.hasOwnProperty("duration")){ - s_info.duration = 0; - } - } - var selector_array = d3.keys(Selectors); - var duration_rows = time_table.selectAll("tr.duration") - .data(selector_array) - .enter() - .append("tr"); - duration_rows - .append("td") - .text(function(s_name){return s_name;}); - var duration_tds = duration_rows.append("td"); - var duration_inputs = duration_tds - .append("input") - .attr("id", function(s_name){ - return viz_id + "_duration_ms_" + s_name; - }) - .attr("type", "text") - .on("change", function(s_name){ - Selectors[s_name].duration = this.value; - }) - .attr("value", function(s_name){ - return Selectors[s_name].duration; - }); - // selector widgets - var toggle_message = "Show selection menus"; - var show_or_hide_fun = function(){ - if(this.textContent == toggle_message){ - selector_table.style("display", ""); - show_hide_selector_widgets.text("Hide selection menus"); - d3.select(".urltable").style("display","") - }else{ - selector_table.style("display", "none"); - show_hide_selector_widgets.text(toggle_message); - d3.select(".urltable").style("display","none") - } - } - var show_hide_selector_widgets = element.append("button") - .text(toggle_message) - .attr("class", "show_hide_selector_widgets") - .on("click", show_or_hide_fun) - ; - // adding a table for selector widgets - var selector_table = element.append("table") - .style("display", "none") - .attr("class", "table_selector_widgets") - ; - var selector_first_tr = selector_table.append("tr"); - selector_first_tr - .append("th") - .text("Variable") - ; - selector_first_tr - .append("th") - .text("Selected value(s)") - ; - - // looping through and adding a row for each selector - for(s_name in Selectors) { - var s_info = Selectors[s_name]; - // for .variable .value selectors, levels is undefined and we do - // not want to make a selectize widget. - - // TODO: why does it take so long to initialize the selectize - // widget when there are many (>1000) values? - if(isArray(s_info.levels)){ - // If there were no geoms that specified clickSelects for this - // selector, then there is no way to select it other than the - // selectize widgets (and possibly legends). So in this case - // we show the selectize widgets by default. - var selector_widgets_hidden = - show_hide_selector_widgets.text() == toggle_message; - var has_no_clickSelects = - !Selectors[s_name].hasOwnProperty("clickSelects") - var has_no_legend = - !Selectors[s_name].hasOwnProperty("legend") - if(selector_widgets_hidden && has_no_clickSelects && has_no_legend){ - var node = show_hide_selector_widgets.node(); - show_or_hide_fun.apply(node); - } - // removing "." from name so it can be used in ids - var s_name_id = legend_class_name(s_name); - - // adding a row for each selector - var selector_widget_row = selector_table - .append("tr") - .attr("class", function() { return s_name_id + "_selector_widget"; }) - ; - selector_widget_row.append("td").text(s_name); - // adding the selector - var selector_widget_select = selector_widget_row - .append("td") - .append("select") - .attr("class", function() { return s_name_id + "_input"; }) - .attr("placeholder", function() { return "Toggle " + s_name; }); - // adding an option for each level of the variable - selector_widget_select.selectAll("option") - .data(s_info.levels) - .enter() - .append("option") - .attr("value", function(d) { return d; }) - .text(function(d) { return d; }); - // making sure that the first option is blank - selector_widget_select - .insert("option") - .attr("value", "") - .text(function() { return "Toggle " + s_name; }); - - // calling selectize - var selectize_selector = to_select + ' .' + s_name_id + "_input"; - if(s_info.type == "single") { - // setting up array of selector and options - var selector_values = []; - for(i in s_info.levels) { - selector_values[i] = { - id: s_name.concat("___", s_info.levels[i]), - text: s_info.levels[i] - }; - } - // the id of the first selector - var selected_id = s_name.concat("___", s_info.selected); - - // if single selection, only allow one item - var $temp = $(selectize_selector) - .selectize({ - create: false, - valueField: 'id', - labelField: 'text', - searchField: ['text'], - options: selector_values, - items: [selected_id], - maxItems: 1, - allowEmptyOption: true, - onChange: function(value) { - // extracting the name and the level to update - var selector_name = value.split("___")[0]; - var selected_level = value.split("___")[1]; - // updating the selector - update_selector(selector_name, selected_level); - } - }) - ; - } else { // multiple selection: - // setting up array of selector and options - var selector_values = []; - if(typeof s_info.levels == "object") { - for(i in s_info.levels) { - selector_values[i] = { - id: s_name.concat("___", s_info.levels[i]), - text: s_info.levels[i] - }; - } - } else { - selector_values[0] = { - id: s_name.concat("___", s_info.levels), - text: s_info.levels - }; - } - // setting up an array to contain the initally selected elements - var initial_selections = []; - for(i in s_info.selected) { - initial_selections[i] = s_name.concat("___", s_info.selected[i]); - } - - // construct the selectize - var $temp = $(selectize_selector) - .selectize({ - create: false, - valueField: 'id', - labelField: 'text', - searchField: ['text'], - options: selector_values, - items: initial_selections, - maxItems: s_info.levels.length, - allowEmptyOption: true, - onChange: function(value) { - // if nothing is selected, remove what is currently selected - if(value == null) { - // extracting the selector ids from the options - var the_ids = Object.keys($(this)[0].options); - // the name of the appropriate selector - var selector_name = the_ids[0].split("___")[0]; - // the previously selected elements - var old_selections = Selectors[selector_name].selected; - // updating the selector for each of the old selections - old_selections.forEach(function(element) { - update_selector(selector_name, element); - }); - } else { // value is not null: - // grabbing the name of the selector from the selected value - var selector_name = value[0].split("___")[0]; - // identifying the levels that should be selected - var specified_levels = []; - for(i in value) { - specified_levels[i] = value[i].split("___")[1]; - } - // the previously selected entries - old_selections = Selectors[selector_name].selected; - - // the levels that need to have selections turned on - specified_levels - .filter(function(n) { - return old_selections.indexOf(n) == -1; - }) - .forEach(function(element) { - update_selector(selector_name, element); - }) - ; - // the levels that need to be turned off - // - same approach - old_selections - .filter(function(n) { - return specified_levels.indexOf(n) == -1; - }) - .forEach(function(element) { - update_selector(selector_name, element); - }) - ; - }//value==null - }//onChange - })//selectize - ; - }//single or multiple selection. - selectized_array[s_name] = $temp[0].selectize; - }//levels, is.variable.value - } // close for loop through selector widgets - // If this is an animation, then start downloading all the rest of - // the data, and start the animation. - if (response.time) { - var i, prev, cur; - for (var i = 0; i < Animation.sequence.length; i++) { - if (i == 0) { - prev = Animation.sequence[Animation.sequence.length-1]; - } else { - prev = Animation.sequence[i - 1]; - } - cur = Animation.sequence[i]; - Animation.next[prev] = cur; - } - Animation.timer = null; - Animation.play = function(){ - if(Animation.timer == null){ // only play if not already playing. - // as shown on http://bl.ocks.org/mbostock/3808234 - Animation.timer = setInterval(update_next_animation, Animation.ms); - Widgets["play_pause"].text("Pause"); - } - }; - Animation.play_after_visible = false; - Animation.pause = function(play_after_visible){ - Animation.play_after_visible = play_after_visible; - clearInterval(Animation.timer); - Animation.timer = null; - Widgets["play_pause"].text("Play"); - }; - var s_info = Selectors[Animation.variable]; - Animation.done_geoms = {}; - s_info.update.forEach(function(g_name){ - var g_info = Geoms[g_name]; - if(g_info.chunk_order.length == 1 && - g_info.chunk_order[0] == Animation.variable){ - g_info.seq_i = Animation.sequence.indexOf(s_info.selected); - g_info.seq_count = 0; - Animation.done_geoms[g_name] = 0; - download_next(g_name); - } - }); - Animation.play(); - all_geom_names = d3.keys(response.geoms); - - // This code starts/stops the animation timer when the page is - // hidden, inspired by - // http://stackoverflow.com/questions/1060008 - function onchange (evt) { - if(document.visibilityState == "visible"){ - if(Animation.play_after_visible){ - Animation.play(); - } - }else{ - if(Widgets["play_pause"].text() == "Pause"){ - Animation.pause(true); - } - } - }; - document.addEventListener("visibilitychange", onchange); - } - // update_selector_url() - var check_func=function(){ - var status_array = $('.status').map(function(){ - return $.trim($(this).text()); - }).get(); - status_array=status_array.slice(1) - return status_array.every(function(elem){ return elem === "displayed"}); - } - if(window.location.hash) { - var fragment=window.location.hash; - fragment=fragment.slice(1); - fragment=decodeURI(fragment) - var frag_array=fragment.split(/(.*?})/); - frag_array=frag_array.filter(function(x){ return x!=""}) - frag_array.forEach(function(selector_string){ - var selector_hash=selector_string.split("="); - var selector_nam=selector_hash[0]; - var selector_values=selector_hash[1]; - var re = /\{(.*?)\}/; - selector_values = re.exec(selector_values)[1]; - var array_values = selector_values.split(','); - if(Selectors.hasOwnProperty(selector_nam)){ - var s_info = Selectors[selector_nam] - if(s_info.type=="single"){//TODO fix - array_values.forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time)Animation.pause(true) - }); - }else{ - var old_selections = Selectors[selector_nam].selected; - // the levels that need to have selections turned on - array_values - .filter(function(n) { - return old_selections.indexOf(n) == -1; - }) - .forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time){ - Animation.pause(true) - } - }); - old_selections - .filter(function(n) { - return array_values.indexOf(n) == -1; - }) - .forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time){ - Animation.pause(true) - } - }); - }//if(single) else multiple selection - }//if(Selectors.hasOwnProperty(selector_nam)) - })//frag_array.forEach - }//if(window.location.hash) - }); -}; - - diff --git a/docs/articles/showselectedassociations/animint.js b/docs/articles/showselectedassociations/animint.js deleted file mode 100644 index 01dd1e740..000000000 --- a/docs/articles/showselectedassociations/animint.js +++ /dev/null @@ -1,2690 +0,0 @@ -// Define functions to render linked interactive plots using d3. -// Another script should define e.g. -// -// Constructor for animint Object. -var animint = function (to_select, json_file) { - - var default_axis_px = 16; - - function wait_until_then(timeout, condFun, readyFun) { - var args=arguments - function checkFun() { - if(condFun()) { - readyFun(args[3],args[4]); - } else{ - setTimeout(checkFun, timeout); - } - } - checkFun(); - } - - function convert_R_types(resp_array, types){ - return resp_array.map(function (d) { - for (var v_name in d) { - if(!is_interactive_aes(v_name)){ - var r_type = types[v_name]; - if (r_type == "integer") { - d[v_name] = parseInt(d[v_name]); - } else if (r_type == "numeric") { - d[v_name] = parseFloat(d[v_name]); - } else if (r_type == "factor" || r_type == "rgb" - || r_type == "linetype" || r_type == "label" - || r_type == "character") { - // keep it as a character - } else if (r_type == "character" & v_name == "outliers") { - d[v_name] = parseFloat(d[v_name].split(" @ ")); - } - } - } - return d; - }); - } - - // replacing periods in variable with an underscore this makes sure - // that selector doesn't confuse . in name with css selectors - function safe_name(unsafe_name){ - return unsafe_name.replace(/[ .]/g, '_'); - } - function legend_class_name(selector_name){ - return safe_name(selector_name) + "_variable"; - } - - function is_interactive_aes(v_name){ - if(v_name.indexOf("clickSelects") > -1){ - return true; - } - if(v_name.indexOf("showSelected") > -1){ - return true; - } - return false; - } - - var linetypesize2dasharray = function (lt, size) { - var isInt = function(n) { - return typeof n === 'number' && parseFloat(n) == parseInt(n, 10) && !isNaN(n); - }; - if(isInt(lt)){ // R integer line types. - if(lt == 1){ - return null; - } - var o = { - 0: size * 0 + "," + size * 10, - 2: size * 4 + "," + size * 4, - 3: size + "," + size * 2, - 4: size + "," + size * 2 + "," + size * 4 + "," + size * 2, - 5: size * 8 + "," + size * 4, - 6: size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2 - }; - } else { // R defined line types - if(lt == "solid" || lt === null){ - return null; - } - var o = { - "blank": size * 0 + "," + size * 10, - "none": size * 0 + "," + size * 10, - "dashed": size * 4 + "," + size * 4, - "dotted": size + "," + size * 2, - "dotdash": size + "," + size * 2 + "," + size * 4 + "," + size * 2, - "longdash": size * 8 + "," + size * 4, - "twodash": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, - "22": size * 2 + "," + size * 2, - "42": size * 4 + "," + size * 2, - "44": size * 4 + "," + size * 4,"13": size + "," + size * 3, - "1343": size + "," + size * 3 + "," + size * 4 + "," + size * 3, - "73": size * 7 + "," + size * 3, - "2262": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, - "12223242": size + "," + size * 2 + "," + size * 2 + "," + size * 2 + "," + size * 3 + "," + size * 2 + "," + size * 4 + "," + size * 2, - "F282": size * 15 + "," + size * 2 + "," + size * 8 + "," + size * 2, - "F4448444": size * 15 + "," + size * 4 + "," + size * 4 + "," + size * 4 + "," + size * 8 + "," + size * 4 + "," + size * 4 + "," + size * 4, - "224282F2": size * 2 + "," + size * 2 + "," + size * 4 + "," + size * 2 + "," + size * 8 + "," + size * 2 + "," + size * 16 + "," + size * 2, - "F1": size * 16 + "," + size - }; - } - - if (lt in o){ - return o[lt]; - } else{ // manually specified line types - str = lt.split(""); - strnum = str.map(function (d) { - return size * parseInt(d, 16); - }); - return strnum; - } - }; - - var isArray = function(o) { - return Object.prototype.toString.call(o) === '[object Array]'; - }; - - // create a dummy element, apply the appropriate classes, - // and then measure the element - // Inspired from http://jsfiddle.net/uzddx/2/ - var measureText = function(pText, pFontSize, pAngle, pStyle) { - if (!pText || pText.length === 0) return {height: 0, width: 0}; - if (pAngle === null || isNaN(pAngle)) pAngle = 0; - - var container = element.append('svg'); - // do we need to set the class so that styling is applied? - //.attr('class', classname); - - container.append('text') - .attr({x: -1000, y: -1000}) - .attr("transform", "rotate(" + pAngle + ")") - .attr("style", pStyle) - .attr("font-size", pFontSize) - .text(pText); - - var bbox = container.node().getBBox(); - container.remove(); - - return {height: bbox.height, width: bbox.width}; - }; - - var nest_by_group = d3.nest().key(function(d){ return d.group; }); - var dirs = json_file.split("/"); - dirs.pop(); //if a directory path exists, remove the JSON file from dirs - var element = d3.select(to_select); - this.element = element; - var viz_id = element.attr("id"); - var Widgets = {}; - this.Widgets = Widgets; - var Selectors = {}; - this.Selectors = Selectors; - var Plots = {}; - this.Plots = Plots; - var Geoms = {}; - this.Geoms = Geoms; - // SVGs must be stored separately from Geoms since they are - // initialized first, with the Plots. - var SVGs = {}; - this.SVGs = SVGs; - var Animation = {}; - this.Animation = Animation; - var all_geom_names = {}; - this.all_geom_names = all_geom_names; - - //creating an array to contain the selectize widgets - var selectized_array = []; - var data_object_geoms = { - "line":true, - "path":true, - "ribbon":true, - "polygon":true - }; - var css = document.createElement('style'); - css.type = 'text/css'; - var styles = [".axis path{fill: none;stroke: black;shape-rendering: crispEdges;}", - ".axis line{fill: none;stroke: black;shape-rendering: crispEdges;}", - ".axis text {font-family: sans-serif;font-size: 11px;}"]; - - var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; - // Determine if data will be an object or an array. - if(g_info.geom in data_object_geoms){ - g_info.data_is_object = true; - }else{ - g_info.data_is_object = false; - } - // Add a row to the loading table. - g_info.tr = Widgets["loading"].append("tr"); - g_info.tr.append("td").text(g_name); - g_info.tr.append("td").attr("class", "chunk"); - g_info.tr.append("td").attr("class", "downloaded").text(0); - g_info.tr.append("td").text(g_info.total); - g_info.tr.append("td").attr("class", "status").text("initialized"); - - // load chunk tsv - g_info.data = {}; - g_info.download_status = {}; - Geoms[g_name] = g_info; - // Determine whether common chunk tsv exists - // If yes, load it - if(g_info.hasOwnProperty("columns") && g_info.columns.common){ - var common_tsv = get_tsv(g_info, "_common"); - g_info.common_tsv = common_tsv; - var common_path = getTSVpath(common_tsv); - d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); - }); - } else { - g_info.common_tsv = null; - } - // Save this geom and load it! - update_geom(g_name, null); - }; - var add_plot = function (p_name, p_info) { - // Each plot may have one or more legends. To make space for the - // legends, we put each plot in a table with one row and two - // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); - var plot_tr = plot_table.append("tr"); - var tdLeft = plot_tr.append("td"); - var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); - if(viz_id === null){ - p_info.plot_id = p_name; - }else{ - p_info.plot_id = viz_id + "_" + p_name; - } - var svg = tdLeft.append("svg") - .attr("id", p_info.plot_id) - .attr("height", p_info.options.height) - .attr("width", p_info.options.width); - - // divvy up width/height based on the panel layout - var nrows = Math.max.apply(null, p_info.layout.ROW); - var ncols = Math.max.apply(null, p_info.layout.COL); - var panel_names = p_info.layout.PANEL; - var npanels = Math.max.apply(null, panel_names); - - // Note axis names are "shared" across panels (just like the title) - var xtitlepadding = 5 + measureText(p_info["xtitle"], default_axis_px).height; - var ytitlepadding = 5 + measureText(p_info["ytitle"], default_axis_px).height; - - // 'margins' are fixed across panels and do not - // include title/axis/label padding (since these are not - // fixed across panels). They do, however, account for - // spacing between panels - var text_height_pixels = measureText("foo", 11).height; - var margin = { - left: 0, - right: text_height_pixels * p_info.panel_margin_lines, - top: text_height_pixels * p_info.panel_margin_lines, - bottom: 0 - }; - var plotdim = { - width: 0, - height: 0, - xstart: 0, - xend: 0, - ystart: 0, - yend: 0, - graph: { - width: 0, - height: 0 - }, - margin: margin, - xlab: { - x: 0, - y: 0 - }, - ylab: { - x: 0, - y: 0 - }, - title: { - x: 0, - y: 0 - } - }; - - // Draw the title - var titlepadding = measureText(p_info.title, p_info.title_size).height; - // why are we giving the title padding if it is undefined? - if (p_info.title === undefined) titlepadding = 0; - plotdim.title.x = p_info.options.width / 2; - plotdim.title.y = titlepadding; - svg.append("text") - .text(p_info.title) - .attr("class", "plottitle") - .attr("font-family", "sans-serif") - .attr("font-size", p_info.title_size) - .attr("transform", "translate(" + plotdim.title.x + "," + - plotdim.title.y + ")") - .style("text-anchor", "middle"); - - // grab max text size over axis labels and facet strip labels - var axispaddingy = 5; - if(p_info.hasOwnProperty("ylabs") && p_info.ylabs.length){ - axispaddingy += Math.max.apply(null, p_info.ylabs.map(function(entry){ - // + 5 to give a little extra space to avoid bad axis labels - // in shiny. - return measureText(entry, p_info.ysize).width + 5; - })); - } - var axispaddingx = 10 + 20; - if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ - // TODO: throw warning if text height is large portion of plot height? - axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ - return measureText(entry, p_info.xsize, p_info.xangle).height; - })); - // TODO: carefully calculating this gets complicated with rotating xlabs - //margin.right += 5; - } - plotdim.margin = margin; - - var strip_heights = p_info.strips.top.map(function(entry){ - return measureText(entry, p_info.strip_text_xsize).height; - }); - var strip_widths = p_info.strips.right.map(function(entry){ - return measureText(entry, p_info.strip_text_ysize).height; - }); - - // compute the number of x/y axes, max strip height per row, and - // max strip width per columns, for calculating height/width of - // graphing region. - var row_strip_heights = []; - var col_strip_widths = []; - var n_xaxes = 0; - var n_yaxes = 0; - var current_row, current_col; - for (var layout_i = 0; layout_i < npanels; layout_i++) { - current_row = p_info.layout.ROW[layout_i] - 1; - current_col = p_info.layout.COL[layout_i] - 1; - if(row_strip_heights[current_row] === undefined){ - row_strip_heights[current_row] = []; - } - if(col_strip_widths[current_col] === undefined){ - col_strip_widths[current_col] = []; - } - row_strip_heights[current_row].push(strip_heights[layout_i]); - col_strip_widths[current_col].push(strip_widths[layout_i]); - if (p_info.layout.COL[layout_i] == 1) { - n_xaxes += p_info.layout.AXIS_X[layout_i]; - } - if (p_info.layout.ROW[layout_i] == 1) { - n_yaxes += p_info.layout.AXIS_Y[layout_i]; - } - } - function cumsum_array(array_of_arrays){ - var cumsum = [], max_value, cumsum_value = 0; - for(var i=0; i 1) { - background.append("rect") - .attr("x", plotdim.xstart) - .attr("y", plotdim.ystart) - .attr("width", plotdim.xend - plotdim.xstart) - .attr("height", plotdim.yend - plotdim.ystart) - .attr("class", "background_rect") - .style("fill", p_info.panel_background.fill) - .style("stroke", p_info.panel_background.colour) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(p_info.panel_background.linetype, - p_info.panel_background.size); - }); - } - - // drawing the grid lines - ["grid_minor", "grid_major"].forEach(function(grid_class){ - var grid_background = p_info[grid_class]; - // if grid lines are defined - if(grid_background.hasOwnProperty("size")) { - var grid = background.append("g") - .attr("class", grid_class); - ["x","y"].forEach(function(scale_var){ - var const_var; - if(scale_var == "x"){ - const_var = "y"; - }else{ - const_var = "x"; - } - grid.append("g") - .attr("class", scale_var) - .selectAll("line") - .data(grid_background.loc[scale_var][layout_i]) - .enter() - .append("line") - .attr(const_var + "1", plotdim[const_var + "start"]) - .attr(const_var + "2", plotdim[const_var + "end"]) - .attr(scale_var + "1", function(d) { - return scales[panel_i][scale_var](d); - }) - .attr(scale_var + "2", function(d) { - return scales[panel_i][scale_var](d); - }) - .style("stroke", grid_background.colour) - .style("stroke-linecap", grid_background.lineend) - .style("stroke-width", grid_background.size) - .style("stroke-dasharray", linetypesize2dasharray( - grid_background.linetype, grid_background.size)) - ; - }); - } - }); - - // drawing border - // uses insert to draw it right before the #plottitle - if(Object.keys(p_info.panel_border).length > 1) { - background.append("rect") - .attr("x", plotdim.xstart) - .attr("y", plotdim.ystart) - .attr("width", plotdim.xend - plotdim.xstart) - .attr("height", plotdim.yend - plotdim.ystart) - .attr("class", "border_rect") - .style("fill", p_info.panel_border.fill) - .style("stroke", p_info.panel_border.colour) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(p_info.panel_border.linetype, - p_info.panel_border.size); - }); - } - - } //end of for(layout_i - // After drawing all backgrounds, we can draw the axis labels. - if(p_info["ytitle"]){ - svg.append("text") - .text(p_info["ytitle"]) - .attr("class", "ytitle") - .style("text-anchor", "middle") - .style("font-size", default_axis_px + "px") - .attr("transform", "translate(" + - ytitle_x + - "," + - (ytitle_top + ytitle_bottom)/2 + - ")rotate(270)") - ; - } - if(p_info["xtitle"]){ - svg.append("text") - .text(p_info["xtitle"]) - .attr("class", "xtitle") - .style("text-anchor", "middle") - .style("font-size", default_axis_px + "px") - .attr("transform", "translate(" + - (xtitle_left + xtitle_right)/2 + - "," + - xtitle_y + - ")") - ; - } - Plots[p_name].scales = scales; - }; //end of add_plot() - - function update_legend_opacity(v_name){ - var s_info = Selectors[v_name]; - s_info.legend_tds.style("opacity", s_info.legend_update_fun); - } - - var add_selector = function (s_name, s_info) { - Selectors[s_name] = s_info; - if(s_info.type == "multiple"){ - if(!isArray(s_info.selected)){ - s_info.selected = [s_info.selected]; - } - // legend_update_fun is evaluated in the context of the - // td.legend_entry_label. - s_info.legend_update_fun = function(d){ - var i_value = s_info.selected.indexOf(this.textContent); - if(i_value == -1){ - return 0.5; - }else{ - return 1; - } - } - }else{ - s_info.legend_update_fun = function(d){ - if(this.textContent == s_info.selected){ - return 1; - }else{ - return 0.5; - } - } - } - s_info.legend_tds = - element.selectAll("tr."+legend_class_name(s_name)+" td.legend_entry_label") - ; - update_legend_opacity(s_name); - }; //end of add_selector() - - function get_tsv(g_info, chunk_id){ - return g_info.classed + "_chunk" + chunk_id + ".tsv"; - } - function getTSVpath(tsv_name){ - return dirs.concat(tsv_name).join("/"); - } - - /** - * copy common chunk tsv to varied chunk tsv, returning an array of - * objects. - */ - function copy_chunk(g_info, varied_chunk) { - var varied_by_group = nest_by_group.map(varied_chunk); - var common_by_group = g_info.data[g_info.common_tsv]; - var new_varied_chunk = []; - for(group_id in varied_by_group){ - var varied_one_group = varied_by_group[group_id]; - var common_one_group = common_by_group[group_id]; - var common_i = 0; - for(var varied_i=0; varied_i < varied_one_group.length; varied_i++){ - // there are two cases: each group of varied data is of length - // 1, or of length of the common data. - if(common_one_group.length == varied_one_group.length){ - common_i = varied_i; - } - var varied_obj = varied_one_group[varied_i]; - var common_obj = common_one_group[common_i]; - for(col in common_obj){ - if(col != "group"){ - varied_obj[col] = common_obj[col]; - } - } - new_varied_chunk.push(varied_obj); - } - } - return new_varied_chunk; - } - - // update_geom is called from add_geom and update_selector. It - // downloads data if necessary, and then calls draw_geom. - var update_geom = function (g_name, selector_name) { - var g_info = Geoms[g_name]; - // First apply chunk_order selector variables. - var chunk_id = g_info.chunks; - g_info.chunk_order.forEach(function (v_name) { - if(chunk_id == null){ - return; // no data in a higher up chunk var. - } - var value = Selectors[v_name].selected; - if(chunk_id.hasOwnProperty(value)){ - chunk_id = chunk_id[value]; - }else{ - chunk_id = null; // no data to show in this subset. - } - }); - if(chunk_id == null){ - draw_panels(g_info, [], selector_name); //draw nothing. - return; - } - var tsv_name = get_tsv(g_info, chunk_id); - // get the data if it has not yet been downloaded. - g_info.tr.select("td.chunk").text(tsv_name); - if(g_info.data.hasOwnProperty(tsv_name)){ - draw_panels(g_info, g_info.data[tsv_name], selector_name); - }else{ - g_info.tr.select("td.status").text("downloading"); - var svg = SVGs[g_name]; - var loading = svg.append("text") - .attr("class", "loading"+tsv_name) - .text("Downloading "+tsv_name+"...") - .attr("font-size", 9) - //.attr("x", svg.attr("width")/2) - .attr("y", 10) - .style("fill", "red"); - download_chunk(g_info, tsv_name, function(chunk){ - loading.remove(); - draw_panels(g_info, chunk, selector_name); - }); - } - }; - var draw_panels = function(g_info, chunk, selector_name) { - // derive the plot name from the geometry name - var g_names = g_info.classed.split("_"); - var p_name = g_names[g_names.length - 1]; - var panels = Plots[p_name].layout.PANEL; - panels.forEach(function(panel) { - draw_geom(g_info, chunk, selector_name, panel); - }); - }; - - function download_next(g_name){ - var g_info = Geoms[g_name]; - var selector_value = Animation.sequence[g_info.seq_i]; - var chunk_id = g_info.chunks[selector_value]; - var tsv_name = get_tsv(g_info, chunk_id); - g_info.seq_count += 1; - if(Animation.sequence.length == g_info.seq_count){ - Animation.done_geoms[g_name] = 1; - return; - } - g_info.seq_i += 1; - if(g_info.seq_i == Animation.sequence.length){ - g_info.seq_i = 0; - } - if(typeof(chunk_id) == "string"){ - download_chunk(g_info, tsv_name, function(chunk){ - download_next(g_name); - }) - }else{ - download_next(g_name); - } - } - - // download_chunk is called from update_geom and download_next. - function download_chunk(g_info, tsv_name, funAfter){ - if(g_info.download_status.hasOwnProperty(tsv_name)){ - var chunk; - if(g_info.data_is_object){ - chunk = {}; - }else{ - chunk = []; - } - funAfter(chunk); - return; // do not download twice. - } - g_info.download_status[tsv_name] = "downloading"; - // prefix tsv file with appropriate path - var tsv_file = getTSVpath(tsv_name); - d3.tsv(tsv_file, function (error, response) { - // First convert to correct types. - g_info.download_status[tsv_name] = "processing"; - response = convert_R_types(response, g_info.types); - wait_until_then(500, function(){ - if(g_info.common_tsv) { - return g_info.data.hasOwnProperty(g_info.common_tsv); - }else{ - return true; - } - }, function(){ - if(g_info.common_tsv) { - // copy data from common tsv to varied tsv - response = copy_chunk(g_info, response); - } - var nest = d3.nest(); - g_info.nest_order.forEach(function (v_name) { - nest.key(function (d) { - return d[v_name]; - }); - }); - var chunk = nest.map(response); - g_info.data[tsv_name] = chunk; - g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); - g_info.download_status[tsv_name] = "saved"; - funAfter(chunk); - }); - }); - }//download_chunk. - - // update_geom is responsible for obtaining a chunk of downloaded - // data, and then calling draw_geom to actually draw it. - var draw_geom = function(g_info, chunk, selector_name, PANEL){ - g_info.tr.select("td.status").text("displayed"); - var svg = SVGs[g_info.classed]; - // derive the plot name from the geometry name - var g_names = g_info.classed.split("_"); - var p_name = g_names[g_names.length - 1]; - var scales = Plots[p_name].scales[PANEL]; - var selected_arrays = [ [] ]; //double array necessary. - var has_clickSelects = g_info.aes.hasOwnProperty("clickSelects"); - var has_clickSelects_variable = - g_info.aes.hasOwnProperty("clickSelects.variable"); - g_info.subset_order.forEach(function (aes_name) { - var selected, values; - var new_arrays = []; - if(0 < aes_name.indexOf(".variable")){ - selected_arrays.forEach(function(old_array){ - var some_data = chunk; - old_array.forEach(function(value){ - if(some_data.hasOwnProperty(value)) { - some_data = some_data[value]; - } else { - some_data = {}; - } - }) - values = d3.keys(some_data); - values.forEach(function(s_name){ - var selected = Selectors[s_name].selected; - var new_array = old_array.concat(s_name).concat(selected); - new_arrays.push(new_array); - }) - }) - }else{//not .variable aes: - if(aes_name == "PANEL"){ - selected = PANEL; - }else{ - var s_name = g_info.aes[aes_name]; - selected = Selectors[s_name].selected; - } - if(isArray(selected)){ - values = selected; //multiple selection. - }else{ - values = [selected]; //single selection. - } - values.forEach(function(value){ - selected_arrays.forEach(function(old_array){ - var new_array = old_array.concat(value); - new_arrays.push(new_array); - }) - }) - } - selected_arrays = new_arrays; - }); - // data can be either an array[] if it will be directly involved - // in a data-bind, or an object{} if it will be involved in a - // data-bind by group (e.g. geom_line). - var data; - if(g_info.data_is_object){ - data = {}; - }else{ - data = []; - } - selected_arrays.forEach(function(value_array){ - var some_data = chunk; - value_array.forEach(function(value){ - if (some_data.hasOwnProperty(value)) { - some_data = some_data[value]; - } else { - if(g_info.data_is_object){ - some_data = {}; - }else{ - some_data = []; - } - } - }); - if(g_info.data_is_object){ - if(isArray(some_data) && some_data.length){ - data["0"] = some_data; - }else{ - for(k in some_data){ - data[k] = some_data[k]; - } - } - }else{//some_data is an array. - data = data.concat(some_data); - } - }); - var aes = g_info.aes; - var toXY = function (xy, a) { - return function (d) { - return scales[xy](d[a]); - }; - }; - var layer_g_element = svg.select("g." + g_info.classed); - var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); - var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; - }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; - }; - var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; - } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; - - // stroke_width for geom_point - var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; - } - - var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; - } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } - return linetypesize2dasharray(lt, get_size(d)); - }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; - } - const get_angle = function(d) { - // x and y are the coordinates to rotate around, we choose the center - // point of the text because otherwise it will rotate around (0,0) of its - // coordinate system, which is the top left of the plot - x = scales["x"](d["x"]); - y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } - // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so - // we negate the angle. - return `rotate(${-angle}, ${x}, ${y})`; - }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - - // For aes(hjust) the compiler should make an "anchor" column. - var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } - var get_text_anchor; - if(g_info.aes.hasOwnProperty("hjust")) { - get_text_anchor = function(d){ - return d["anchor"]; - } - }else{ - get_text_anchor = function(d){ - return text_anchor; - } - } - - var eActions, eAppend, linkActions; - var key_fun = null; - var id_fun = function(d){ - return d.id; - }; - if(g_info.aes.hasOwnProperty("key")){ - key_fun = function(d){ - return d.key; - }; - } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; - if(g_info.data_is_object) { - - // Lines, paths, polygons, and ribbons are a bit special. For - // every unique value of the group variable, we take the - // corresponding data rows and make 1 path. The tricky part is - // that to use d3 I do a data-bind of some "fake" data which are - // just group ids, which is the kv variable in the code below - - // // case of only 1 line and no groups. - // if(!aes.hasOwnProperty("group")){ - // kv = [{"key":0,"value":0}]; - // data = {0:data}; - // }else{ - // // we need to use a path for each group. - // var kv = d3.entries(d3.keys(data)); - // kv = kv.map(function(d){ - // d[aes.group] = d.value; - // return d; - // }); - // } - - // For an example consider breakpointError$error which is - // defined using this R code - - // geom_line(aes(segments, error, group=bases.per.probe, - // clickSelects=bases.per.probe), data=only.error, lwd=4) - - // Inside update_geom the variables take the following values - // (pseudo-Javascript code) - - // var kv = [{"key":"0","value":"133","bases.per.probe":"133"}, - // {"key":"1","value":"2667","bases.per.probe":"2667"}]; - // var data = {"133":[array of 20 points used to draw the line for group 133], - // "2667":[array of 20 points used to draw the line for group 2667]}; - - // I do elements.data(kv) so that when I set the d attribute of - // each path, I need to select the correct group before - // returning anything. - - // e.attr("d",function(group_info){ - // var one_group = data[group_info.value]; - // return lineThing(one_group); - // }) - - // To make color work I think you just have to select the group - // and take the color of the first element, e.g. - - // .style("stroke",function(group_info){ - // var one_group = data[group_info.value]; - // var one_row = one_group[0]; - // return get_color(one_row); - // } - - // In order to get d3 lines to play nice, bind fake "data" (group - // id's) -- the kv variable. Then each separate object is plotted - // using path (case of only 1 thing and no groups). - - // we need to use a path for each group. - var keyed_data = {}, one_group, group_id, k; - for(group_id in data){ - one_group = data[group_id]; - one_row = one_group[0]; - if(one_row.hasOwnProperty("key")){ - k = one_row.key; - }else{ - k = group_id; - } - keyed_data[k] = one_group; - } - var kv_array = d3.entries(d3.keys(keyed_data)); - var kv = kv_array.map(function (d) { - //d[aes.group] = d.value; - - // Need to store the clickSelects value that will - // be passed to the selector when we click on this - // item. - d.clickSelects = keyed_data[d.value][0].clickSelects; - return d; - }); - - // line, path, and polygon use d3.svg.line(), - // ribbon uses d3.svg.area() - // we have to define lineThing accordingly. - if (g_info.geom == "ribbon") { - var lineThing = d3.svg.area() - .x(toXY("x", "x")) - .y(toXY("y", "ymax")) - .y0(toXY("y", "ymin")); - } else { - var lineThing = d3.svg.line() - .x(toXY("x", "x")) - .y(toXY("y", "y")); - } - // select the correct group before returning anything. - key_fun = function(group_info){ - return group_info.value; - }; - id_fun = function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; - }; - eActions = function (e) { - e.attr("d", function (d) { - var one_group = keyed_data[d.value]; - // filter NaN since they make the whole line disappear! - var no_na = one_group.filter(function(d){ - if(g_info.geom == "ribbon"){ - return !isNaN(d.x) && !isNaN(d.ymin) && !isNaN(d.ymax); - }else{ - return !isNaN(d.x) && !isNaN(d.y); - } - }); - return lineThing(no_na); - }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } - }; - eAppend = "path"; - }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; - } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; - } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - } - elements.exit().remove(); - var enter = elements.enter(); - if(g_info.aes.hasOwnProperty("href")){ - enter = enter.append("svg:a") - .append("svg:"+eAppend); - }else{ - enter = enter.append(eAppend) - .attr("class", "geom"); - } - if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; - elements.call(out_fun) - .on("mouseover", function (d) { - d3.select(this).call(over_fun); - }) - .on("mouseout", function (d) { - d3.select(this).call(out_fun); - }) - ; - if(has_clickSelects){ - elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. - var s_name = g_info.aes.clickSelects; - update_selector(s_name, d.clickSelects); - }); - }else{ - elements.on("click", function(d){ - var s_name = d["clickSelects.variable"]; - var s_value = d["clickSelects.value"]; - update_selector(s_name, s_value); - }); - } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } - } - var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); - if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } - if(has_tooltip){ - text_fun = function(d){ - return d.tooltip; - }; - }else if(has_clickSelects){ - text_fun = function(d){ - var v_name = g_info.aes.clickSelects; - return v_name + " " + d.clickSelects; - }; - }else{ //clickSelects_variable - text_fun = function(d){ - return d["clickSelects.variable"] + " " + d["clickSelects.value"]; - }; - } - // if elements have an existing title, remove it. - elements.selectAll("title").remove(); - elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) - ; - } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! - if(Selectors.hasOwnProperty(selector_name)){ - var milliseconds = Selectors[selector_name].duration; - elements = elements.transition().duration(milliseconds); - } - if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); - } - if(g_info.aes.hasOwnProperty("href")){ - // elements are , children are e.g. - var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); - }else{ - // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) - } - }; - - - - var value_tostring = function(selected_values) { - //function that is helpful to change the format of the string - var selector_url="#" - for (var selc_var in selected_values){ - if(selected_values.hasOwnProperty(selc_var)){ - var values_str=selected_values[selc_var].join(); - var sub_url=selc_var.concat("=","{",values_str,"}"); - selector_url=selector_url.concat(sub_url); - } - } - var url_nohash=window.location.href.match(/(^[^#]*)/)[0]; - selector_url=url_nohash.concat(selector_url); - return selector_url; - }; - - var get_values=function(){ - // function that is useful to get the selected values - var selected_values={} - for(var s_name in Selectors){ - var s_info=Selectors[s_name]; - var initial_selections = []; - if(s_info.type==="single"){ - initial_selections=[s_info.selected]; - } - else{ - for(var i in s_info.selected) { - initial_selections[i] = s_info.selected[i]; - } - } - selected_values[s_name]=initial_selections; - } - return selected_values; - }; - - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - - // update scales for the plots that have update_axes option in - // theme_animint - function update_scales(p_name, axes, v_name, value){ - // Get pre-computed domain - var axis_domains = Plots[p_name]["axis_domains"]; - if(!isArray(axes)){ - axes = [axes]; - } - if(axis_domains != null){ - axes.forEach(function(xyaxis){ - // For Each PANEL, update the axes - Plots[p_name].layout.PANEL.forEach(function(panel_i, i){ - // Determine whether this panel has a scale or not - // If not we just update the scales according to the common - // scale and skip the updating of axis - var draw_axes = Plots[p_name].layout["AXIS_"+ xyaxis.toUpperCase()][i]; - if(draw_axes){ - var use_panel = panel_i; - }else{ - var use_panel = Plots[p_name].layout.PANEL[0]; - } - // We update the current selection of the plot every time - // and use it to index the correct domain - var curr_select = axis_domains[xyaxis].curr_select; - if(axis_domains[xyaxis].selectors.indexOf(v_name) > -1){ - curr_select[v_name] = value; - var str = use_panel+"."; - for(selec in curr_select){ - str = str + curr_select[selec] + "_"; - } - str = str.substring(0, str.length - 1); // Strip off trailing underscore - var use_domain = axis_domains[xyaxis]["domains"][str]; - } - if(use_domain != null){ - Plots[p_name]["scales"][panel_i][xyaxis].domain(use_domain); - var scales = Plots[p_name]["scales"][panel_i][xyaxis]; - // major and minor grid lines as calculated in the compiler - var grid_vals = Plots[p_name]["axis_domains"][xyaxis]["grids"][str]; - - // Once scales are updated, update the axis ticks if needed - if(draw_axes){ - // Tick values are same as major grid lines - update_axes(p_name, xyaxis, panel_i, grid_vals[1]); - } - // Update major and minor grid lines - update_grids(p_name, xyaxis, panel_i, grid_vals, scales); - } - }); - }); - } - } - - // Update the axis ticks etc. once plot is zoomed in/out - // currently called from update_scales. - function update_axes(p_name, axes, panel_i, tick_vals){ - var orientation; - if(axes == "x"){ - orientation = "bottom"; - }else{ - orientation = "left"; - } - if(!isArray(tick_vals)){ - tick_vals = [tick_vals]; - } - var xyaxis = d3.svg.axis() - .scale(Plots[p_name]["scales"][panel_i][axes]) - .orient(orientation) - .tickValues(tick_vals); - // update existing axis - var xyaxis_g = element.select("#plot_"+p_name).select("."+axes+"axis_"+panel_i) - .transition() - .duration(1000) - .call(xyaxis); - } - - // Update major/minor grids once axes ticks have been updated - function update_grids(p_name, axes, panel_i, grid_vals, scales){ - // Select panel to update - var bgr = element.select("#plot_"+p_name).select(".bgr"+panel_i); - // Update major and minor grid lines - ["minor", "major"].forEach(function(grid_class, j){ - var lines = bgr.select(".grid_"+grid_class).select("."+axes); - var xy1, xy2; - if(axes == "x"){ - xy1 = lines.select("line").attr("y1"); - xy2 = lines.select("line").attr("y2"); - }else{ - xy1 = lines.select("line").attr("x1"); - xy2 = lines.select("line").attr("x2"); - } - - // Get default values for grid lines like colour, stroke etc. - var grid_background = Plots[p_name]["grid_"+grid_class]; - var col = grid_background.colour; - var lt = grid_background.linetype; - var size = grid_background.size; - var cap = grid_background.lineend; - - // Remove old lines - lines.selectAll("line") - .remove(); - - if(!isArray(grid_vals[j])){ - grid_vals[j] = [grid_vals[j]]; - } - - if(axes == "x"){ - lines.selectAll("line") - .data(grid_vals[j]) - .enter() - .append("line") - .attr("y1", xy1) - .attr("y2", xy2) - .attr("x1", function(d) { return scales(d); }) - .attr("x2", function(d) { return scales(d); }) - .style("stroke", col) - .style("stroke-linecap", cap) - .style("stroke-width", size) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(lt, size); - }); - }else{ - lines.selectAll("line") - .data(grid_vals[j]) - .enter() - .append("line") - .attr("x1", xy1) - .attr("x2", xy2) - .attr("y1", function(d) { return scales(d); }) - .attr("y2", function(d) { return scales(d); }) - .style("stroke", col) - .style("stroke-linecap", cap) - .style("stroke-width", size) - .style("stroke-dasharray", function() { - return linetypesize2dasharray(lt, size); - }); - } - }); - } - - var update_selector = function (v_name, value) { - if(!Selectors.hasOwnProperty(v_name)){ - return; - } - value = value + ""; - var s_info = Selectors[v_name]; - if(s_info.type == "single"){ - // value is the new selection. - s_info.selected = value; - }else{ - // value should be added or removed from the selection. - var i_value = s_info.selected.indexOf(value); - if(i_value == -1){ - // not found, add to selection. - s_info.selected.push(value); - }else{ - // found, remove from selection. - s_info.selected.splice(i_value, 1); - } - } - // update_selector_url() - // if there are levels, then there is a selectize widget which - // should be updated. - if(isArray(s_info.levels)){ - // the jquery ids - if(s_info.type == "single") { - var selected_ids = v_name.concat("___", value); - } else { - var selected_ids = []; - for(i in s_info.selected) { - selected_ids[i] = v_name.concat("___", s_info.selected[i]); - } - } - // from - // https://github.com/brianreavis/selectize.js/blob/master/docs/api.md: - // setValue(value, silent) If "silent" is truthy, no change - // event will be fired on the original input. - selectized_array[v_name].setValue(selected_ids, true); - } - - // For each updated geom, check if the axes of the plot need to be - // updated and update them - s_info.update.forEach(function(g_name){ - var plot_name = g_name.split("_").pop(); - var axes = Plots[plot_name]["options"]["update_axes"]; - if(axes != null){ - update_scales(plot_name, axes, v_name, value); - } - }); - - update_legend_opacity(v_name); - s_info.update.forEach(function(g_name){ - update_geom(g_name, v_name); - }); - }; - - var ifSelectedElse = function (s_value, s_name, selected, not_selected) { - var is_selected; - var s_info = Selectors[s_name]; - if(s_info.type == "single"){ - is_selected = s_value == s_info.selected; - }else{ - is_selected = s_info.selected.indexOf(s_value) != -1; - } - if(is_selected){ - return selected; - } else { - return not_selected; - } - }; - - function update_next_animation(){ - var values = d3.values(Animation.done_geoms); - if(d3.sum(values) == values.length){ - // If the values in done_geoms are all 1, then we have loaded - // all of the animation-related chunks, and we can start - // playing the animation. - var v_name = Animation.variable; - var cur = Selectors[v_name].selected; - var next = Animation.next[cur]; - update_selector(v_name, next); - } - } - - // The main idea of how legends work: - - // 1. In getLegend in animint.R I export the legend entries as a - // list of rows that can be used in a data() bind in D3. - - // 2. Here in add_legend I create a for every legend, and - // then I bind the legend entries to , or other required elements. - thead: [ 1, "
, and elements. - var add_legend = function(p_name, p_info){ - // case of multiple legends, d3 reads legend structure in as an array - var tdRight = element.select("td."+p_name+"_legend"); - var legendkeys = d3.keys(p_info.legend); - for(var i=0; i-1){ - // aesthetics that would draw a rect - legend_svgs.append("rect") - .attr("x", 2) - .attr("y", 2) - .attr("width", 10) - .attr("height", 10) - .style("stroke-width", function(d){return d["polygonsize"]||1;}) - .style("stroke-dasharray", function(d){ - return linetypesize2dasharray(d["polygonlinetype"], d["size"]||2); - }) - .style("stroke", function(d){return d["polygoncolour"] || "#000000";}) - .style("fill", function(d){return d["polygonfill"] || "#FFFFFF";}) - .style("opacity", function(d){return d["polygonalpha"]||1;}); - } - if(l_info.geoms.indexOf("text")>-1){ - // aesthetics that would draw a rect - legend_svgs.append("text") - .attr("x", 10) - .attr("y", 14) - .style("fill", function(d){return d["textcolour"]||1;}) - .style("text-anchor", "middle") - .attr("font-size", function(d){return d["textsize"]||1;}) - .text("a"); - } - if(l_info.geoms.indexOf("path")>-1){ - // aesthetics that would draw a line - legend_svgs.append("line") - .attr("x1", 1).attr("x2", 19).attr("y1", 7).attr("y2", 7) - .style("stroke-width", function(d){ - return linescale(d["pathsize"])||2; - }) - .style("stroke-dasharray", function(d){ - return linetypesize2dasharray(d["pathlinetype"], d["pathsize"] || 2); - }) - .style("stroke", function(d){return d["pathcolour"] || "#000000";}) - .style("opacity", function(d){return d["pathalpha"]||1;}); - } - if(l_info.geoms.indexOf("point")>-1){ - // aesthetics that would draw a point - legend_svgs.append("circle") - .attr("cx", 10) - .attr("cy", 7) - .attr("r", function(d){return pointscale(d["pointsize"])||4;}) - .style("stroke", function(d){return d["pointcolour"] || "#000000";}) - .style("fill", function(d){ - return d["pointfill"] || d["pointcolour"] || "#000000"; - }) - .style("opacity", function(d){return d["pointalpha"]||1;}); - } - legend_rows.append("td") - .attr("align", "left") // TODO: right for numbers? - .attr("class", "legend_entry_label") - .attr("id", function(d){ return d["id"]+"_label"; }) - .style("font-size", function(d){ return d["text_size"]}) - .text(function(d){ return d["label"];}); - } - } - - // Download the main description of the interactive plot. - d3.json(json_file, function (error, response) { - if(response.hasOwnProperty("title")){ - // This selects the title of the web page, outside of wherever - // the animint is defined, usually a
-- so it is OK to use - // global d3.select here. - d3.select("title").text(response.title); - } - // Add plots. - for (var p_name in response.plots) { - add_plot(p_name, response.plots[p_name]); - add_legend(p_name, response.plots[p_name]); - // Append style sheet to document head. - css.appendChild(document.createTextNode(styles.join(" "))); - document.head.appendChild(css); - } - // Then add selectors and start downloading the first data subset. - for (var s_name in response.selectors) { - add_selector(s_name, response.selectors[s_name]); - } - - // Update the scales/axes of the plots if needed - // We do this so that the plots zoom in initially after loading - for (var p_name in response.plots) { - if(response.plots[p_name].axis_domains !== null){ - for(var xy in response.plots[p_name].axis_domains){ - var selectors = response.plots[p_name].axis_domains[xy].selectors; - if(!isArray(selectors)){ - selectors = [selectors]; - } - update_scales(p_name, xy, selectors[0], - response.selectors[selectors[0]].selected); - } - } - } - - //////////////////////////////////////////// - // Widgets at bottom of page - //////////////////////////////////////////// - element.append("br"); - - // loading table. - var show_hide_table = element.append("button") - .text("Show download status table"); - show_hide_table - .on("click", function(){ - if(this.textContent == "Show download status table"){ - loading.style("display", ""); - show_hide_table.text("Hide download status table"); - }else{ - loading.style("display", "none"); - show_hide_table.text("Show download status table"); - } - }); - var loading = element.append("table") - .style("display", "none"); - Widgets["loading"] = loading; - var tr = loading.append("tr"); - tr.append("th").text("geom"); - tr.append("th").attr("class", "chunk").text("selected chunk"); - tr.append("th").attr("class", "downloaded").text("downloaded"); - tr.append("th").attr("class", "total").text("total"); - tr.append("th").attr("class", "status").text("status"); - - // Add geoms and construct nest operators. - for (var g_name in response.geoms) { - add_geom(g_name, response.geoms[g_name]); - } - - // Animation control widgets. - var show_message = "Show animation controls"; - // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") - .text(show_message) - .attr("id", viz_id + "_show_hide_animation_controls") - .on("click", function(){ - if(this.textContent == show_message){ - time_table.style("display", ""); - show_hide_animation_controls.text("Hide animation controls"); - }else{ - time_table.style("display", "none"); - show_hide_animation_controls.text(show_message); - } - }) - ; - // table of the animint widgets - var time_table = element.append("table") - .style("display", "none"); - var first_tr = time_table.append("tr"); - var first_th = first_tr.append("th"); - // if there's a time variable, add a button to pause the animint - if(response.time){ - Animation.next = {}; - Animation.ms = response.time.ms; - Animation.variable = response.time.variable; - Animation.sequence = response.time.sequence; - Widgets["play_pause"] = first_th.append("button") - .text("Play") - .attr("id", "play_pause") - .on("click", function(){ - if(this.textContent == "Play"){ - Animation.play(); - }else{ - Animation.pause(false); - } - }) - ; - } - first_tr.append("th").text("milliseconds"); - if(response.time){ - var second_tr = time_table.append("tr"); - second_tr.append("td").text("updates"); - second_tr.append("td").append("input") - .attr("id", "updates_ms") - .attr("type", "text") - .attr("value", Animation.ms) - .on("change", function(){ - Animation.pause(false); - Animation.ms = this.value; - Animation.play(); - }) - ; - } - for(s_name in Selectors){ - var s_info = Selectors[s_name]; - if(!s_info.hasOwnProperty("duration")){ - s_info.duration = 0; - } - } - var selector_array = d3.keys(Selectors); - var duration_rows = time_table.selectAll("tr.duration") - .data(selector_array) - .enter() - .append("tr"); - duration_rows - .append("td") - .text(function(s_name){return s_name;}); - var duration_tds = duration_rows.append("td"); - var duration_inputs = duration_tds - .append("input") - .attr("id", function(s_name){ - return viz_id + "_duration_ms_" + s_name; - }) - .attr("type", "text") - .on("change", function(s_name){ - Selectors[s_name].duration = this.value; - }) - .attr("value", function(s_name){ - return Selectors[s_name].duration; - }); - // selector widgets - var toggle_message = "Show selection menus"; - var show_or_hide_fun = function(){ - if(this.textContent == toggle_message){ - selector_table.style("display", ""); - show_hide_selector_widgets.text("Hide selection menus"); - d3.select(".urltable").style("display","") - }else{ - selector_table.style("display", "none"); - show_hide_selector_widgets.text(toggle_message); - d3.select(".urltable").style("display","none") - } - } - var show_hide_selector_widgets = element.append("button") - .text(toggle_message) - .attr("class", "show_hide_selector_widgets") - .on("click", show_or_hide_fun) - ; - // adding a table for selector widgets - var selector_table = element.append("table") - .style("display", "none") - .attr("class", "table_selector_widgets") - ; - var selector_first_tr = selector_table.append("tr"); - selector_first_tr - .append("th") - .text("Variable") - ; - selector_first_tr - .append("th") - .text("Selected value(s)") - ; - - // looping through and adding a row for each selector - for(s_name in Selectors) { - var s_info = Selectors[s_name]; - // for .variable .value selectors, levels is undefined and we do - // not want to make a selectize widget. - - // TODO: why does it take so long to initialize the selectize - // widget when there are many (>1000) values? - if(isArray(s_info.levels)){ - // If there were no geoms that specified clickSelects for this - // selector, then there is no way to select it other than the - // selectize widgets (and possibly legends). So in this case - // we show the selectize widgets by default. - var selector_widgets_hidden = - show_hide_selector_widgets.text() == toggle_message; - var has_no_clickSelects = - !Selectors[s_name].hasOwnProperty("clickSelects") - var has_no_legend = - !Selectors[s_name].hasOwnProperty("legend") - if(selector_widgets_hidden && has_no_clickSelects && has_no_legend){ - var node = show_hide_selector_widgets.node(); - show_or_hide_fun.apply(node); - } - // removing "." from name so it can be used in ids - var s_name_id = legend_class_name(s_name); - - // adding a row for each selector - var selector_widget_row = selector_table - .append("tr") - .attr("class", function() { return s_name_id + "_selector_widget"; }) - ; - selector_widget_row.append("td").text(s_name); - // adding the selector - var selector_widget_select = selector_widget_row - .append("td") - .append("select") - .attr("class", function() { return s_name_id + "_input"; }) - .attr("placeholder", function() { return "Toggle " + s_name; }); - // adding an option for each level of the variable - selector_widget_select.selectAll("option") - .data(s_info.levels) - .enter() - .append("option") - .attr("value", function(d) { return d; }) - .text(function(d) { return d; }); - // making sure that the first option is blank - selector_widget_select - .insert("option") - .attr("value", "") - .text(function() { return "Toggle " + s_name; }); - - // calling selectize - var selectize_selector = to_select + ' .' + s_name_id + "_input"; - if(s_info.type == "single") { - // setting up array of selector and options - var selector_values = []; - for(i in s_info.levels) { - selector_values[i] = { - id: s_name.concat("___", s_info.levels[i]), - text: s_info.levels[i] - }; - } - // the id of the first selector - var selected_id = s_name.concat("___", s_info.selected); - - // if single selection, only allow one item - var $temp = $(selectize_selector) - .selectize({ - create: false, - valueField: 'id', - labelField: 'text', - searchField: ['text'], - options: selector_values, - items: [selected_id], - maxItems: 1, - allowEmptyOption: true, - onChange: function(value) { - // extracting the name and the level to update - var selector_name = value.split("___")[0]; - var selected_level = value.split("___")[1]; - // updating the selector - update_selector(selector_name, selected_level); - } - }) - ; - } else { // multiple selection: - // setting up array of selector and options - var selector_values = []; - if(typeof s_info.levels == "object") { - for(i in s_info.levels) { - selector_values[i] = { - id: s_name.concat("___", s_info.levels[i]), - text: s_info.levels[i] - }; - } - } else { - selector_values[0] = { - id: s_name.concat("___", s_info.levels), - text: s_info.levels - }; - } - // setting up an array to contain the initally selected elements - var initial_selections = []; - for(i in s_info.selected) { - initial_selections[i] = s_name.concat("___", s_info.selected[i]); - } - - // construct the selectize - var $temp = $(selectize_selector) - .selectize({ - create: false, - valueField: 'id', - labelField: 'text', - searchField: ['text'], - options: selector_values, - items: initial_selections, - maxItems: s_info.levels.length, - allowEmptyOption: true, - onChange: function(value) { - // if nothing is selected, remove what is currently selected - if(value == null) { - // extracting the selector ids from the options - var the_ids = Object.keys($(this)[0].options); - // the name of the appropriate selector - var selector_name = the_ids[0].split("___")[0]; - // the previously selected elements - var old_selections = Selectors[selector_name].selected; - // updating the selector for each of the old selections - old_selections.forEach(function(element) { - update_selector(selector_name, element); - }); - } else { // value is not null: - // grabbing the name of the selector from the selected value - var selector_name = value[0].split("___")[0]; - // identifying the levels that should be selected - var specified_levels = []; - for(i in value) { - specified_levels[i] = value[i].split("___")[1]; - } - // the previously selected entries - old_selections = Selectors[selector_name].selected; - - // the levels that need to have selections turned on - specified_levels - .filter(function(n) { - return old_selections.indexOf(n) == -1; - }) - .forEach(function(element) { - update_selector(selector_name, element); - }) - ; - // the levels that need to be turned off - // - same approach - old_selections - .filter(function(n) { - return specified_levels.indexOf(n) == -1; - }) - .forEach(function(element) { - update_selector(selector_name, element); - }) - ; - }//value==null - }//onChange - })//selectize - ; - }//single or multiple selection. - selectized_array[s_name] = $temp[0].selectize; - }//levels, is.variable.value - } // close for loop through selector widgets - // If this is an animation, then start downloading all the rest of - // the data, and start the animation. - if (response.time) { - var i, prev, cur; - for (var i = 0; i < Animation.sequence.length; i++) { - if (i == 0) { - prev = Animation.sequence[Animation.sequence.length-1]; - } else { - prev = Animation.sequence[i - 1]; - } - cur = Animation.sequence[i]; - Animation.next[prev] = cur; - } - Animation.timer = null; - Animation.play = function(){ - if(Animation.timer == null){ // only play if not already playing. - // as shown on http://bl.ocks.org/mbostock/3808234 - Animation.timer = setInterval(update_next_animation, Animation.ms); - Widgets["play_pause"].text("Pause"); - } - }; - Animation.play_after_visible = false; - Animation.pause = function(play_after_visible){ - Animation.play_after_visible = play_after_visible; - clearInterval(Animation.timer); - Animation.timer = null; - Widgets["play_pause"].text("Play"); - }; - var s_info = Selectors[Animation.variable]; - Animation.done_geoms = {}; - s_info.update.forEach(function(g_name){ - var g_info = Geoms[g_name]; - if(g_info.chunk_order.length == 1 && - g_info.chunk_order[0] == Animation.variable){ - g_info.seq_i = Animation.sequence.indexOf(s_info.selected); - g_info.seq_count = 0; - Animation.done_geoms[g_name] = 0; - download_next(g_name); - } - }); - Animation.play(); - all_geom_names = d3.keys(response.geoms); - - // This code starts/stops the animation timer when the page is - // hidden, inspired by - // http://stackoverflow.com/questions/1060008 - function onchange (evt) { - if(document.visibilityState == "visible"){ - if(Animation.play_after_visible){ - Animation.play(); - } - }else{ - if(Widgets["play_pause"].text() == "Pause"){ - Animation.pause(true); - } - } - }; - document.addEventListener("visibilitychange", onchange); - } - // update_selector_url() - var check_func=function(){ - var status_array = $('.status').map(function(){ - return $.trim($(this).text()); - }).get(); - status_array=status_array.slice(1) - return status_array.every(function(elem){ return elem === "displayed"}); - } - if(window.location.hash) { - var fragment=window.location.hash; - fragment=fragment.slice(1); - fragment=decodeURI(fragment) - var frag_array=fragment.split(/(.*?})/); - frag_array=frag_array.filter(function(x){ return x!=""}) - frag_array.forEach(function(selector_string){ - var selector_hash=selector_string.split("="); - var selector_nam=selector_hash[0]; - var selector_values=selector_hash[1]; - var re = /\{(.*?)\}/; - selector_values = re.exec(selector_values)[1]; - var array_values = selector_values.split(','); - if(Selectors.hasOwnProperty(selector_nam)){ - var s_info = Selectors[selector_nam] - if(s_info.type=="single"){//TODO fix - array_values.forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time)Animation.pause(true) - }); - }else{ - var old_selections = Selectors[selector_nam].selected; - // the levels that need to have selections turned on - array_values - .filter(function(n) { - return old_selections.indexOf(n) == -1; - }) - .forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time){ - Animation.pause(true) - } - }); - old_selections - .filter(function(n) { - return array_values.indexOf(n) == -1; - }) - .forEach(function(element) { - wait_until_then(100, check_func, update_selector,selector_nam,element) - if(response.time){ - Animation.pause(true) - } - }); - }//if(single) else multiple selection - }//if(Selectors.hasOwnProperty(selector_nam)) - })//frag_array.forEach - }//if(window.location.hash) - }); -}; - - diff --git a/docs/authors.html b/docs/authors.html deleted file mode 100644 index a8e3ca743..000000000 --- a/docs/authors.html +++ /dev/null @@ -1,153 +0,0 @@ - -Authors and Citation • animint2 - Skip to contents - - -
-
-
- -
-

Authors

- -
  • -

    Toby Hocking. Author, maintainer. -
    Original animint code

    -
  • -
  • -

    Hadley Wickham. Author. -
    Forked ggplot2 code

    -
  • -
  • -

    Winston Chang. Author. -
    Forked ggplot2 code

    -
  • -
  • -

    RStudio. Copyright holder. -
    Forked ggplot2 code

    -
  • -
  • -

    Nicholas Lewin-Koh. Author. -
    hexGrob

    -
  • -
  • -

    Martin Maechler. Author. -
    hexGrob

    -
  • -
  • -

    Randall Prium. Author. -
    cut_width

    -
  • -
  • -

    Susan VanderPlas. Author. -
    Animint GSOC 2013

    -
  • -
  • -

    Carson Sievert. Author. -
    Animint GSOC 2014

    -
  • -
  • -

    Kevin Ferris. Author. -
    Animint GSOC 2015

    -
  • -
  • -

    Jun Cai. Author. -
    Animint GSOC 2015

    -
  • -
  • -

    Faizan Khan. Author. -
    Animint GSOC 2016-2017

    -
  • -
  • -

    Vivek Kumar. Author. -
    Animint GSOC 2018

    -
  • -
  • -

    Himanshu Singh. Author. -
    Animint2 GSoC 2020

    -
  • -
  • -

    Yufan Fei. Author. -
    Animint2 GSoC 2022

    -
  • -
  • -

    Jocelyne Chen. Author. -
    Animint2 GSoC 2023

    -
  • -
- -
-

Citation

-

Source: DESCRIPTION

- -

Hocking T, Wickham H, Chang W, Lewin-Koh N, Maechler M, Prium R, VanderPlas S, Sievert C, Ferris K, Cai J, Khan F, Kumar V, Singh H, Fei Y, Chen J (2023). -animint2: Animated Interactive Grammar of Graphics. -R package version 2023.6.11, https://animint.github.io/animint2/. -

-
@Manual{,
-  title = {animint2: Animated Interactive Grammar of Graphics},
-  author = {Toby Hocking and Hadley Wickham and Winston Chang and Nicholas Lewin-Koh and Martin Maechler and Randall Prium and Susan VanderPlas and Carson Sievert and Kevin Ferris and Jun Cai and Faizan Khan and Vivek Kumar and Himanshu Singh and Yufan Fei and Jocelyne Chen},
-  year = {2023},
-  note = {R package version 2023.6.11},
-  url = {https://animint.github.io/animint2/},
-}
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/deps/Roboto-0.4.4/KFOmCnqEu92Fr1Me5g.woff b/docs/deps/Roboto-0.4.4/KFOmCnqEu92Fr1Me5g.woff deleted file mode 100644 index 462480009..000000000 Binary files a/docs/deps/Roboto-0.4.4/KFOmCnqEu92Fr1Me5g.woff and /dev/null differ diff --git a/docs/deps/Roboto-0.4.4/font.css b/docs/deps/Roboto-0.4.4/font.css deleted file mode 100644 index cddf76e53..000000000 --- a/docs/deps/Roboto-0.4.4/font.css +++ /dev/null @@ -1,7 +0,0 @@ -@font-face { - font-family: 'Roboto'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(KFOmCnqEu92Fr1Me5g.woff) format('woff'); -} diff --git a/docs/deps/Roboto_Condensed-0.4.4/font.css b/docs/deps/Roboto_Condensed-0.4.4/font.css deleted file mode 100644 index 869e732e0..000000000 --- a/docs/deps/Roboto_Condensed-0.4.4/font.css +++ /dev/null @@ -1,7 +0,0 @@ -@font-face { - font-family: 'Roboto Condensed'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(ieVl2ZhZI2eCN5jzbjEETS9weq8-59Y.woff) format('woff'); -} diff --git a/docs/deps/Roboto_Condensed-0.4.4/ieVl2ZhZI2eCN5jzbjEETS9weq8-59Y.woff b/docs/deps/Roboto_Condensed-0.4.4/ieVl2ZhZI2eCN5jzbjEETS9weq8-59Y.woff deleted file mode 100644 index 47a6f6145..000000000 Binary files a/docs/deps/Roboto_Condensed-0.4.4/ieVl2ZhZI2eCN5jzbjEETS9weq8-59Y.woff and /dev/null differ diff --git a/docs/deps/Roboto_Mono-0.4.4/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vqPQA.woff b/docs/deps/Roboto_Mono-0.4.4/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vqPQA.woff deleted file mode 100644 index 068df6180..000000000 Binary files a/docs/deps/Roboto_Mono-0.4.4/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vqPQA.woff and /dev/null differ diff --git a/docs/deps/Roboto_Mono-0.4.4/font.css b/docs/deps/Roboto_Mono-0.4.4/font.css deleted file mode 100644 index 9463c2000..000000000 --- a/docs/deps/Roboto_Mono-0.4.4/font.css +++ /dev/null @@ -1,7 +0,0 @@ -@font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - font-display: swap; - src: url(L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vqPQA.woff) format('woff'); -} diff --git a/docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js b/docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js deleted file mode 100644 index 1d138863b..000000000 --- a/docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v5.2.2 (https://getbootstrap.com/) - * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,(function(){"use strict";const t="transitionend",e=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e},i=t=>{const i=e(t);return i&&document.querySelector(i)?i:null},n=t=>{const i=e(t);return i?document.querySelector(i):null},s=e=>{e.dispatchEvent(new Event(t))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,a=t=>{if(!o(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},l=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),c=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?c(t.parentNode):null},h=()=>{},d=t=>{t.offsetHeight},u=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,f=[],p=()=>"rtl"===document.documentElement.dir,g=t=>{var e;e=()=>{const e=u();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(f.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of f)t()})),f.push(e)):e()},m=t=>{"function"==typeof t&&t()},_=(e,i,n=!0)=>{if(!n)return void m(e);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(i)+5;let r=!1;const a=({target:n})=>{n===i&&(r=!0,i.removeEventListener(t,a),m(e))};i.addEventListener(t,a),setTimeout((()=>{r||s(i)}),o)},b=(t,e,i,n)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!i&&n?t[s-1]:t[0]:(o+=i?1:-1,n&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},v=/[^.]*(?=\..*)\.|.*/,y=/\..*/,w=/::\d+$/,A={};let E=1;const T={mouseenter:"mouseover",mouseleave:"mouseout"},C=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function O(t,e){return e&&`${e}::${E++}`||t.uidEvent||E++}function x(t){const e=O(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function k(t,e,i=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===i))}function L(t,e,i){const n="string"==typeof e,s=n?i:e||i;let o=N(t);return C.has(o)||(o=t),[n,s,o]}function D(t,e,i,n,s){if("string"!=typeof e||!t)return;let[o,r,a]=L(e,i,n);if(e in T){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=x(t),c=l[a]||(l[a]={}),h=k(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=O(r,e.replace(v,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return j(s,{delegateTarget:r}),n.oneOff&&P.off(t,s.type,e,i),i.apply(r,[s])}}(t,i,r):function(t,e){return function i(n){return j(n,{delegateTarget:t}),i.oneOff&&P.off(t,n.type,e),e.apply(t,[n])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function S(t,e,i,n,s){const o=k(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function I(t,e,i,n){const s=e[i]||{};for(const o of Object.keys(s))if(o.includes(n)){const n=s[o];S(t,e,i,n.callable,n.delegationSelector)}}function N(t){return t=t.replace(y,""),T[t]||t}const P={on(t,e,i,n){D(t,e,i,n,!1)},one(t,e,i,n){D(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=L(e,i,n),a=r!==e,l=x(t),c=l[r]||{},h=e.startsWith(".");if(void 0===o){if(h)for(const i of Object.keys(l))I(t,l,i,e.slice(1));for(const i of Object.keys(c)){const n=i.replace(w,"");if(!a||e.includes(n)){const e=c[i];S(t,l,r,e.callable,e.delegationSelector)}}}else{if(!Object.keys(c).length)return;S(t,l,r,o,s?i:null)}},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=u();let s=null,o=!0,r=!0,a=!1;e!==N(e)&&n&&(s=n.Event(e,i),n(t).trigger(s),o=!s.isPropagationStopped(),r=!s.isImmediatePropagationStopped(),a=s.isDefaultPrevented());let l=new Event(e,{bubbles:o,cancelable:!0});return l=j(l,i),a&&l.preventDefault(),r&&t.dispatchEvent(l),l.defaultPrevented&&s&&s.preventDefault(),l}};function j(t,e){for(const[i,n]of Object.entries(e||{}))try{t[i]=n}catch(e){Object.defineProperty(t,i,{configurable:!0,get:()=>n})}return t}const M=new Map,H={set(t,e,i){M.has(t)||M.set(t,new Map);const n=M.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>M.has(t)&&M.get(t).get(e)||null,remove(t,e){if(!M.has(t))return;const i=M.get(t);i.delete(e),0===i.size&&M.delete(t)}};function $(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function W(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}const B={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${W(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${W(e)}`)},getDataAttributes(t){if(!t)return{};const e={},i=Object.keys(t.dataset).filter((t=>t.startsWith("bs")&&!t.startsWith("bsConfig")));for(const n of i){let i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1,i.length),e[i]=$(t.dataset[n])}return e},getDataAttribute:(t,e)=>$(t.getAttribute(`data-bs-${W(e)}`))};class F{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const i=o(e)?B.getDataAttribute(e,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...o(e)?B.getDataAttributes(e):{},..."object"==typeof t?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const n of Object.keys(e)){const s=e[n],r=t[n],a=o(r)?"element":null==(i=r)?`${i}`:Object.prototype.toString.call(i).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(s).test(a))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${a}" but expected type "${s}".`)}var i}}class z extends F{constructor(t,e){super(),(t=r(t))&&(this._element=t,this._config=this._getConfig(e),H.set(this._element,this.constructor.DATA_KEY,this))}dispose(){H.remove(this._element,this.constructor.DATA_KEY),P.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,i=!0){_(t,e,i)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(t){return H.get(r(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.2.2"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}const q=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;P.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),l(this))return;const o=n(this)||this.closest(`.${s}`);t.getOrCreateInstance(o)[e]()}))};class R extends z{static get NAME(){return"alert"}close(){if(P.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),P.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=R.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}q(R,"close"),g(R);const V='[data-bs-toggle="button"]';class K extends z{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){const e=K.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}P.on(document,"click.bs.button.data-api",V,(t=>{t.preventDefault();const e=t.target.closest(V);K.getOrCreateInstance(e).toggle()})),g(K);const Q={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let n=t.parentNode.closest(e);for(;n;)i.push(n),n=n.parentNode.closest(e);return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(",");return this.find(e,t).filter((t=>!l(t)&&a(t)))}},X={endCallback:null,leftCallback:null,rightCallback:null},Y={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class U extends F{constructor(t,e){super(),this._element=t,t&&U.isSupported()&&(this._config=this._getConfig(e),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return X}static get DefaultType(){return Y}static get NAME(){return"swipe"}dispose(){P.off(this._element,".bs.swipe")}_start(t){this._supportPointerEvents?this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX):this._deltaX=t.touches[0].clientX}_end(t){this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX-this._deltaX),this._handleSwipe(),m(this._config.endCallback)}_move(t){this._deltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this._deltaX}_handleSwipe(){const t=Math.abs(this._deltaX);if(t<=40)return;const e=t/this._deltaX;this._deltaX=0,e&&m(e>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(P.on(this._element,"pointerdown.bs.swipe",(t=>this._start(t))),P.on(this._element,"pointerup.bs.swipe",(t=>this._end(t))),this._element.classList.add("pointer-event")):(P.on(this._element,"touchstart.bs.swipe",(t=>this._start(t))),P.on(this._element,"touchmove.bs.swipe",(t=>this._move(t))),P.on(this._element,"touchend.bs.swipe",(t=>this._end(t))))}_eventIsPointerPenTouch(t){return this._supportPointerEvents&&("pen"===t.pointerType||"touch"===t.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const G="next",J="prev",Z="left",tt="right",et="slid.bs.carousel",it="carousel",nt="active",st={ArrowLeft:tt,ArrowRight:Z},ot={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},rt={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class at extends z{constructor(t,e){super(t,e),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=Q.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===it&&this.cycle()}static get Default(){return ot}static get DefaultType(){return rt}static get NAME(){return"carousel"}next(){this._slide(G)}nextWhenVisible(){!document.hidden&&a(this._element)&&this.next()}prev(){this._slide(J)}pause(){this._isSliding&&s(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?P.one(this._element,et,(()=>this.cycle())):this.cycle())}to(t){const e=this._getItems();if(t>e.length-1||t<0)return;if(this._isSliding)return void P.one(this._element,et,(()=>this.to(t)));const i=this._getItemIndex(this._getActive());if(i===t)return;const n=t>i?G:J;this._slide(n,e[t])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(t){return t.defaultInterval=t.interval,t}_addEventListeners(){this._config.keyboard&&P.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(P.on(this._element,"mouseenter.bs.carousel",(()=>this.pause())),P.on(this._element,"mouseleave.bs.carousel",(()=>this._maybeEnableCycle()))),this._config.touch&&U.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const t of Q.find(".carousel-item img",this._element))P.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()));const t={leftCallback:()=>this._slide(this._directionToOrder(Z)),rightCallback:()=>this._slide(this._directionToOrder(tt)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),500+this._config.interval))}};this._swipeHelper=new U(this._element,t)}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=st[t.key];e&&(t.preventDefault(),this._slide(this._directionToOrder(e)))}_getItemIndex(t){return this._getItems().indexOf(t)}_setActiveIndicatorElement(t){if(!this._indicatorsElement)return;const e=Q.findOne(".active",this._indicatorsElement);e.classList.remove(nt),e.removeAttribute("aria-current");const i=Q.findOne(`[data-bs-slide-to="${t}"]`,this._indicatorsElement);i&&(i.classList.add(nt),i.setAttribute("aria-current","true"))}_updateInterval(){const t=this._activeElement||this._getActive();if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);this._config.interval=e||this._config.defaultInterval}_slide(t,e=null){if(this._isSliding)return;const i=this._getActive(),n=t===G,s=e||b(this._getItems(),i,n,this._config.wrap);if(s===i)return;const o=this._getItemIndex(s),r=e=>P.trigger(this._element,e,{relatedTarget:s,direction:this._orderToDirection(t),from:this._getItemIndex(i),to:o});if(r("slide.bs.carousel").defaultPrevented)return;if(!i||!s)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=s;const l=n?"carousel-item-start":"carousel-item-end",c=n?"carousel-item-next":"carousel-item-prev";s.classList.add(c),d(s),i.classList.add(l),s.classList.add(l),this._queueCallback((()=>{s.classList.remove(l,c),s.classList.add(nt),i.classList.remove(nt,c,l),this._isSliding=!1,r(et)}),i,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return Q.findOne(".active.carousel-item",this._element)}_getItems(){return Q.find(".carousel-item",this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(t){return p()?t===Z?J:G:t===Z?G:J}_orderToDirection(t){return p()?t===J?Z:tt:t===J?tt:Z}static jQueryInterface(t){return this.each((function(){const e=at.getOrCreateInstance(this,t);if("number"!=typeof t){if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}else e.to(t)}))}}P.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",(function(t){const e=n(this);if(!e||!e.classList.contains(it))return;t.preventDefault();const i=at.getOrCreateInstance(e),s=this.getAttribute("data-bs-slide-to");return s?(i.to(s),void i._maybeEnableCycle()):"next"===B.getDataAttribute(this,"slide")?(i.next(),void i._maybeEnableCycle()):(i.prev(),void i._maybeEnableCycle())})),P.on(window,"load.bs.carousel.data-api",(()=>{const t=Q.find('[data-bs-ride="carousel"]');for(const e of t)at.getOrCreateInstance(e)})),g(at);const lt="show",ct="collapse",ht="collapsing",dt='[data-bs-toggle="collapse"]',ut={parent:null,toggle:!0},ft={parent:"(null|element)",toggle:"boolean"};class pt extends z{constructor(t,e){super(t,e),this._isTransitioning=!1,this._triggerArray=[];const n=Q.find(dt);for(const t of n){const e=i(t),n=Q.find(e).filter((t=>t===this._element));null!==e&&n.length&&this._triggerArray.push(t)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return ut}static get DefaultType(){return ft}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((t=>t!==this._element)).map((t=>pt.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(P.trigger(this._element,"show.bs.collapse").defaultPrevented)return;for(const e of t)e.hide();const e=this._getDimension();this._element.classList.remove(ct),this._element.classList.add(ht),this._element.style[e]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${e[0].toUpperCase()+e.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct,lt),this._element.style[e]="",P.trigger(this._element,"shown.bs.collapse")}),this._element,!0),this._element.style[e]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(P.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,d(this._element),this._element.classList.add(ht),this._element.classList.remove(ct,lt);for(const t of this._triggerArray){const e=n(t);e&&!this._isShown(e)&&this._addAriaAndCollapsedClass([t],!1)}this._isTransitioning=!0,this._element.style[t]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct),P.trigger(this._element,"hidden.bs.collapse")}),this._element,!0)}_isShown(t=this._element){return t.classList.contains(lt)}_configAfterMerge(t){return t.toggle=Boolean(t.toggle),t.parent=r(t.parent),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=this._getFirstLevelChildren(dt);for(const e of t){const t=n(e);t&&this._addAriaAndCollapsedClass([e],this._isShown(t))}}_getFirstLevelChildren(t){const e=Q.find(":scope .collapse .collapse",this._config.parent);return Q.find(t,this._config.parent).filter((t=>!e.includes(t)))}_addAriaAndCollapsedClass(t,e){if(t.length)for(const i of t)i.classList.toggle("collapsed",!e),i.setAttribute("aria-expanded",e)}static jQueryInterface(t){const e={};return"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1),this.each((function(){const i=pt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}}P.on(document,"click.bs.collapse.data-api",dt,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=i(this),n=Q.find(e);for(const t of n)pt.getOrCreateInstance(t,{toggle:!1}).toggle()})),g(pt);var gt="top",mt="bottom",_t="right",bt="left",vt="auto",yt=[gt,mt,_t,bt],wt="start",At="end",Et="clippingParents",Tt="viewport",Ct="popper",Ot="reference",xt=yt.reduce((function(t,e){return t.concat([e+"-"+wt,e+"-"+At])}),[]),kt=[].concat(yt,[vt]).reduce((function(t,e){return t.concat([e,e+"-"+wt,e+"-"+At])}),[]),Lt="beforeRead",Dt="read",St="afterRead",It="beforeMain",Nt="main",Pt="afterMain",jt="beforeWrite",Mt="write",Ht="afterWrite",$t=[Lt,Dt,St,It,Nt,Pt,jt,Mt,Ht];function Wt(t){return t?(t.nodeName||"").toLowerCase():null}function Bt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ft(t){return t instanceof Bt(t).Element||t instanceof Element}function zt(t){return t instanceof Bt(t).HTMLElement||t instanceof HTMLElement}function qt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Bt(t).ShadowRoot||t instanceof ShadowRoot)}const Rt={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];zt(s)&&Wt(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});zt(n)&&Wt(n)&&(Object.assign(n.style,o),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Vt(t){return t.split("-")[0]}var Kt=Math.max,Qt=Math.min,Xt=Math.round;function Yt(){var t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Ut(){return!/^((?!chrome|android).)*safari/i.test(Yt())}function Gt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,o=1;e&&zt(t)&&(s=t.offsetWidth>0&&Xt(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Xt(n.height)/t.offsetHeight||1);var r=(Ft(t)?Bt(t):window).visualViewport,a=!Ut()&&i,l=(n.left+(a&&r?r.offsetLeft:0))/s,c=(n.top+(a&&r?r.offsetTop:0))/o,h=n.width/s,d=n.height/o;return{width:h,height:d,top:c,right:l+h,bottom:c+d,left:l,x:l,y:c}}function Jt(t){var e=Gt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Zt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&qt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function te(t){return Bt(t).getComputedStyle(t)}function ee(t){return["table","td","th"].indexOf(Wt(t))>=0}function ie(t){return((Ft(t)?t.ownerDocument:t.document)||window.document).documentElement}function ne(t){return"html"===Wt(t)?t:t.assignedSlot||t.parentNode||(qt(t)?t.host:null)||ie(t)}function se(t){return zt(t)&&"fixed"!==te(t).position?t.offsetParent:null}function oe(t){for(var e=Bt(t),i=se(t);i&&ee(i)&&"static"===te(i).position;)i=se(i);return i&&("html"===Wt(i)||"body"===Wt(i)&&"static"===te(i).position)?e:i||function(t){var e=/firefox/i.test(Yt());if(/Trident/i.test(Yt())&&zt(t)&&"fixed"===te(t).position)return null;var i=ne(t);for(qt(i)&&(i=i.host);zt(i)&&["html","body"].indexOf(Wt(i))<0;){var n=te(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function re(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ae(t,e,i){return Kt(t,Qt(e,i))}function le(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function ce(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}const he={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,o=i.elements.arrow,r=i.modifiersData.popperOffsets,a=Vt(i.placement),l=re(a),c=[bt,_t].indexOf(a)>=0?"height":"width";if(o&&r){var h=function(t,e){return le("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:ce(t,yt))}(s.padding,i),d=Jt(o),u="y"===l?gt:bt,f="y"===l?mt:_t,p=i.rects.reference[c]+i.rects.reference[l]-r[l]-i.rects.popper[c],g=r[l]-i.rects.reference[l],m=oe(o),_=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=p/2-g/2,v=h[u],y=_-d[c]-h[f],w=_/2-d[c]/2+b,A=ae(v,w,y),E=l;i.modifiersData[n]=((e={})[E]=A,e.centerOffset=A-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Zt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function de(t){return t.split("-")[1]}var ue={top:"auto",right:"auto",bottom:"auto",left:"auto"};function fe(t){var e,i=t.popper,n=t.popperRect,s=t.placement,o=t.variation,r=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,d=t.isFixed,u=r.x,f=void 0===u?0:u,p=r.y,g=void 0===p?0:p,m="function"==typeof h?h({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var _=r.hasOwnProperty("x"),b=r.hasOwnProperty("y"),v=bt,y=gt,w=window;if(c){var A=oe(i),E="clientHeight",T="clientWidth";A===Bt(i)&&"static"!==te(A=ie(i)).position&&"absolute"===a&&(E="scrollHeight",T="scrollWidth"),(s===gt||(s===bt||s===_t)&&o===At)&&(y=mt,g-=(d&&A===w&&w.visualViewport?w.visualViewport.height:A[E])-n.height,g*=l?1:-1),s!==bt&&(s!==gt&&s!==mt||o!==At)||(v=_t,f-=(d&&A===w&&w.visualViewport?w.visualViewport.width:A[T])-n.width,f*=l?1:-1)}var C,O=Object.assign({position:a},c&&ue),x=!0===h?function(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return{x:Xt(e*n)/n||0,y:Xt(i*n)/n||0}}({x:f,y:g}):{x:f,y:g};return f=x.x,g=x.y,l?Object.assign({},O,((C={})[y]=b?"0":"",C[v]=_?"0":"",C.transform=(w.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",C)):Object.assign({},O,((e={})[y]=b?g+"px":"",e[v]=_?f+"px":"",e.transform="",e))}const pe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,o=i.adaptive,r=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Vt(e.placement),variation:de(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,fe(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,fe(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}};var ge={passive:!0};const me={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,o=void 0===s||s,r=n.resize,a=void 0===r||r,l=Bt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,ge)})),a&&l.addEventListener("resize",i.update,ge),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,ge)})),a&&l.removeEventListener("resize",i.update,ge)}},data:{}};var _e={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,(function(t){return _e[t]}))}var ve={start:"end",end:"start"};function ye(t){return t.replace(/start|end/g,(function(t){return ve[t]}))}function we(t){var e=Bt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ae(t){return Gt(ie(t)).left+we(t).scrollLeft}function Ee(t){var e=te(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function Te(t){return["html","body","#document"].indexOf(Wt(t))>=0?t.ownerDocument.body:zt(t)&&Ee(t)?t:Te(ne(t))}function Ce(t,e){var i;void 0===e&&(e=[]);var n=Te(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),o=Bt(n),r=s?[o].concat(o.visualViewport||[],Ee(n)?n:[]):n,a=e.concat(r);return s?a:a.concat(Ce(ne(r)))}function Oe(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xe(t,e,i){return e===Tt?Oe(function(t,e){var i=Bt(t),n=ie(t),s=i.visualViewport,o=n.clientWidth,r=n.clientHeight,a=0,l=0;if(s){o=s.width,r=s.height;var c=Ut();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:r,x:a+Ae(t),y:l}}(t,i)):Ft(e)?function(t,e){var i=Gt(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):Oe(function(t){var e,i=ie(t),n=we(t),s=null==(e=t.ownerDocument)?void 0:e.body,o=Kt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=Kt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+Ae(t),l=-n.scrollTop;return"rtl"===te(s||i).direction&&(a+=Kt(i.clientWidth,s?s.clientWidth:0)-o),{width:o,height:r,x:a,y:l}}(ie(t)))}function ke(t){var e,i=t.reference,n=t.element,s=t.placement,o=s?Vt(s):null,r=s?de(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case gt:e={x:a,y:i.y-n.height};break;case mt:e={x:a,y:i.y+i.height};break;case _t:e={x:i.x+i.width,y:l};break;case bt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=o?re(o):null;if(null!=c){var h="y"===c?"height":"width";switch(r){case wt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case At:e[c]=e[c]+(i[h]/2-n[h]/2)}}return e}function Le(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,o=i.strategy,r=void 0===o?t.strategy:o,a=i.boundary,l=void 0===a?Et:a,c=i.rootBoundary,h=void 0===c?Tt:c,d=i.elementContext,u=void 0===d?Ct:d,f=i.altBoundary,p=void 0!==f&&f,g=i.padding,m=void 0===g?0:g,_=le("number"!=typeof m?m:ce(m,yt)),b=u===Ct?Ot:Ct,v=t.rects.popper,y=t.elements[p?b:u],w=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=Ce(ne(t)),i=["absolute","fixed"].indexOf(te(t).position)>=0&&zt(t)?oe(t):t;return Ft(i)?e.filter((function(t){return Ft(t)&&Zt(t,i)&&"body"!==Wt(t)})):[]}(t):[].concat(e),o=[].concat(s,[i]),r=o[0],a=o.reduce((function(e,i){var s=xe(t,i,n);return e.top=Kt(s.top,e.top),e.right=Qt(s.right,e.right),e.bottom=Qt(s.bottom,e.bottom),e.left=Kt(s.left,e.left),e}),xe(t,r,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(Ft(y)?y:y.contextElement||ie(t.elements.popper),l,h,r),A=Gt(t.elements.reference),E=ke({reference:A,element:v,strategy:"absolute",placement:s}),T=Oe(Object.assign({},v,E)),C=u===Ct?T:A,O={top:w.top-C.top+_.top,bottom:C.bottom-w.bottom+_.bottom,left:w.left-C.left+_.left,right:C.right-w.right+_.right},x=t.modifiersData.offset;if(u===Ct&&x){var k=x[s];Object.keys(O).forEach((function(t){var e=[_t,mt].indexOf(t)>=0?1:-1,i=[gt,mt].indexOf(t)>=0?"y":"x";O[t]+=k[i]*e}))}return O}function De(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,o=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?kt:l,h=de(n),d=h?a?xt:xt.filter((function(t){return de(t)===h})):yt,u=d.filter((function(t){return c.indexOf(t)>=0}));0===u.length&&(u=d);var f=u.reduce((function(e,i){return e[i]=Le(t,{placement:i,boundary:s,rootBoundary:o,padding:r})[Vt(i)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}const Se={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0===r||r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,u=i.altBoundary,f=i.flipVariations,p=void 0===f||f,g=i.allowedAutoPlacements,m=e.options.placement,_=Vt(m),b=l||(_!==m&&p?function(t){if(Vt(t)===vt)return[];var e=be(t);return[ye(t),e,ye(e)]}(m):[be(m)]),v=[m].concat(b).reduce((function(t,i){return t.concat(Vt(i)===vt?De(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:g}):i)}),[]),y=e.rects.reference,w=e.rects.popper,A=new Map,E=!0,T=v[0],C=0;C=0,D=L?"width":"height",S=Le(e,{placement:O,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),I=L?k?_t:bt:k?mt:gt;y[D]>w[D]&&(I=be(I));var N=be(I),P=[];if(o&&P.push(S[x]<=0),a&&P.push(S[I]<=0,S[N]<=0),P.every((function(t){return t}))){T=O,E=!1;break}A.set(O,P)}if(E)for(var j=function(t){var e=v.find((function(e){var i=A.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return T=e,"break"},M=p?3:1;M>0&&"break"!==j(M);M--);e.placement!==T&&(e.modifiersData[n]._skip=!0,e.placement=T,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Ie(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Ne(t){return[gt,_t,mt,bt].some((function(e){return t[e]>=0}))}const Pe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,o=e.modifiersData.preventOverflow,r=Le(e,{elementContext:"reference"}),a=Le(e,{altBoundary:!0}),l=Ie(r,n),c=Ie(a,s,o),h=Ne(l),d=Ne(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}},je={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,o=void 0===s?[0,0]:s,r=kt.reduce((function(t,i){return t[i]=function(t,e,i){var n=Vt(t),s=[bt,gt].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,r=o[0],a=o[1];return r=r||0,a=(a||0)*s,[bt,_t].indexOf(n)>=0?{x:a,y:r}:{x:r,y:a}}(i,e.rects,o),t}),{}),a=r[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=r}},Me={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=ke({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},He={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0!==r&&r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,u=i.tether,f=void 0===u||u,p=i.tetherOffset,g=void 0===p?0:p,m=Le(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),_=Vt(e.placement),b=de(e.placement),v=!b,y=re(_),w="x"===y?"y":"x",A=e.modifiersData.popperOffsets,E=e.rects.reference,T=e.rects.popper,C="function"==typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,O="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),x=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(A){if(o){var L,D="y"===y?gt:bt,S="y"===y?mt:_t,I="y"===y?"height":"width",N=A[y],P=N+m[D],j=N-m[S],M=f?-T[I]/2:0,H=b===wt?E[I]:T[I],$=b===wt?-T[I]:-E[I],W=e.elements.arrow,B=f&&W?Jt(W):{width:0,height:0},F=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},z=F[D],q=F[S],R=ae(0,E[I],B[I]),V=v?E[I]/2-M-R-z-O.mainAxis:H-R-z-O.mainAxis,K=v?-E[I]/2+M+R+q+O.mainAxis:$+R+q+O.mainAxis,Q=e.elements.arrow&&oe(e.elements.arrow),X=Q?"y"===y?Q.clientTop||0:Q.clientLeft||0:0,Y=null!=(L=null==x?void 0:x[y])?L:0,U=N+K-Y,G=ae(f?Qt(P,N+V-Y-X):P,N,f?Kt(j,U):j);A[y]=G,k[y]=G-N}if(a){var J,Z="x"===y?gt:bt,tt="x"===y?mt:_t,et=A[w],it="y"===w?"height":"width",nt=et+m[Z],st=et-m[tt],ot=-1!==[gt,bt].indexOf(_),rt=null!=(J=null==x?void 0:x[w])?J:0,at=ot?nt:et-E[it]-T[it]-rt+O.altAxis,lt=ot?et+E[it]+T[it]-rt-O.altAxis:st,ct=f&&ot?function(t,e,i){var n=ae(t,e,i);return n>i?i:n}(at,et,lt):ae(f?at:nt,et,f?lt:st);A[w]=ct,k[w]=ct-et}e.modifiersData[n]=k}},requiresIfExists:["offset"]};function $e(t,e,i){void 0===i&&(i=!1);var n,s,o=zt(e),r=zt(e)&&function(t){var e=t.getBoundingClientRect(),i=Xt(e.width)/t.offsetWidth||1,n=Xt(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=ie(e),l=Gt(t,r,i),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(o||!o&&!i)&&(("body"!==Wt(e)||Ee(a))&&(c=(n=e)!==Bt(n)&&zt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:we(n)),zt(e)?((h=Gt(e,!0)).x+=e.clientLeft,h.y+=e.clientTop):a&&(h.x=Ae(a))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function We(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var Be={placement:"bottom",modifiers:[],strategy:"absolute"};function Fe(){for(var t=arguments.length,e=new Array(t),i=0;iNumber.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(B.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}_selectMenuItem({key:t,target:e}){const i=Q.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter((t=>a(t)));i.length&&b(i,e,t===Ye,!i.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;const e=Q.find(ti);for(const i of e){const e=hi.getInstance(i);if(!e||!1===e._config.autoClose)continue;const n=t.composedPath(),s=n.includes(e._menu);if(n.includes(e._element)||"inside"===e._config.autoClose&&!s||"outside"===e._config.autoClose&&s)continue;if(e._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const o={relatedTarget:e._element};"click"===t.type&&(o.clickEvent=t),e._completeHide(o)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),i="Escape"===t.key,n=[Xe,Ye].includes(t.key);if(!n&&!i)return;if(e&&!i)return;t.preventDefault();const s=this.matches(Ze)?this:Q.prev(this,Ze)[0]||Q.next(this,Ze)[0]||Q.findOne(Ze,t.delegateTarget.parentNode),o=hi.getOrCreateInstance(s);if(n)return t.stopPropagation(),o.show(),void o._selectMenuItem(t);o._isShown()&&(t.stopPropagation(),o.hide(),s.focus())}}P.on(document,Ge,Ze,hi.dataApiKeydownHandler),P.on(document,Ge,ei,hi.dataApiKeydownHandler),P.on(document,Ue,hi.clearMenus),P.on(document,"keyup.bs.dropdown.data-api",hi.clearMenus),P.on(document,Ue,Ze,(function(t){t.preventDefault(),hi.getOrCreateInstance(this).toggle()})),g(hi);const di=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",ui=".sticky-top",fi="padding-right",pi="margin-right";class gi{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,fi,(e=>e+t)),this._setElementAttributes(di,fi,(e=>e+t)),this._setElementAttributes(ui,pi,(e=>e-t))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,fi),this._resetElementAttributes(di,fi),this._resetElementAttributes(ui,pi)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const n=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n)return;this._saveInitialAttribute(t,e);const s=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${i(Number.parseFloat(s))}px`)}))}_saveInitialAttribute(t,e){const i=t.style.getPropertyValue(e);i&&B.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=B.getDataAttribute(t,e);null!==i?(B.removeDataAttribute(t,e),t.style.setProperty(e,i)):t.style.removeProperty(e)}))}_applyManipulationCallback(t,e){if(o(t))e(t);else for(const i of Q.find(t,this._element))e(i)}}const mi="show",_i="mousedown.bs.backdrop",bi={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},vi={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class yi extends F{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return bi}static get DefaultType(){return vi}static get NAME(){return"backdrop"}show(t){if(!this._config.isVisible)return void m(t);this._append();const e=this._getElement();this._config.isAnimated&&d(e),e.classList.add(mi),this._emulateAnimation((()=>{m(t)}))}hide(t){this._config.isVisible?(this._getElement().classList.remove(mi),this._emulateAnimation((()=>{this.dispose(),m(t)}))):m(t)}dispose(){this._isAppended&&(P.off(this._element,_i),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=r(t.rootElement),t}_append(){if(this._isAppended)return;const t=this._getElement();this._config.rootElement.append(t),P.on(t,_i,(()=>{m(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(t){_(t,this._getElement(),this._config.isAnimated)}}const wi=".bs.focustrap",Ai="backward",Ei={autofocus:!0,trapElement:null},Ti={autofocus:"boolean",trapElement:"element"};class Ci extends F{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Ei}static get DefaultType(){return Ti}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),P.off(document,wi),P.on(document,"focusin.bs.focustrap",(t=>this._handleFocusin(t))),P.on(document,"keydown.tab.bs.focustrap",(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,P.off(document,wi))}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target))return;const i=Q.focusableChildren(e);0===i.length?e.focus():this._lastTabNavDirection===Ai?i[i.length-1].focus():i[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Ai:"forward")}}const Oi="hidden.bs.modal",xi="show.bs.modal",ki="modal-open",Li="show",Di="modal-static",Si={backdrop:!0,focus:!0,keyboard:!0},Ii={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class Ni extends z{constructor(t,e){super(t,e),this._dialog=Q.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new gi,this._addEventListeners()}static get Default(){return Si}static get DefaultType(){return Ii}static get NAME(){return"modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||P.trigger(this._element,xi,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(ki),this._adjustDialog(),this._backdrop.show((()=>this._showElement(t))))}hide(){this._isShown&&!this._isTransitioning&&(P.trigger(this._element,"hide.bs.modal").defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(Li),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated())))}dispose(){for(const t of[window,this._dialog])P.off(t,".bs.modal");this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new yi({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Ci({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const e=Q.findOne(".modal-body",this._dialog);e&&(e.scrollTop=0),d(this._element),this._element.classList.add(Li),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,P.trigger(this._element,"shown.bs.modal",{relatedTarget:t})}),this._dialog,this._isAnimated())}_addEventListeners(){P.on(this._element,"keydown.dismiss.bs.modal",(t=>{if("Escape"===t.key)return this._config.keyboard?(t.preventDefault(),void this.hide()):void this._triggerBackdropTransition()})),P.on(window,"resize.bs.modal",(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),P.on(this._element,"mousedown.dismiss.bs.modal",(t=>{P.one(this._element,"click.dismiss.bs.modal",(e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(ki),this._resetAdjustments(),this._scrollBar.reset(),P.trigger(this._element,Oi)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(P.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._element.style.overflowY;"hidden"===e||this._element.classList.contains(Di)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(Di),this._queueCallback((()=>{this._element.classList.remove(Di),this._queueCallback((()=>{this._element.style.overflowY=e}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;if(i&&!t){const t=p()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!i&&t){const t=p()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=Ni.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}P.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=n(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),P.one(e,xi,(t=>{t.defaultPrevented||P.one(e,Oi,(()=>{a(this)&&this.focus()}))}));const i=Q.findOne(".modal.show");i&&Ni.getInstance(i).hide(),Ni.getOrCreateInstance(e).toggle(this)})),q(Ni),g(Ni);const Pi="show",ji="showing",Mi="hiding",Hi=".offcanvas.show",$i="hidePrevented.bs.offcanvas",Wi="hidden.bs.offcanvas",Bi={backdrop:!0,keyboard:!0,scroll:!1},Fi={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class zi extends z{constructor(t,e){super(t,e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return Bi}static get DefaultType(){return Fi}static get NAME(){return"offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||P.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._backdrop.show(),this._config.scroll||(new gi).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(ji),this._queueCallback((()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(Pi),this._element.classList.remove(ji),P.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t})}),this._element,!0))}hide(){this._isShown&&(P.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(Mi),this._backdrop.hide(),this._queueCallback((()=>{this._element.classList.remove(Pi,Mi),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new gi).reset(),P.trigger(this._element,Wi)}),this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const t=Boolean(this._config.backdrop);return new yi({className:"offcanvas-backdrop",isVisible:t,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:t?()=>{"static"!==this._config.backdrop?this.hide():P.trigger(this._element,$i)}:null})}_initializeFocusTrap(){return new Ci({trapElement:this._element})}_addEventListeners(){P.on(this._element,"keydown.dismiss.bs.offcanvas",(t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():P.trigger(this._element,$i))}))}static jQueryInterface(t){return this.each((function(){const e=zi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}P.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=n(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),l(this))return;P.one(e,Wi,(()=>{a(this)&&this.focus()}));const i=Q.findOne(Hi);i&&i!==e&&zi.getInstance(i).hide(),zi.getOrCreateInstance(e).toggle(this)})),P.on(window,"load.bs.offcanvas.data-api",(()=>{for(const t of Q.find(Hi))zi.getOrCreateInstance(t).show()})),P.on(window,"resize.bs.offcanvas",(()=>{for(const t of Q.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(t).position&&zi.getOrCreateInstance(t).hide()})),q(zi),g(zi);const qi=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Ri=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Vi=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Ki=(t,e)=>{const i=t.nodeName.toLowerCase();return e.includes(i)?!qi.has(i)||Boolean(Ri.test(t.nodeValue)||Vi.test(t.nodeValue)):e.filter((t=>t instanceof RegExp)).some((t=>t.test(i)))},Qi={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},Xi={allowList:Qi,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"
"},Yi={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},Ui={entry:"(string|element|function|null)",selector:"(string|element)"};class Gi extends F{constructor(t){super(),this._config=this._getConfig(t)}static get Default(){return Xi}static get DefaultType(){return Yi}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map((t=>this._resolvePossibleFunction(t))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(t){return this._checkContent(t),this._config.content={...this._config.content,...t},this}toHtml(){const t=document.createElement("div");t.innerHTML=this._maybeSanitize(this._config.template);for(const[e,i]of Object.entries(this._config.content))this._setContent(t,i,e);const e=t.children[0],i=this._resolvePossibleFunction(this._config.extraClass);return i&&e.classList.add(...i.split(" ")),e}_typeCheckConfig(t){super._typeCheckConfig(t),this._checkContent(t.content)}_checkContent(t){for(const[e,i]of Object.entries(t))super._typeCheckConfig({selector:e,entry:i},Ui)}_setContent(t,e,i){const n=Q.findOne(i,t);n&&((e=this._resolvePossibleFunction(e))?o(e)?this._putElementInTemplate(r(e),n):this._config.html?n.innerHTML=this._maybeSanitize(e):n.textContent=e:n.remove())}_maybeSanitize(t){return this._config.sanitize?function(t,e,i){if(!t.length)return t;if(i&&"function"==typeof i)return i(t);const n=(new window.DOMParser).parseFromString(t,"text/html"),s=[].concat(...n.body.querySelectorAll("*"));for(const t of s){const i=t.nodeName.toLowerCase();if(!Object.keys(e).includes(i)){t.remove();continue}const n=[].concat(...t.attributes),s=[].concat(e["*"]||[],e[i]||[]);for(const e of n)Ki(e,s)||t.removeAttribute(e.nodeName)}return n.body.innerHTML}(t,this._config.allowList,this._config.sanitizeFn):t}_resolvePossibleFunction(t){return"function"==typeof t?t(this):t}_putElementInTemplate(t,e){if(this._config.html)return e.innerHTML="",void e.append(t);e.textContent=t.textContent}}const Ji=new Set(["sanitize","allowList","sanitizeFn"]),Zi="fade",tn="show",en=".modal",nn="hide.bs.modal",sn="hover",on="focus",rn={AUTO:"auto",TOP:"top",RIGHT:p()?"left":"right",BOTTOM:"bottom",LEFT:p()?"right":"left"},an={allowList:Qi,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,0],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'',title:"",trigger:"hover focus"},ln={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class cn extends z{constructor(t,e){if(void 0===Ke)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t,e),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return an}static get DefaultType(){return ln}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),P.off(this._element.closest(en),nn,this._hideModalHandler),this.tip&&this.tip.remove(),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const t=P.trigger(this._element,this.constructor.eventName("show")),e=(c(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(t.defaultPrevented||!e)return;this.tip&&(this.tip.remove(),this.tip=null);const i=this._getTipElement();this._element.setAttribute("aria-describedby",i.getAttribute("id"));const{container:n}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(n.append(i),P.trigger(this._element,this.constructor.eventName("inserted"))),this._popper?this._popper.update():this._popper=this._createPopper(i),i.classList.add(tn),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.on(t,"mouseover",h);this._queueCallback((()=>{P.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1}),this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(P.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;const t=this._getTipElement();if(t.classList.remove(tn),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.off(t,"mouseover",h);this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,this._isHovered=null,this._queueCallback((()=>{this._isWithActiveTrigger()||(this._isHovered||t.remove(),this._element.removeAttribute("aria-describedby"),P.trigger(this._element,this.constructor.eventName("hidden")),this._disposePopper())}),this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(t){const e=this._getTemplateFactory(t).toHtml();if(!e)return null;e.classList.remove(Zi,tn),e.classList.add(`bs-${this.constructor.NAME}-auto`);const i=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME).toString();return e.setAttribute("id",i),this._isAnimated()&&e.classList.add(Zi),e}setContent(t){this._newContent=t,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(t){return this._templateFactory?this._templateFactory.changeContent(t):this._templateFactory=new Gi({...this._config,content:t,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{".tooltip-inner":this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(t){return this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(Zi)}_isShown(){return this.tip&&this.tip.classList.contains(tn)}_createPopper(t){const e="function"==typeof this._config.placement?this._config.placement.call(this,t,this._element):this._config.placement,i=rn[e.toUpperCase()];return Ve(this._element,t,this._getPopperConfig(i))}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return"function"==typeof t?t.call(this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:t=>{this._getTipElement().setAttribute("data-popper-placement",t.state.placement)}}]};return{...e,..."function"==typeof this._config.popperConfig?this._config.popperConfig(e):this._config.popperConfig}}_setListeners(){const t=this._config.trigger.split(" ");for(const e of t)if("click"===e)P.on(this._element,this.constructor.eventName("click"),this._config.selector,(t=>{this._initializeOnDelegatedTarget(t).toggle()}));else if("manual"!==e){const t=e===sn?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),i=e===sn?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");P.on(this._element,t,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusin"===t.type?on:sn]=!0,e._enter()})),P.on(this._element,i,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusout"===t.type?on:sn]=e._element.contains(t.relatedTarget),e._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},P.on(this._element.closest(en),nn,this._hideModalHandler)}_fixTitle(){const t=this._element.getAttribute("title");t&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",t),this._element.setAttribute("data-bs-original-title",t),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(t,e){clearTimeout(this._timeout),this._timeout=setTimeout(t,e)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(t){const e=B.getDataAttributes(this._element);for(const t of Object.keys(e))Ji.has(t)&&delete e[t];return t={...e,..."object"==typeof t&&t?t:{}},t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t.container=!1===t.container?document.body:r(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),t}_getDelegateConfig(){const t={};for(const e in this._config)this.constructor.Default[e]!==this._config[e]&&(t[e]=this._config[e]);return t.selector=!1,t.trigger="manual",t}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(t){return this.each((function(){const e=cn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(cn);const hn={...cn.Default,content:"",offset:[0,8],placement:"right",template:'',trigger:"click"},dn={...cn.DefaultType,content:"(null|string|element|function)"};class un extends cn{static get Default(){return hn}static get DefaultType(){return dn}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{".popover-header":this._getTitle(),".popover-body":this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(t){return this.each((function(){const e=un.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(un);const fn="click.bs.scrollspy",pn="active",gn="[href]",mn={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},_n={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class bn extends z{constructor(t,e){super(t,e),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return mn}static get DefaultType(){return _n}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const t of this._observableSections.values())this._observer.observe(t)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(t){return t.target=r(t.target)||document.body,t.rootMargin=t.offset?`${t.offset}px 0px -30%`:t.rootMargin,"string"==typeof t.threshold&&(t.threshold=t.threshold.split(",").map((t=>Number.parseFloat(t)))),t}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(P.off(this._config.target,fn),P.on(this._config.target,fn,gn,(t=>{const e=this._observableSections.get(t.target.hash);if(e){t.preventDefault();const i=this._rootElement||window,n=e.offsetTop-this._element.offsetTop;if(i.scrollTo)return void i.scrollTo({top:n,behavior:"smooth"});i.scrollTop=n}})))}_getNewObserver(){const t={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((t=>this._observerCallback(t)),t)}_observerCallback(t){const e=t=>this._targetLinks.get(`#${t.target.id}`),i=t=>{this._previousScrollData.visibleEntryTop=t.target.offsetTop,this._process(e(t))},n=(this._rootElement||document.documentElement).scrollTop,s=n>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=n;for(const o of t){if(!o.isIntersecting){this._activeTarget=null,this._clearActiveClass(e(o));continue}const t=o.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(s&&t){if(i(o),!n)return}else s||t||i(o)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const t=Q.find(gn,this._config.target);for(const e of t){if(!e.hash||l(e))continue;const t=Q.findOne(e.hash,this._element);a(t)&&(this._targetLinks.set(e.hash,e),this._observableSections.set(e.hash,t))}}_process(t){this._activeTarget!==t&&(this._clearActiveClass(this._config.target),this._activeTarget=t,t.classList.add(pn),this._activateParents(t),P.trigger(this._element,"activate.bs.scrollspy",{relatedTarget:t}))}_activateParents(t){if(t.classList.contains("dropdown-item"))Q.findOne(".dropdown-toggle",t.closest(".dropdown")).classList.add(pn);else for(const e of Q.parents(t,".nav, .list-group"))for(const t of Q.prev(e,".nav-link, .nav-item > .nav-link, .list-group-item"))t.classList.add(pn)}_clearActiveClass(t){t.classList.remove(pn);const e=Q.find("[href].active",t);for(const t of e)t.classList.remove(pn)}static jQueryInterface(t){return this.each((function(){const e=bn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}P.on(window,"load.bs.scrollspy.data-api",(()=>{for(const t of Q.find('[data-bs-spy="scroll"]'))bn.getOrCreateInstance(t)})),g(bn);const vn="ArrowLeft",yn="ArrowRight",wn="ArrowUp",An="ArrowDown",En="active",Tn="fade",Cn="show",On='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',xn=`.nav-link:not(.dropdown-toggle), .list-group-item:not(.dropdown-toggle), [role="tab"]:not(.dropdown-toggle), ${On}`;class kn extends z{constructor(t){super(t),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),P.on(this._element,"keydown.bs.tab",(t=>this._keydown(t))))}static get NAME(){return"tab"}show(){const t=this._element;if(this._elemIsActive(t))return;const e=this._getActiveElem(),i=e?P.trigger(e,"hide.bs.tab",{relatedTarget:t}):null;P.trigger(t,"show.bs.tab",{relatedTarget:e}).defaultPrevented||i&&i.defaultPrevented||(this._deactivate(e,t),this._activate(t,e))}_activate(t,e){t&&(t.classList.add(En),this._activate(n(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected",!0),this._toggleDropDown(t,!0),P.trigger(t,"shown.bs.tab",{relatedTarget:e})):t.classList.add(Cn)}),t,t.classList.contains(Tn)))}_deactivate(t,e){t&&(t.classList.remove(En),t.blur(),this._deactivate(n(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.setAttribute("aria-selected",!1),t.setAttribute("tabindex","-1"),this._toggleDropDown(t,!1),P.trigger(t,"hidden.bs.tab",{relatedTarget:e})):t.classList.remove(Cn)}),t,t.classList.contains(Tn)))}_keydown(t){if(![vn,yn,wn,An].includes(t.key))return;t.stopPropagation(),t.preventDefault();const e=[yn,An].includes(t.key),i=b(this._getChildren().filter((t=>!l(t))),t.target,e,!0);i&&(i.focus({preventScroll:!0}),kn.getOrCreateInstance(i).show())}_getChildren(){return Q.find(xn,this._parent)}_getActiveElem(){return this._getChildren().find((t=>this._elemIsActive(t)))||null}_setInitialAttributes(t,e){this._setAttributeIfNotExists(t,"role","tablist");for(const t of e)this._setInitialAttributesOnChild(t)}_setInitialAttributesOnChild(t){t=this._getInnerElement(t);const e=this._elemIsActive(t),i=this._getOuterElement(t);t.setAttribute("aria-selected",e),i!==t&&this._setAttributeIfNotExists(i,"role","presentation"),e||t.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(t,"role","tab"),this._setInitialAttributesOnTargetPanel(t)}_setInitialAttributesOnTargetPanel(t){const e=n(t);e&&(this._setAttributeIfNotExists(e,"role","tabpanel"),t.id&&this._setAttributeIfNotExists(e,"aria-labelledby",`#${t.id}`))}_toggleDropDown(t,e){const i=this._getOuterElement(t);if(!i.classList.contains("dropdown"))return;const n=(t,n)=>{const s=Q.findOne(t,i);s&&s.classList.toggle(n,e)};n(".dropdown-toggle",En),n(".dropdown-menu",Cn),i.setAttribute("aria-expanded",e)}_setAttributeIfNotExists(t,e,i){t.hasAttribute(e)||t.setAttribute(e,i)}_elemIsActive(t){return t.classList.contains(En)}_getInnerElement(t){return t.matches(xn)?t:Q.findOne(xn,t)}_getOuterElement(t){return t.closest(".nav-item, .list-group-item")||t}static jQueryInterface(t){return this.each((function(){const e=kn.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}P.on(document,"click.bs.tab",On,(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),l(this)||kn.getOrCreateInstance(this).show()})),P.on(window,"load.bs.tab",(()=>{for(const t of Q.find('.active[data-bs-toggle="tab"], .active[data-bs-toggle="pill"], .active[data-bs-toggle="list"]'))kn.getOrCreateInstance(t)})),g(kn);const Ln="hide",Dn="show",Sn="showing",In={animation:"boolean",autohide:"boolean",delay:"number"},Nn={animation:!0,autohide:!0,delay:5e3};class Pn extends z{constructor(t,e){super(t,e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Nn}static get DefaultType(){return In}static get NAME(){return"toast"}show(){P.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(Ln),d(this._element),this._element.classList.add(Dn,Sn),this._queueCallback((()=>{this._element.classList.remove(Sn),P.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this.isShown()&&(P.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(Sn),this._queueCallback((()=>{this._element.classList.add(Ln),this._element.classList.remove(Sn,Dn),P.trigger(this._element,"hidden.bs.toast")}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(Dn),super.dispose()}isShown(){return this._element.classList.contains(Dn)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){P.on(this._element,"mouseover.bs.toast",(t=>this._onInteraction(t,!0))),P.on(this._element,"mouseout.bs.toast",(t=>this._onInteraction(t,!1))),P.on(this._element,"focusin.bs.toast",(t=>this._onInteraction(t,!0))),P.on(this._element,"focusout.bs.toast",(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=Pn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return q(Pn),g(Pn),{Alert:R,Button:K,Carousel:at,Collapse:pt,Dropdown:hi,Modal:Ni,Offcanvas:zi,Popover:un,ScrollSpy:bn,Tab:kn,Toast:Pn,Tooltip:cn}})); -//# sourceMappingURL=bootstrap.bundle.min.js.map \ No newline at end of file diff --git a/docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js.map b/docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js.map deleted file mode 100644 index 69926c2e5..000000000 --- a/docs/deps/bootstrap-5.2.2/bootstrap.bundle.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["TRANSITION_END","getSelector","element","selector","getAttribute","hrefAttribute","includes","startsWith","split","trim","getSelectorFromElement","document","querySelector","getElementFromSelector","triggerTransitionEnd","dispatchEvent","Event","isElement","object","jquery","nodeType","getElement","length","isVisible","getClientRects","elementIsVisible","getComputedStyle","getPropertyValue","closedDetails","closest","summary","parentNode","isDisabled","Node","ELEMENT_NODE","classList","contains","disabled","hasAttribute","findShadowRoot","documentElement","attachShadow","getRootNode","root","ShadowRoot","noop","reflow","offsetHeight","getjQuery","window","jQuery","body","DOMContentLoadedCallbacks","isRTL","dir","defineJQueryPlugin","plugin","callback","$","name","NAME","JQUERY_NO_CONFLICT","fn","jQueryInterface","Constructor","noConflict","readyState","addEventListener","push","execute","executeAfterTransition","transitionElement","waitForTransition","emulatedDuration","transitionDuration","transitionDelay","floatTransitionDuration","Number","parseFloat","floatTransitionDelay","getTransitionDurationFromElement","called","handler","target","removeEventListener","setTimeout","getNextActiveElement","list","activeElement","shouldGetNext","isCycleAllowed","listLength","index","indexOf","Math","max","min","namespaceRegex","stripNameRegex","stripUidRegex","eventRegistry","uidEvent","customEvents","mouseenter","mouseleave","nativeEvents","Set","makeEventUid","uid","getElementEvents","findHandler","events","callable","delegationSelector","Object","values","find","event","normalizeParameters","originalTypeEvent","delegationFunction","isDelegated","typeEvent","getTypeEvent","has","addHandler","oneOff","wrapFunction","relatedTarget","delegateTarget","call","this","handlers","previousFunction","replace","domElements","querySelectorAll","domElement","hydrateObj","EventHandler","off","type","apply","bootstrapDelegationHandler","bootstrapHandler","removeHandler","Boolean","removeNamespacedHandlers","namespace","storeElementEvent","handlerKey","keys","on","one","inNamespace","isNamespace","elementEvent","slice","keyHandlers","trigger","args","jQueryEvent","bubbles","nativeDispatch","defaultPrevented","isPropagationStopped","isImmediatePropagationStopped","isDefaultPrevented","evt","cancelable","preventDefault","obj","meta","key","value","entries","_unused","defineProperty","configurable","get","elementMap","Map","Data","set","instance","instanceMap","size","console","error","Array","from","remove","delete","normalizeData","toString","JSON","parse","decodeURIComponent","normalizeDataKey","chr","toLowerCase","Manipulator","setDataAttribute","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","bsKeys","dataset","filter","pureKey","charAt","getDataAttribute","Config","Default","DefaultType","Error","_getConfig","config","_mergeConfigObj","_configAfterMerge","_typeCheckConfig","jsonConfig","constructor","configTypes","property","expectedTypes","valueType","prototype","match","RegExp","test","TypeError","toUpperCase","BaseComponent","super","_element","_config","DATA_KEY","dispose","EVENT_KEY","propertyName","getOwnPropertyNames","_queueCallback","isAnimated","static","getInstance","VERSION","enableDismissTrigger","component","method","clickEvent","tagName","getOrCreateInstance","Alert","close","_destroyElement","each","data","undefined","SELECTOR_DATA_TOGGLE","Button","toggle","button","SelectorEngine","concat","Element","findOne","children","child","matches","parents","ancestor","prev","previous","previousElementSibling","next","nextElementSibling","focusableChildren","focusables","map","join","el","endCallback","leftCallback","rightCallback","Swipe","isSupported","_deltaX","_supportPointerEvents","PointerEvent","_initEvents","_start","_eventIsPointerPenTouch","clientX","touches","_end","_handleSwipe","_move","absDeltaX","abs","direction","add","pointerType","navigator","maxTouchPoints","ORDER_NEXT","ORDER_PREV","DIRECTION_LEFT","DIRECTION_RIGHT","EVENT_SLID","CLASS_NAME_CAROUSEL","CLASS_NAME_ACTIVE","KEY_TO_DIRECTION","ArrowLeft","ArrowRight","interval","keyboard","pause","ride","touch","wrap","Carousel","_interval","_activeElement","_isSliding","touchTimeout","_swipeHelper","_indicatorsElement","_addEventListeners","cycle","_slide","nextWhenVisible","hidden","_clearInterval","_updateInterval","setInterval","_maybeEnableCycle","to","items","_getItems","activeIndex","_getItemIndex","_getActive","order","defaultInterval","_keydown","_addTouchEventListeners","img","swipeConfig","_directionToOrder","clearTimeout","_setActiveIndicatorElement","activeIndicator","newActiveIndicator","elementInterval","parseInt","isNext","nextElement","nextElementIndex","triggerEvent","eventName","_orderToDirection","isCycling","directionalClassName","orderClassName","_isAnimated","SELECTOR_ACTIVE","clearInterval","carousel","slideIndex","carousels","CLASS_NAME_SHOW","CLASS_NAME_COLLAPSE","CLASS_NAME_COLLAPSING","parent","Collapse","_isTransitioning","_triggerArray","toggleList","elem","filterElement","foundElement","_initializeChildren","_addAriaAndCollapsedClass","_isShown","hide","show","activeChildren","_getFirstLevelChildren","activeInstance","dimension","_getDimension","style","scrollSize","getBoundingClientRect","selected","triggerArray","isOpen","selectorElements","top","bottom","right","left","auto","basePlacements","start","end","clippingParents","viewport","popper","reference","variationPlacements","reduce","acc","placement","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases","getNodeName","nodeName","getWindow","node","ownerDocument","defaultView","isHTMLElement","HTMLElement","isShadowRoot","applyStyles$1","enabled","phase","_ref","state","elements","forEach","styles","assign","effect","_ref2","initialStyles","position","options","strategy","margin","arrow","hasOwnProperty","attribute","requires","getBasePlacement","round","getUAString","uaData","userAgentData","brands","item","brand","version","userAgent","isLayoutViewport","includeScale","isFixedStrategy","clientRect","scaleX","scaleY","offsetWidth","width","height","visualViewport","addVisualOffsets","x","offsetLeft","y","offsetTop","getLayoutRect","rootNode","isSameNode","host","isTableElement","getDocumentElement","getParentNode","assignedSlot","getTrueOffsetParent","offsetParent","getOffsetParent","isFirefox","currentNode","css","transform","perspective","contain","willChange","getContainingBlock","getMainAxisFromPlacement","within","mathMax","mathMin","mergePaddingObject","paddingObject","expandToHashMap","hashMap","arrow$1","_state$modifiersData$","arrowElement","popperOffsets","modifiersData","basePlacement","axis","len","padding","rects","toPaddingObject","arrowRect","minProp","maxProp","endDiff","startDiff","arrowOffsetParent","clientSize","clientHeight","clientWidth","centerToReference","center","offset","axisProp","centerOffset","_options$element","requiresIfExists","getVariation","unsetSides","mapToStyles","_Object$assign2","popperRect","variation","offsets","gpuAcceleration","adaptive","roundOffsets","isFixed","_offsets$x","_offsets$y","_ref3","hasX","hasY","sideX","sideY","win","heightProp","widthProp","_Object$assign","commonStyles","_ref4","dpr","devicePixelRatio","roundOffsetsByDPR","computeStyles$1","_ref5","_options$gpuAccelerat","_options$adaptive","_options$roundOffsets","passive","eventListeners","_options$scroll","scroll","_options$resize","resize","scrollParents","scrollParent","update","hash","getOppositePlacement","matched","getOppositeVariationPlacement","getWindowScroll","scrollLeft","pageXOffset","scrollTop","pageYOffset","getWindowScrollBarX","isScrollParent","_getComputedStyle","overflow","overflowX","overflowY","getScrollParent","listScrollParents","_element$ownerDocumen","isBody","updatedList","rectToClientRect","rect","getClientRectFromMixedType","clippingParent","html","layoutViewport","getViewportRect","clientTop","clientLeft","getInnerBoundingClientRect","winScroll","scrollWidth","scrollHeight","getDocumentRect","computeOffsets","commonX","commonY","mainAxis","detectOverflow","_options","_options$placement","_options$strategy","_options$boundary","boundary","_options$rootBoundary","rootBoundary","_options$elementConte","elementContext","_options$altBoundary","altBoundary","_options$padding","altContext","clippingClientRect","mainClippingParents","clipperElement","getClippingParents","firstClippingParent","clippingRect","accRect","getClippingRect","contextElement","referenceClientRect","popperClientRect","elementClientRect","overflowOffsets","offsetData","multiply","computeAutoPlacement","flipVariations","_options$allowedAutoP","allowedAutoPlacements","allPlacements","allowedPlacements","overflows","sort","a","b","flip$1","_skip","_options$mainAxis","checkMainAxis","_options$altAxis","altAxis","checkAltAxis","specifiedFallbackPlacements","fallbackPlacements","_options$flipVariatio","preferredPlacement","oppositePlacement","getExpandedFallbackPlacements","referenceRect","checksMap","makeFallbackChecks","firstFittingPlacement","i","_basePlacement","isStartVariation","isVertical","mainVariationSide","altVariationSide","checks","every","check","_loop","_i","fittingPlacement","reset","getSideOffsets","preventedOffsets","isAnySideFullyClipped","some","side","hide$1","preventOverflow","referenceOverflow","popperAltOverflow","referenceClippingOffsets","popperEscapeOffsets","isReferenceHidden","hasPopperEscaped","offset$1","_options$offset","invertDistance","skidding","distance","distanceAndSkiddingToXY","_data$state$placement","popperOffsets$1","preventOverflow$1","_options$tether","tether","_options$tetherOffset","tetherOffset","isBasePlacement","tetherOffsetValue","normalizedTetherOffsetValue","offsetModifierState","_offsetModifierState$","mainSide","altSide","additive","minLen","maxLen","arrowPaddingObject","arrowPaddingMin","arrowPaddingMax","arrowLen","minOffset","maxOffset","clientOffset","offsetModifierValue","tetherMax","preventedOffset","_offsetModifierState$2","_mainSide","_altSide","_offset","_len","_min","_max","isOriginSide","_offsetModifierValue","_tetherMin","_tetherMax","_preventedOffset","v","withinMaxClamp","getCompositeRect","elementOrVirtualElement","isOffsetParentAnElement","offsetParentIsScaled","isElementScaled","modifiers","visited","result","modifier","dep","depModifier","DEFAULT_OPTIONS","areValidElements","arguments","_key","popperGenerator","generatorOptions","_generatorOptions","_generatorOptions$def","defaultModifiers","_generatorOptions$def2","defaultOptions","pending","orderedModifiers","effectCleanupFns","isDestroyed","setOptions","setOptionsAction","cleanupModifierEffects","merged","orderModifiers","current","existing","m","_ref3$options","cleanupFn","forceUpdate","_state$elements","_state$orderedModifie","_state$orderedModifie2","Promise","resolve","then","destroy","onFirstUpdate","createPopper","computeStyles","applyStyles","flip","ARROW_UP_KEY","ARROW_DOWN_KEY","EVENT_CLICK_DATA_API","EVENT_KEYDOWN_DATA_API","SELECTOR_DATA_TOGGLE_SHOWN","SELECTOR_MENU","PLACEMENT_TOP","PLACEMENT_TOPEND","PLACEMENT_BOTTOM","PLACEMENT_BOTTOMEND","PLACEMENT_RIGHT","PLACEMENT_LEFT","autoClose","display","popperConfig","Dropdown","_popper","_parent","_menu","_inNavbar","_detectNavbar","_createPopper","focus","_completeHide","Popper","referenceElement","_getPopperConfig","_getPlacement","parentDropdown","isEnd","_getOffset","popperData","defaultBsPopperConfig","_selectMenuItem","openToggles","context","composedPath","isMenuTarget","isInput","isEscapeEvent","isUpOrDownEvent","getToggleButton","stopPropagation","dataApiKeydownHandler","clearMenus","SELECTOR_FIXED_CONTENT","SELECTOR_STICKY_CONTENT","PROPERTY_PADDING","PROPERTY_MARGIN","ScrollBarHelper","getWidth","documentWidth","innerWidth","_disableOverFlow","_setElementAttributes","calculatedValue","_resetElementAttributes","isOverflowing","_saveInitialAttribute","styleProperty","scrollbarWidth","_applyManipulationCallback","setProperty","actualValue","removeProperty","callBack","sel","EVENT_MOUSEDOWN","className","clickCallback","rootElement","Backdrop","_isAppended","_append","_getElement","_emulateAnimation","backdrop","createElement","append","TAB_NAV_BACKWARD","autofocus","trapElement","FocusTrap","_isActive","_lastTabNavDirection","activate","_handleFocusin","_handleKeydown","deactivate","shiftKey","EVENT_HIDDEN","EVENT_SHOW","CLASS_NAME_OPEN","CLASS_NAME_STATIC","Modal","_dialog","_backdrop","_initializeBackDrop","_focustrap","_initializeFocusTrap","_scrollBar","_adjustDialog","_showElement","_hideModal","htmlElement","handleUpdate","modalBody","_triggerBackdropTransition","event2","_resetAdjustments","isModalOverflowing","initialOverflowY","isBodyOverflowing","paddingLeft","paddingRight","showEvent","alreadyOpen","CLASS_NAME_SHOWING","CLASS_NAME_HIDING","OPEN_SELECTOR","EVENT_HIDE_PREVENTED","Offcanvas","blur","uriAttributes","SAFE_URL_PATTERN","DATA_URL_PATTERN","allowedAttribute","allowedAttributeList","attributeName","nodeValue","attributeRegex","regex","DefaultAllowlist","area","br","col","code","div","em","hr","h1","h2","h3","h4","h5","h6","li","ol","p","pre","s","small","span","sub","sup","strong","u","ul","allowList","content","extraClass","sanitize","sanitizeFn","template","DefaultContentType","entry","TemplateFactory","getContent","_resolvePossibleFunction","hasContent","changeContent","_checkContent","toHtml","templateWrapper","innerHTML","_maybeSanitize","text","_setContent","arg","templateElement","_putElementInTemplate","textContent","unsafeHtml","sanitizeFunction","createdDocument","DOMParser","parseFromString","elementName","attributeList","allowedAttributes","sanitizeHtml","DISALLOWED_ATTRIBUTES","CLASS_NAME_FADE","SELECTOR_MODAL","EVENT_MODAL_HIDE","TRIGGER_HOVER","TRIGGER_FOCUS","AttachmentMap","AUTO","TOP","RIGHT","BOTTOM","LEFT","animation","container","customClass","delay","title","Tooltip","_isEnabled","_timeout","_isHovered","_activeTrigger","_templateFactory","_newContent","tip","_setListeners","_fixTitle","enable","disable","toggleEnabled","click","_leave","_enter","_hideModalHandler","_disposePopper","_isWithContent","isInTheDom","_getTipElement","_isWithActiveTrigger","_getTitle","_createTipElement","_getContentForTemplate","_getTemplateFactory","tipId","prefix","floor","random","getElementById","getUID","setContent","_initializeOnDelegatedTarget","_getDelegateConfig","attachment","triggers","eventIn","eventOut","_setTimeout","timeout","dataAttributes","dataAttribute","Popover","_getContent","EVENT_CLICK","SELECTOR_TARGET_LINKS","rootMargin","smoothScroll","threshold","ScrollSpy","_targetLinks","_observableSections","_rootElement","_activeTarget","_observer","_previousScrollData","visibleEntryTop","parentScrollTop","refresh","_initializeTargetsAndObservables","_maybeEnableSmoothScroll","disconnect","_getNewObserver","section","observe","observableSection","scrollTo","behavior","IntersectionObserver","_observerCallback","targetElement","id","_process","userScrollsDown","isIntersecting","_clearActiveClass","entryIsLowerThanPrevious","targetLinks","anchor","_activateParents","listGroup","activeNodes","spy","ARROW_LEFT_KEY","ARROW_RIGHT_KEY","SELECTOR_INNER_ELEM","Tab","_setInitialAttributes","_getChildren","innerElem","_elemIsActive","active","_getActiveElem","hideEvent","_deactivate","_activate","relatedElem","_toggleDropDown","nextActiveElement","preventScroll","_setAttributeIfNotExists","_setInitialAttributesOnChild","_getInnerElement","isActive","outerElem","_getOuterElement","_setInitialAttributesOnTargetPanel","open","CLASS_NAME_HIDE","autohide","Toast","_hasMouseInteraction","_hasKeyboardInteraction","_clearTimeout","_maybeScheduleHide","isShown","_onInteraction","isInteracting"],"sources":["../../js/src/util/index.js","../../js/src/dom/event-handler.js","../../js/src/dom/data.js","../../js/src/dom/manipulator.js","../../js/src/util/config.js","../../js/src/base-component.js","../../js/src/util/component-functions.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/dom/selector-engine.js","../../js/src/util/swipe.js","../../js/src/carousel.js","../../js/src/collapse.js","../../node_modules/@popperjs/core/lib/enums.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../node_modules/@popperjs/core/lib/utils/math.js","../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../node_modules/@popperjs/core/lib/utils/within.js","../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../node_modules/@popperjs/core/lib/createPopper.js","../../node_modules/@popperjs/core/lib/utils/debounce.js","../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../node_modules/@popperjs/core/lib/popper-lite.js","../../node_modules/@popperjs/core/lib/popper.js","../../js/src/dropdown.js","../../js/src/util/scrollbar.js","../../js/src/util/backdrop.js","../../js/src/util/focustrap.js","../../js/src/modal.js","../../js/src/offcanvas.js","../../js/src/util/sanitizer.js","../../js/src/util/template-factory.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/index.umd.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1_000_000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shout-out Angus Croll (https://goo.gl/pxwQGp)\nconst toType = object => {\n if (object === null || object === undefined) {\n return `${object}`\n }\n\n return Object.prototype.toString.call(object).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * Public Util API\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttribute = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {\n hrefAttribute = `#${hrefAttribute.split('#')[1]}`\n }\n\n selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = object => {\n if (!object || typeof object !== 'object') {\n return false\n }\n\n if (typeof object.jquery !== 'undefined') {\n object = object[0]\n }\n\n return typeof object.nodeType !== 'undefined'\n}\n\nconst getElement = object => {\n // it's a jQuery object or a node element\n if (isElement(object)) {\n return object.jquery ? object[0] : object\n }\n\n if (typeof object === 'string' && object.length > 0) {\n return document.querySelector(object)\n }\n\n return null\n}\n\nconst isVisible = element => {\n if (!isElement(element) || element.getClientRects().length === 0) {\n return false\n }\n\n const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'\n // Handle `details` element as its content may falsie appear visible when it is closed\n const closedDetails = element.closest('details:not([open])')\n\n if (!closedDetails) {\n return elementIsVisible\n }\n\n if (closedDetails !== element) {\n const summary = element.closest('summary')\n if (summary && summary.parentNode !== closedDetails) {\n return false\n }\n\n if (summary === null) {\n return false\n }\n }\n\n return elementIsVisible\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => {}\n\n/**\n * Trick to restart an element's animation\n *\n * @param {HTMLElement} element\n * @return void\n *\n * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation\n */\nconst reflow = element => {\n element.offsetHeight // eslint-disable-line no-unused-expressions\n}\n\nconst getjQuery = () => {\n if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return window.jQuery\n }\n\n return null\n}\n\nconst DOMContentLoadedCallbacks = []\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n // add listener on the first call when the document is in loading state\n if (!DOMContentLoadedCallbacks.length) {\n document.addEventListener('DOMContentLoaded', () => {\n for (const callback of DOMContentLoadedCallbacks) {\n callback()\n }\n })\n }\n\n DOMContentLoadedCallbacks.push(callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = plugin => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const name = plugin.NAME\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nconst execute = callback => {\n if (typeof callback === 'function') {\n callback()\n }\n}\n\nconst executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {\n if (!waitForTransition) {\n execute(callback)\n return\n }\n\n const durationPadding = 5\n const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding\n\n let called = false\n\n const handler = ({ target }) => {\n if (target !== transitionElement) {\n return\n }\n\n called = true\n transitionElement.removeEventListener(TRANSITION_END, handler)\n execute(callback)\n }\n\n transitionElement.addEventListener(TRANSITION_END, handler)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(transitionElement)\n }\n }, emulatedDuration)\n}\n\n/**\n * Return the previous/next element of a list.\n *\n * @param {array} list The list of elements\n * @param activeElement The active element\n * @param shouldGetNext Choose to get next or previous element\n * @param isCycleAllowed\n * @return {Element|elem} The proper element\n */\nconst getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {\n const listLength = list.length\n let index = list.indexOf(activeElement)\n\n // if the element does not exist in the list return an element\n // depending on the direction and if cycle is allowed\n if (index === -1) {\n return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]\n }\n\n index += shouldGetNext ? 1 : -1\n\n if (isCycleAllowed) {\n index = (index + listLength) % listLength\n }\n\n return list[Math.max(0, Math.min(index, listLength - 1))]\n}\n\nexport {\n defineJQueryPlugin,\n execute,\n executeAfterTransition,\n findShadowRoot,\n getElement,\n getElementFromSelector,\n getjQuery,\n getNextActiveElement,\n getSelectorFromElement,\n getTransitionDurationFromElement,\n getUID,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop,\n onDOMContentLoaded,\n reflow,\n triggerTransitionEnd,\n toType\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): dom/event-handler.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { getjQuery } from '../util/index'\n\n/**\n * Constants\n */\n\nconst namespaceRegex = /[^.]*(?=\\..*)\\.|.*/\nconst stripNameRegex = /\\..*/\nconst stripUidRegex = /::\\d+$/\nconst eventRegistry = {} // Events storage\nlet uidEvent = 1\nconst customEvents = {\n mouseenter: 'mouseover',\n mouseleave: 'mouseout'\n}\n\nconst nativeEvents = new Set([\n 'click',\n 'dblclick',\n 'mouseup',\n 'mousedown',\n 'contextmenu',\n 'mousewheel',\n 'DOMMouseScroll',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'selectstart',\n 'selectend',\n 'keydown',\n 'keypress',\n 'keyup',\n 'orientationchange',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'touchcancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel',\n 'gesturestart',\n 'gesturechange',\n 'gestureend',\n 'focus',\n 'blur',\n 'change',\n 'reset',\n 'select',\n 'submit',\n 'focusin',\n 'focusout',\n 'load',\n 'unload',\n 'beforeunload',\n 'resize',\n 'move',\n 'DOMContentLoaded',\n 'readystatechange',\n 'error',\n 'abort',\n 'scroll'\n])\n\n/**\n * Private methods\n */\n\nfunction makeEventUid(element, uid) {\n return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++\n}\n\nfunction getElementEvents(element) {\n const uid = makeEventUid(element)\n\n element.uidEvent = uid\n eventRegistry[uid] = eventRegistry[uid] || {}\n\n return eventRegistry[uid]\n}\n\nfunction bootstrapHandler(element, fn) {\n return function handler(event) {\n hydrateObj(event, { delegateTarget: element })\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, fn)\n }\n\n return fn.apply(element, [event])\n }\n}\n\nfunction bootstrapDelegationHandler(element, selector, fn) {\n return function handler(event) {\n const domElements = element.querySelectorAll(selector)\n\n for (let { target } = event; target && target !== this; target = target.parentNode) {\n for (const domElement of domElements) {\n if (domElement !== target) {\n continue\n }\n\n hydrateObj(event, { delegateTarget: target })\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, selector, fn)\n }\n\n return fn.apply(target, [event])\n }\n }\n }\n}\n\nfunction findHandler(events, callable, delegationSelector = null) {\n return Object.values(events)\n .find(event => event.callable === callable && event.delegationSelector === delegationSelector)\n}\n\nfunction normalizeParameters(originalTypeEvent, handler, delegationFunction) {\n const isDelegated = typeof handler === 'string'\n // todo: tooltip passes `false` instead of selector, so we need to check\n const callable = isDelegated ? delegationFunction : (handler || delegationFunction)\n let typeEvent = getTypeEvent(originalTypeEvent)\n\n if (!nativeEvents.has(typeEvent)) {\n typeEvent = originalTypeEvent\n }\n\n return [isDelegated, callable, typeEvent]\n}\n\nfunction addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction)\n\n // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position\n // this prevents the handler from being dispatched the same way as mouseover or mouseout does\n if (originalTypeEvent in customEvents) {\n const wrapFunction = fn => {\n return function (event) {\n if (!event.relatedTarget || (event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget))) {\n return fn.call(this, event)\n }\n }\n }\n\n callable = wrapFunction(callable)\n }\n\n const events = getElementEvents(element)\n const handlers = events[typeEvent] || (events[typeEvent] = {})\n const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null)\n\n if (previousFunction) {\n previousFunction.oneOff = previousFunction.oneOff && oneOff\n\n return\n }\n\n const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''))\n const fn = isDelegated ?\n bootstrapDelegationHandler(element, handler, callable) :\n bootstrapHandler(element, callable)\n\n fn.delegationSelector = isDelegated ? handler : null\n fn.callable = callable\n fn.oneOff = oneOff\n fn.uidEvent = uid\n handlers[uid] = fn\n\n element.addEventListener(typeEvent, fn, isDelegated)\n}\n\nfunction removeHandler(element, events, typeEvent, handler, delegationSelector) {\n const fn = findHandler(events[typeEvent], handler, delegationSelector)\n\n if (!fn) {\n return\n }\n\n element.removeEventListener(typeEvent, fn, Boolean(delegationSelector))\n delete events[typeEvent][fn.uidEvent]\n}\n\nfunction removeNamespacedHandlers(element, events, typeEvent, namespace) {\n const storeElementEvent = events[typeEvent] || {}\n\n for (const handlerKey of Object.keys(storeElementEvent)) {\n if (handlerKey.includes(namespace)) {\n const event = storeElementEvent[handlerKey]\n removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)\n }\n }\n}\n\nfunction getTypeEvent(event) {\n // allow to get the native events from namespaced events ('click.bs.button' --> 'click')\n event = event.replace(stripNameRegex, '')\n return customEvents[event] || event\n}\n\nconst EventHandler = {\n on(element, event, handler, delegationFunction) {\n addHandler(element, event, handler, delegationFunction, false)\n },\n\n one(element, event, handler, delegationFunction) {\n addHandler(element, event, handler, delegationFunction, true)\n },\n\n off(element, originalTypeEvent, handler, delegationFunction) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction)\n const inNamespace = typeEvent !== originalTypeEvent\n const events = getElementEvents(element)\n const storeElementEvent = events[typeEvent] || {}\n const isNamespace = originalTypeEvent.startsWith('.')\n\n if (typeof callable !== 'undefined') {\n // Simplest case: handler is passed, remove that listener ONLY.\n if (!Object.keys(storeElementEvent).length) {\n return\n }\n\n removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null)\n return\n }\n\n if (isNamespace) {\n for (const elementEvent of Object.keys(events)) {\n removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1))\n }\n }\n\n for (const keyHandlers of Object.keys(storeElementEvent)) {\n const handlerKey = keyHandlers.replace(stripUidRegex, '')\n\n if (!inNamespace || originalTypeEvent.includes(handlerKey)) {\n const event = storeElementEvent[keyHandlers]\n removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)\n }\n }\n },\n\n trigger(element, event, args) {\n if (typeof event !== 'string' || !element) {\n return null\n }\n\n const $ = getjQuery()\n const typeEvent = getTypeEvent(event)\n const inNamespace = event !== typeEvent\n\n let jQueryEvent = null\n let bubbles = true\n let nativeDispatch = true\n let defaultPrevented = false\n\n if (inNamespace && $) {\n jQueryEvent = $.Event(event, args)\n\n $(element).trigger(jQueryEvent)\n bubbles = !jQueryEvent.isPropagationStopped()\n nativeDispatch = !jQueryEvent.isImmediatePropagationStopped()\n defaultPrevented = jQueryEvent.isDefaultPrevented()\n }\n\n let evt = new Event(event, { bubbles, cancelable: true })\n evt = hydrateObj(evt, args)\n\n if (defaultPrevented) {\n evt.preventDefault()\n }\n\n if (nativeDispatch) {\n element.dispatchEvent(evt)\n }\n\n if (evt.defaultPrevented && jQueryEvent) {\n jQueryEvent.preventDefault()\n }\n\n return evt\n }\n}\n\nfunction hydrateObj(obj, meta) {\n for (const [key, value] of Object.entries(meta || {})) {\n try {\n obj[key] = value\n } catch {\n Object.defineProperty(obj, key, {\n configurable: true,\n get() {\n return value\n }\n })\n }\n }\n\n return obj\n}\n\nexport default EventHandler\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * Constants\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(value) {\n if (value === 'true') {\n return true\n }\n\n if (value === 'false') {\n return false\n }\n\n if (value === Number(value).toString()) {\n return Number(value)\n }\n\n if (value === '' || value === 'null') {\n return null\n }\n\n if (typeof value !== 'string') {\n return value\n }\n\n try {\n return JSON.parse(decodeURIComponent(value))\n } catch {\n return value\n }\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'))\n\n for (const key of bsKeys) {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n }\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n }\n}\n\nexport default Manipulator\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/config.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { isElement, toType } from './index'\nimport Manipulator from '../dom/manipulator'\n\n/**\n * Class definition\n */\n\nclass Config {\n // Getters\n static get Default() {\n return {}\n }\n\n static get DefaultType() {\n return {}\n }\n\n static get NAME() {\n throw new Error('You have to implement the static method \"NAME\", for each component!')\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n return config\n }\n\n _mergeConfigObj(config, element) {\n const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse\n\n return {\n ...this.constructor.Default,\n ...(typeof jsonConfig === 'object' ? jsonConfig : {}),\n ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),\n ...(typeof config === 'object' ? config : {})\n }\n }\n\n _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {\n for (const property of Object.keys(configTypes)) {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${this.constructor.NAME.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n }\n }\n}\n\nexport default Config\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\nimport { executeAfterTransition, getElement } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Config from './util/config'\n\n/**\n * Constants\n */\n\nconst VERSION = '5.2.2'\n\n/**\n * Class definition\n */\n\nclass BaseComponent extends Config {\n constructor(element, config) {\n super()\n\n element = getElement(element)\n if (!element) {\n return\n }\n\n this._element = element\n this._config = this._getConfig(config)\n\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n // Public\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, this.constructor.EVENT_KEY)\n\n for (const propertyName of Object.getOwnPropertyNames(this)) {\n this[propertyName] = null\n }\n }\n\n _queueCallback(callback, element, isAnimated = true) {\n executeAfterTransition(callback, element, isAnimated)\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config, this._element)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n // Static\n static getInstance(element) {\n return Data.get(getElement(element), this.DATA_KEY)\n }\n\n static getOrCreateInstance(element, config = {}) {\n return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\n }\n\n static get VERSION() {\n return VERSION\n }\n\n static get DATA_KEY() {\n return `bs.${this.NAME}`\n }\n\n static get EVENT_KEY() {\n return `.${this.DATA_KEY}`\n }\n\n static eventName(name) {\n return `${name}${this.EVENT_KEY}`\n }\n}\n\nexport default BaseComponent\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/component-functions.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler'\nimport { getElementFromSelector, isDisabled } from './index'\n\nconst enableDismissTrigger = (component, method = 'hide') => {\n const clickEvent = `click.dismiss${component.EVENT_KEY}`\n const name = component.NAME\n\n EventHandler.on(document, clickEvent, `[data-bs-dismiss=\"${name}\"]`, function (event) {\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n const target = getElementFromSelector(this) || this.closest(`.${name}`)\n const instance = component.getOrCreateInstance(target)\n\n // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method\n instance[method]()\n })\n}\n\nexport {\n enableDismissTrigger\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\nimport { enableDismissTrigger } from './util/component-functions'\n\n/**\n * Constants\n */\n\nconst NAME = 'alert'\nconst DATA_KEY = 'bs.alert'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_CLOSE = `close${EVENT_KEY}`\nconst EVENT_CLOSED = `closed${EVENT_KEY}`\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\n/**\n * Class definition\n */\n\nclass Alert extends BaseComponent {\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n close() {\n const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE)\n\n if (closeEvent.defaultPrevented) {\n return\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n const isAnimated = this._element.classList.contains(CLASS_NAME_FADE)\n this._queueCallback(() => this._destroyElement(), this._element, isAnimated)\n }\n\n // Private\n _destroyElement() {\n this._element.remove()\n EventHandler.trigger(this._element, EVENT_CLOSED)\n this.dispose()\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Alert.getOrCreateInstance(this)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nenableDismissTrigger(Alert, 'close')\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Alert)\n\nexport default Alert\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): button.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\n\n/**\n * Constants\n */\n\nconst NAME = 'button'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst CLASS_NAME_ACTIVE = 'active'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"button\"]'\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\n/**\n * Class definition\n */\n\nclass Button extends BaseComponent {\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method\n this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE))\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Button.getOrCreateInstance(this)\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {\n event.preventDefault()\n\n const button = event.target.closest(SELECTOR_DATA_TOGGLE)\n const data = Button.getOrCreateInstance(button)\n\n data.toggle()\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Button)\n\nexport default Button\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { isDisabled, isVisible } from '../util/index'\n\n/**\n * Constants\n */\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children).filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n let ancestor = element.parentNode.closest(selector)\n\n while (ancestor) {\n parents.push(ancestor)\n ancestor = ancestor.parentNode.closest(selector)\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n // TODO: this is now unused; remove later along with prev()\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n },\n\n focusableChildren(element) {\n const focusables = [\n 'a',\n 'button',\n 'input',\n 'textarea',\n 'select',\n 'details',\n '[tabindex]',\n '[contenteditable=\"true\"]'\n ].map(selector => `${selector}:not([tabindex^=\"-\"])`).join(',')\n\n return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))\n }\n}\n\nexport default SelectorEngine\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/swipe.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Config from './config'\nimport EventHandler from '../dom/event-handler'\nimport { execute } from './index'\n\n/**\n * Constants\n */\n\nconst NAME = 'swipe'\nconst EVENT_KEY = '.bs.swipe'\nconst EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`\nconst EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`\nconst EVENT_TOUCHEND = `touchend${EVENT_KEY}`\nconst EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`\nconst EVENT_POINTERUP = `pointerup${EVENT_KEY}`\nconst POINTER_TYPE_TOUCH = 'touch'\nconst POINTER_TYPE_PEN = 'pen'\nconst CLASS_NAME_POINTER_EVENT = 'pointer-event'\nconst SWIPE_THRESHOLD = 40\n\nconst Default = {\n endCallback: null,\n leftCallback: null,\n rightCallback: null\n}\n\nconst DefaultType = {\n endCallback: '(function|null)',\n leftCallback: '(function|null)',\n rightCallback: '(function|null)'\n}\n\n/**\n * Class definition\n */\n\nclass Swipe extends Config {\n constructor(element, config) {\n super()\n this._element = element\n\n if (!element || !Swipe.isSupported()) {\n return\n }\n\n this._config = this._getConfig(config)\n this._deltaX = 0\n this._supportPointerEvents = Boolean(window.PointerEvent)\n this._initEvents()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n dispose() {\n EventHandler.off(this._element, EVENT_KEY)\n }\n\n // Private\n _start(event) {\n if (!this._supportPointerEvents) {\n this._deltaX = event.touches[0].clientX\n\n return\n }\n\n if (this._eventIsPointerPenTouch(event)) {\n this._deltaX = event.clientX\n }\n }\n\n _end(event) {\n if (this._eventIsPointerPenTouch(event)) {\n this._deltaX = event.clientX - this._deltaX\n }\n\n this._handleSwipe()\n execute(this._config.endCallback)\n }\n\n _move(event) {\n this._deltaX = event.touches && event.touches.length > 1 ?\n 0 :\n event.touches[0].clientX - this._deltaX\n }\n\n _handleSwipe() {\n const absDeltaX = Math.abs(this._deltaX)\n\n if (absDeltaX <= SWIPE_THRESHOLD) {\n return\n }\n\n const direction = absDeltaX / this._deltaX\n\n this._deltaX = 0\n\n if (!direction) {\n return\n }\n\n execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback)\n }\n\n _initEvents() {\n if (this._supportPointerEvents) {\n EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event))\n EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event))\n\n this._element.classList.add(CLASS_NAME_POINTER_EVENT)\n } else {\n EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event))\n EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event))\n EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event))\n }\n }\n\n _eventIsPointerPenTouch(event) {\n return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)\n }\n\n // Static\n static isSupported() {\n return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0\n }\n}\n\nexport default Swipe\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): carousel.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElementFromSelector,\n getNextActiveElement,\n isRTL,\n isVisible,\n reflow,\n triggerTransitionEnd\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport Swipe from './util/swipe'\nimport BaseComponent from './base-component'\n\n/**\n * Constants\n */\n\nconst NAME = 'carousel'\nconst DATA_KEY = 'bs.carousel'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ARROW_LEFT_KEY = 'ArrowLeft'\nconst ARROW_RIGHT_KEY = 'ArrowRight'\nconst TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch\n\nconst ORDER_NEXT = 'next'\nconst ORDER_PREV = 'prev'\nconst DIRECTION_LEFT = 'left'\nconst DIRECTION_RIGHT = 'right'\n\nconst EVENT_SLIDE = `slide${EVENT_KEY}`\nconst EVENT_SLID = `slid${EVENT_KEY}`\nconst EVENT_KEYDOWN = `keydown${EVENT_KEY}`\nconst EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`\nconst EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`\nconst EVENT_DRAG_START = `dragstart${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_CAROUSEL = 'carousel'\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_SLIDE = 'slide'\nconst CLASS_NAME_END = 'carousel-item-end'\nconst CLASS_NAME_START = 'carousel-item-start'\nconst CLASS_NAME_NEXT = 'carousel-item-next'\nconst CLASS_NAME_PREV = 'carousel-item-prev'\n\nconst SELECTOR_ACTIVE = '.active'\nconst SELECTOR_ITEM = '.carousel-item'\nconst SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM\nconst SELECTOR_ITEM_IMG = '.carousel-item img'\nconst SELECTOR_INDICATORS = '.carousel-indicators'\nconst SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'\nconst SELECTOR_DATA_RIDE = '[data-bs-ride=\"carousel\"]'\n\nconst KEY_TO_DIRECTION = {\n [ARROW_LEFT_KEY]: DIRECTION_RIGHT,\n [ARROW_RIGHT_KEY]: DIRECTION_LEFT\n}\n\nconst Default = {\n interval: 5000,\n keyboard: true,\n pause: 'hover',\n ride: false,\n touch: true,\n wrap: true\n}\n\nconst DefaultType = {\n interval: '(number|boolean)', // TODO:v6 remove boolean support\n keyboard: 'boolean',\n pause: '(string|boolean)',\n ride: '(boolean|string)',\n touch: 'boolean',\n wrap: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Carousel extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._interval = null\n this._activeElement = null\n this._isSliding = false\n this.touchTimeout = null\n this._swipeHelper = null\n\n this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)\n this._addEventListeners()\n\n if (this._config.ride === CLASS_NAME_CAROUSEL) {\n this.cycle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n next() {\n this._slide(ORDER_NEXT)\n }\n\n nextWhenVisible() {\n // FIXME TODO use `document.visibilityState`\n // Don't call next when the page isn't visible\n // or the carousel or its parent isn't visible\n if (!document.hidden && isVisible(this._element)) {\n this.next()\n }\n }\n\n prev() {\n this._slide(ORDER_PREV)\n }\n\n pause() {\n if (this._isSliding) {\n triggerTransitionEnd(this._element)\n }\n\n this._clearInterval()\n }\n\n cycle() {\n this._clearInterval()\n this._updateInterval()\n\n this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)\n }\n\n _maybeEnableCycle() {\n if (!this._config.ride) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.cycle())\n return\n }\n\n this.cycle()\n }\n\n to(index) {\n const items = this._getItems()\n if (index > items.length - 1 || index < 0) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.to(index))\n return\n }\n\n const activeIndex = this._getItemIndex(this._getActive())\n if (activeIndex === index) {\n return\n }\n\n const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV\n\n this._slide(order, items[index])\n }\n\n dispose() {\n if (this._swipeHelper) {\n this._swipeHelper.dispose()\n }\n\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n config.defaultInterval = config.interval\n return config\n }\n\n _addEventListeners() {\n if (this._config.keyboard) {\n EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))\n }\n\n if (this._config.pause === 'hover') {\n EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())\n EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())\n }\n\n if (this._config.touch && Swipe.isSupported()) {\n this._addTouchEventListeners()\n }\n }\n\n _addTouchEventListeners() {\n for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {\n EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault())\n }\n\n const endCallBack = () => {\n if (this._config.pause !== 'hover') {\n return\n }\n\n // If it's a touch-enabled device, mouseenter/leave are fired as\n // part of the mouse compatibility events on first tap - the carousel\n // would stop cycling until user tapped out of it;\n // here, we listen for touchend, explicitly pause the carousel\n // (as if it's the second time we tap on it, mouseenter compat event\n // is NOT fired) and after a timeout (to allow for mouse compatibility\n // events to fire) we explicitly restart cycling\n\n this.pause()\n if (this.touchTimeout) {\n clearTimeout(this.touchTimeout)\n }\n\n this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)\n }\n\n const swipeConfig = {\n leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),\n rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),\n endCallback: endCallBack\n }\n\n this._swipeHelper = new Swipe(this._element, swipeConfig)\n }\n\n _keydown(event) {\n if (/input|textarea/i.test(event.target.tagName)) {\n return\n }\n\n const direction = KEY_TO_DIRECTION[event.key]\n if (direction) {\n event.preventDefault()\n this._slide(this._directionToOrder(direction))\n }\n }\n\n _getItemIndex(element) {\n return this._getItems().indexOf(element)\n }\n\n _setActiveIndicatorElement(index) {\n if (!this._indicatorsElement) {\n return\n }\n\n const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)\n\n activeIndicator.classList.remove(CLASS_NAME_ACTIVE)\n activeIndicator.removeAttribute('aria-current')\n\n const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to=\"${index}\"]`, this._indicatorsElement)\n\n if (newActiveIndicator) {\n newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)\n newActiveIndicator.setAttribute('aria-current', 'true')\n }\n }\n\n _updateInterval() {\n const element = this._activeElement || this._getActive()\n\n if (!element) {\n return\n }\n\n const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)\n\n this._config.interval = elementInterval || this._config.defaultInterval\n }\n\n _slide(order, element = null) {\n if (this._isSliding) {\n return\n }\n\n const activeElement = this._getActive()\n const isNext = order === ORDER_NEXT\n const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap)\n\n if (nextElement === activeElement) {\n return\n }\n\n const nextElementIndex = this._getItemIndex(nextElement)\n\n const triggerEvent = eventName => {\n return EventHandler.trigger(this._element, eventName, {\n relatedTarget: nextElement,\n direction: this._orderToDirection(order),\n from: this._getItemIndex(activeElement),\n to: nextElementIndex\n })\n }\n\n const slideEvent = triggerEvent(EVENT_SLIDE)\n\n if (slideEvent.defaultPrevented) {\n return\n }\n\n if (!activeElement || !nextElement) {\n // Some weirdness is happening, so we bail\n // todo: change tests that use empty divs to avoid this check\n return\n }\n\n const isCycling = Boolean(this._interval)\n this.pause()\n\n this._isSliding = true\n\n this._setActiveIndicatorElement(nextElementIndex)\n this._activeElement = nextElement\n\n const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END\n const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV\n\n nextElement.classList.add(orderClassName)\n\n reflow(nextElement)\n\n activeElement.classList.add(directionalClassName)\n nextElement.classList.add(directionalClassName)\n\n const completeCallBack = () => {\n nextElement.classList.remove(directionalClassName, orderClassName)\n nextElement.classList.add(CLASS_NAME_ACTIVE)\n\n activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)\n\n this._isSliding = false\n\n triggerEvent(EVENT_SLID)\n }\n\n this._queueCallback(completeCallBack, activeElement, this._isAnimated())\n\n if (isCycling) {\n this.cycle()\n }\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_SLIDE)\n }\n\n _getActive() {\n return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n }\n\n _getItems() {\n return SelectorEngine.find(SELECTOR_ITEM, this._element)\n }\n\n _clearInterval() {\n if (this._interval) {\n clearInterval(this._interval)\n this._interval = null\n }\n }\n\n _directionToOrder(direction) {\n if (isRTL()) {\n return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT\n }\n\n return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV\n }\n\n _orderToDirection(order) {\n if (isRTL()) {\n return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT\n }\n\n return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Carousel.getOrCreateInstance(this, config)\n\n if (typeof config === 'number') {\n data.to(config)\n return\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {\n const target = getElementFromSelector(this)\n\n if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {\n return\n }\n\n event.preventDefault()\n\n const carousel = Carousel.getOrCreateInstance(target)\n const slideIndex = this.getAttribute('data-bs-slide-to')\n\n if (slideIndex) {\n carousel.to(slideIndex)\n carousel._maybeEnableCycle()\n return\n }\n\n if (Manipulator.getDataAttribute(this, 'slide') === 'next') {\n carousel.next()\n carousel._maybeEnableCycle()\n return\n }\n\n carousel.prev()\n carousel._maybeEnableCycle()\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)\n\n for (const carousel of carousels) {\n Carousel.getOrCreateInstance(carousel)\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Carousel)\n\nexport default Carousel\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElement,\n getElementFromSelector,\n getSelectorFromElement,\n reflow\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * Constants\n */\n\nconst NAME = 'collapse'\nconst DATA_KEY = 'bs.collapse'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_COLLAPSE = 'collapse'\nconst CLASS_NAME_COLLAPSING = 'collapsing'\nconst CLASS_NAME_COLLAPSED = 'collapsed'\nconst CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`\nconst CLASS_NAME_HORIZONTAL = 'collapse-horizontal'\n\nconst WIDTH = 'width'\nconst HEIGHT = 'height'\n\nconst SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"collapse\"]'\n\nconst Default = {\n parent: null,\n toggle: true\n}\n\nconst DefaultType = {\n parent: '(null|element)',\n toggle: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Collapse extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isTransitioning = false\n this._triggerArray = []\n\n const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)\n\n for (const elem of toggleList) {\n const selector = getSelectorFromElement(elem)\n const filterElement = SelectorEngine.find(selector)\n .filter(foundElement => foundElement === this._element)\n\n if (selector !== null && filterElement.length) {\n this._triggerArray.push(elem)\n }\n }\n\n this._initializeChildren()\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._triggerArray, this._isShown())\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n if (this._isShown()) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning || this._isShown()) {\n return\n }\n\n let activeChildren = []\n\n // find active children\n if (this._config.parent) {\n activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES)\n .filter(element => element !== this._element)\n .map(element => Collapse.getOrCreateInstance(element, { toggle: false }))\n }\n\n if (activeChildren.length && activeChildren[0]._isTransitioning) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_SHOW)\n if (startEvent.defaultPrevented) {\n return\n }\n\n for (const activeInstance of activeChildren) {\n activeInstance.hide()\n }\n\n const dimension = this._getDimension()\n\n this._element.classList.remove(CLASS_NAME_COLLAPSE)\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n\n this._element.style[dimension] = 0\n\n this._addAriaAndCollapsedClass(this._triggerArray, true)\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n this._element.style[dimension] = ''\n\n EventHandler.trigger(this._element, EVENT_SHOWN)\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n this._queueCallback(complete, this._element, true)\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning || !this._isShown()) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n if (startEvent.defaultPrevented) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n for (const trigger of this._triggerArray) {\n const element = getElementFromSelector(trigger)\n\n if (element && !this._isShown(element)) {\n this._addAriaAndCollapsedClass([trigger], false)\n }\n }\n\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE)\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n this._queueCallback(complete, this._element, true)\n }\n\n _isShown(element = this._element) {\n return element.classList.contains(CLASS_NAME_SHOW)\n }\n\n // Private\n _configAfterMerge(config) {\n config.toggle = Boolean(config.toggle) // Coerce string values\n config.parent = getElement(config.parent)\n return config\n }\n\n _getDimension() {\n return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT\n }\n\n _initializeChildren() {\n if (!this._config.parent) {\n return\n }\n\n const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE)\n\n for (const element of children) {\n const selected = getElementFromSelector(element)\n\n if (selected) {\n this._addAriaAndCollapsedClass([element], this._isShown(selected))\n }\n }\n }\n\n _getFirstLevelChildren(selector) {\n const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent)\n // remove children if greater depth\n return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element))\n }\n\n _addAriaAndCollapsedClass(triggerArray, isOpen) {\n if (!triggerArray.length) {\n return\n }\n\n for (const element of triggerArray) {\n element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen)\n element.setAttribute('aria-expanded', isOpen)\n }\n }\n\n // Static\n static jQueryInterface(config) {\n const _config = {}\n if (typeof config === 'string' && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n return this.each(function () {\n const data = Collapse.getOrCreateInstance(this, _config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n // preventDefault only for elements (which change the URL) not inside the collapsible element\n if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {\n event.preventDefault()\n }\n\n const selector = getSelectorFromElement(this)\n const selectorElements = SelectorEngine.find(selector)\n\n for (const element of selectorElements) {\n Collapse.getOrCreateInstance(element, { toggle: false }).toggle()\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Collapse)\n\nexport default Collapse\n","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): dropdown.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\nimport {\n defineJQueryPlugin,\n getElement,\n getNextActiveElement,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop\n} from './util/index'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * Constants\n */\n\nconst NAME = 'dropdown'\nconst DATA_KEY = 'bs.dropdown'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ESCAPE_KEY = 'Escape'\nconst TAB_KEY = 'Tab'\nconst ARROW_UP_KEY = 'ArrowUp'\nconst ARROW_DOWN_KEY = 'ArrowDown'\nconst RIGHT_MOUSE_BUTTON = 2 // MouseEvent.button value for the secondary button, usually the right button\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_DROPUP = 'dropup'\nconst CLASS_NAME_DROPEND = 'dropend'\nconst CLASS_NAME_DROPSTART = 'dropstart'\nconst CLASS_NAME_DROPUP_CENTER = 'dropup-center'\nconst CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"dropdown\"]:not(.disabled):not(:disabled)'\nconst SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`\nconst SELECTOR_MENU = '.dropdown-menu'\nconst SELECTOR_NAVBAR = '.navbar'\nconst SELECTOR_NAVBAR_NAV = '.navbar-nav'\nconst SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'\n\nconst PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'\nconst PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'\nconst PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'\nconst PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'\nconst PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'\nconst PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'\nconst PLACEMENT_TOPCENTER = 'top'\nconst PLACEMENT_BOTTOMCENTER = 'bottom'\n\nconst Default = {\n autoClose: true,\n boundary: 'clippingParents',\n display: 'dynamic',\n offset: [0, 2],\n popperConfig: null,\n reference: 'toggle'\n}\n\nconst DefaultType = {\n autoClose: '(boolean|string)',\n boundary: '(string|element)',\n display: 'string',\n offset: '(array|string|function)',\n popperConfig: '(null|object|function)',\n reference: '(string|element|object)'\n}\n\n/**\n * Class definition\n */\n\nclass Dropdown extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._popper = null\n this._parent = this._element.parentNode // dropdown wrapper\n // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/\n this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||\n SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||\n SelectorEngine.findOne(SELECTOR_MENU, this._parent)\n this._inNavbar = this._detectNavbar()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n return this._isShown() ? this.hide() : this.show()\n }\n\n show() {\n if (isDisabled(this._element) || this._isShown()) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget)\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._createPopper()\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.on(element, 'mouseover', noop)\n }\n }\n\n this._element.focus()\n this._element.setAttribute('aria-expanded', true)\n\n this._menu.classList.add(CLASS_NAME_SHOW)\n this._element.classList.add(CLASS_NAME_SHOW)\n EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)\n }\n\n hide() {\n if (isDisabled(this._element) || !this._isShown()) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n this._completeHide(relatedTarget)\n }\n\n dispose() {\n if (this._popper) {\n this._popper.destroy()\n }\n\n super.dispose()\n }\n\n update() {\n this._inNavbar = this._detectNavbar()\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Private\n _completeHide(relatedTarget) {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.off(element, 'mouseover', noop)\n }\n }\n\n if (this._popper) {\n this._popper.destroy()\n }\n\n this._menu.classList.remove(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOW)\n this._element.setAttribute('aria-expanded', 'false')\n Manipulator.removeDataAttribute(this._menu, 'popper')\n EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget)\n }\n\n _getConfig(config) {\n config = super._getConfig(config)\n\n if (typeof config.reference === 'object' && !isElement(config.reference) &&\n typeof config.reference.getBoundingClientRect !== 'function'\n ) {\n // Popper virtual elements require a getBoundingClientRect method\n throw new TypeError(`${NAME.toUpperCase()}: Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method.`)\n }\n\n return config\n }\n\n _createPopper() {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s dropdowns require Popper (https://popper.js.org)')\n }\n\n let referenceElement = this._element\n\n if (this._config.reference === 'parent') {\n referenceElement = this._parent\n } else if (isElement(this._config.reference)) {\n referenceElement = getElement(this._config.reference)\n } else if (typeof this._config.reference === 'object') {\n referenceElement = this._config.reference\n }\n\n const popperConfig = this._getPopperConfig()\n this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)\n }\n\n _isShown() {\n return this._menu.classList.contains(CLASS_NAME_SHOW)\n }\n\n _getPlacement() {\n const parentDropdown = this._parent\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {\n return PLACEMENT_RIGHT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {\n return PLACEMENT_LEFT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {\n return PLACEMENT_TOPCENTER\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {\n return PLACEMENT_BOTTOMCENTER\n }\n\n // We need to trim the value because custom properties can also include spaces\n const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {\n return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP\n }\n\n return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM\n }\n\n _detectNavbar() {\n return this._element.closest(SELECTOR_NAVBAR) !== null\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(value => Number.parseInt(value, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _getPopperConfig() {\n const defaultBsPopperConfig = {\n placement: this._getPlacement(),\n modifiers: [{\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n }]\n }\n\n // Disable Popper if we have a static display or Dropdown is in Navbar\n if (this._inNavbar || this._config.display === 'static') {\n Manipulator.setDataAttribute(this._menu, 'popper', 'static') // todo:v6 remove\n defaultBsPopperConfig.modifiers = [{\n name: 'applyStyles',\n enabled: false\n }]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)\n }\n }\n\n _selectMenuItem({ key, target }) {\n const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element))\n\n if (!items.length) {\n return\n }\n\n // if target isn't included in items (e.g. when expanding the dropdown)\n // allow cycling to get the last item in case key equals ARROW_UP_KEY\n getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Dropdown.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n\n static clearMenus(event) {\n if (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY)) {\n return\n }\n\n const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN)\n\n for (const toggle of openToggles) {\n const context = Dropdown.getInstance(toggle)\n if (!context || context._config.autoClose === false) {\n continue\n }\n\n const composedPath = event.composedPath()\n const isMenuTarget = composedPath.includes(context._menu)\n if (\n composedPath.includes(context._element) ||\n (context._config.autoClose === 'inside' && !isMenuTarget) ||\n (context._config.autoClose === 'outside' && isMenuTarget)\n ) {\n continue\n }\n\n // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu\n if (context._menu.contains(event.target) && ((event.type === 'keyup' && event.key === TAB_KEY) || /input|select|option|textarea|form/i.test(event.target.tagName))) {\n continue\n }\n\n const relatedTarget = { relatedTarget: context._element }\n\n if (event.type === 'click') {\n relatedTarget.clickEvent = event\n }\n\n context._completeHide(relatedTarget)\n }\n }\n\n static dataApiKeydownHandler(event) {\n // If not an UP | DOWN | ESCAPE key => not a dropdown command\n // If input/textarea && if key is other than ESCAPE => not a dropdown command\n\n const isInput = /input|textarea/i.test(event.target.tagName)\n const isEscapeEvent = event.key === ESCAPE_KEY\n const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)\n\n if (!isUpOrDownEvent && !isEscapeEvent) {\n return\n }\n\n if (isInput && !isEscapeEvent) {\n return\n }\n\n event.preventDefault()\n\n // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/\n const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?\n this :\n (SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||\n SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] ||\n SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode))\n\n const instance = Dropdown.getOrCreateInstance(getToggleButton)\n\n if (isUpOrDownEvent) {\n event.stopPropagation()\n instance.show()\n instance._selectMenuItem(event)\n return\n }\n\n if (instance._isShown()) { // else is escape and we check if it is shown\n event.stopPropagation()\n instance.hide()\n getToggleButton.focus()\n }\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n event.preventDefault()\n Dropdown.getOrCreateInstance(this).toggle()\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Dropdown)\n\nexport default Dropdown\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/scrollBar.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport SelectorEngine from '../dom/selector-engine'\nimport Manipulator from '../dom/manipulator'\nimport { isElement } from './index'\n\n/**\n * Constants\n */\n\nconst SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'\nconst SELECTOR_STICKY_CONTENT = '.sticky-top'\nconst PROPERTY_PADDING = 'padding-right'\nconst PROPERTY_MARGIN = 'margin-right'\n\n/**\n * Class definition\n */\n\nclass ScrollBarHelper {\n constructor() {\n this._element = document.body\n }\n\n // Public\n getWidth() {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = document.documentElement.clientWidth\n return Math.abs(window.innerWidth - documentWidth)\n }\n\n hide() {\n const width = this.getWidth()\n this._disableOverFlow()\n // give padding to element to balance the hidden scrollbar width\n this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width)\n // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth\n this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width)\n this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width)\n }\n\n reset() {\n this._resetElementAttributes(this._element, 'overflow')\n this._resetElementAttributes(this._element, PROPERTY_PADDING)\n this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING)\n this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN)\n }\n\n isOverflowing() {\n return this.getWidth() > 0\n }\n\n // Private\n _disableOverFlow() {\n this._saveInitialAttribute(this._element, 'overflow')\n this._element.style.overflow = 'hidden'\n }\n\n _setElementAttributes(selector, styleProperty, callback) {\n const scrollbarWidth = this.getWidth()\n const manipulationCallBack = element => {\n if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {\n return\n }\n\n this._saveInitialAttribute(element, styleProperty)\n const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty)\n element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`)\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _saveInitialAttribute(element, styleProperty) {\n const actualValue = element.style.getPropertyValue(styleProperty)\n if (actualValue) {\n Manipulator.setDataAttribute(element, styleProperty, actualValue)\n }\n }\n\n _resetElementAttributes(selector, styleProperty) {\n const manipulationCallBack = element => {\n const value = Manipulator.getDataAttribute(element, styleProperty)\n // We only want to remove the property if the value is `null`; the value can also be zero\n if (value === null) {\n element.style.removeProperty(styleProperty)\n return\n }\n\n Manipulator.removeDataAttribute(element, styleProperty)\n element.style.setProperty(styleProperty, value)\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _applyManipulationCallback(selector, callBack) {\n if (isElement(selector)) {\n callBack(selector)\n return\n }\n\n for (const sel of SelectorEngine.find(selector, this._element)) {\n callBack(sel)\n }\n }\n}\n\nexport default ScrollBarHelper\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/backdrop.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler'\nimport { execute, executeAfterTransition, getElement, reflow } from './index'\nimport Config from './config'\n\n/**\n * Constants\n */\n\nconst NAME = 'backdrop'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`\n\nconst Default = {\n className: 'modal-backdrop',\n clickCallback: null,\n isAnimated: false,\n isVisible: true, // if false, we use the backdrop helper without adding any element to the dom\n rootElement: 'body' // give the choice to place backdrop under different elements\n}\n\nconst DefaultType = {\n className: 'string',\n clickCallback: '(function|null)',\n isAnimated: 'boolean',\n isVisible: 'boolean',\n rootElement: '(element|string)'\n}\n\n/**\n * Class definition\n */\n\nclass Backdrop extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isAppended = false\n this._element = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n show(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._append()\n\n const element = this._getElement()\n if (this._config.isAnimated) {\n reflow(element)\n }\n\n element.classList.add(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n execute(callback)\n })\n }\n\n hide(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._getElement().classList.remove(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n this.dispose()\n execute(callback)\n })\n }\n\n dispose() {\n if (!this._isAppended) {\n return\n }\n\n EventHandler.off(this._element, EVENT_MOUSEDOWN)\n\n this._element.remove()\n this._isAppended = false\n }\n\n // Private\n _getElement() {\n if (!this._element) {\n const backdrop = document.createElement('div')\n backdrop.className = this._config.className\n if (this._config.isAnimated) {\n backdrop.classList.add(CLASS_NAME_FADE)\n }\n\n this._element = backdrop\n }\n\n return this._element\n }\n\n _configAfterMerge(config) {\n // use getElement() with the default \"body\" to get a fresh Element on each instantiation\n config.rootElement = getElement(config.rootElement)\n return config\n }\n\n _append() {\n if (this._isAppended) {\n return\n }\n\n const element = this._getElement()\n this._config.rootElement.append(element)\n\n EventHandler.on(element, EVENT_MOUSEDOWN, () => {\n execute(this._config.clickCallback)\n })\n\n this._isAppended = true\n }\n\n _emulateAnimation(callback) {\n executeAfterTransition(callback, this._getElement(), this._config.isAnimated)\n }\n}\n\nexport default Backdrop\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/focustrap.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler'\nimport SelectorEngine from '../dom/selector-engine'\nimport Config from './config'\n\n/**\n * Constants\n */\n\nconst NAME = 'focustrap'\nconst DATA_KEY = 'bs.focustrap'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst EVENT_FOCUSIN = `focusin${EVENT_KEY}`\nconst EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`\n\nconst TAB_KEY = 'Tab'\nconst TAB_NAV_FORWARD = 'forward'\nconst TAB_NAV_BACKWARD = 'backward'\n\nconst Default = {\n autofocus: true,\n trapElement: null // The element to trap focus inside of\n}\n\nconst DefaultType = {\n autofocus: 'boolean',\n trapElement: 'element'\n}\n\n/**\n * Class definition\n */\n\nclass FocusTrap extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isActive = false\n this._lastTabNavDirection = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n activate() {\n if (this._isActive) {\n return\n }\n\n if (this._config.autofocus) {\n this._config.trapElement.focus()\n }\n\n EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop\n EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))\n EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))\n\n this._isActive = true\n }\n\n deactivate() {\n if (!this._isActive) {\n return\n }\n\n this._isActive = false\n EventHandler.off(document, EVENT_KEY)\n }\n\n // Private\n _handleFocusin(event) {\n const { trapElement } = this._config\n\n if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {\n return\n }\n\n const elements = SelectorEngine.focusableChildren(trapElement)\n\n if (elements.length === 0) {\n trapElement.focus()\n } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {\n elements[elements.length - 1].focus()\n } else {\n elements[0].focus()\n }\n }\n\n _handleKeydown(event) {\n if (event.key !== TAB_KEY) {\n return\n }\n\n this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD\n }\n}\n\nexport default FocusTrap\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): modal.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin, getElementFromSelector, isRTL, isVisible, reflow } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport SelectorEngine from './dom/selector-engine'\nimport ScrollBarHelper from './util/scrollbar'\nimport BaseComponent from './base-component'\nimport Backdrop from './util/backdrop'\nimport FocusTrap from './util/focustrap'\nimport { enableDismissTrigger } from './util/component-functions'\n\n/**\n * Constants\n */\n\nconst NAME = 'modal'\nconst DATA_KEY = 'bs.modal'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst ESCAPE_KEY = 'Escape'\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`\nconst EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_OPEN = 'modal-open'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_STATIC = 'modal-static'\n\nconst OPEN_SELECTOR = '.modal.show'\nconst SELECTOR_DIALOG = '.modal-dialog'\nconst SELECTOR_MODAL_BODY = '.modal-body'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"modal\"]'\n\nconst Default = {\n backdrop: true,\n focus: true,\n keyboard: true\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n focus: 'boolean',\n keyboard: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Modal extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element)\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._isShown = false\n this._isTransitioning = false\n this._scrollBar = new ScrollBarHelper()\n\n this._addEventListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown || this._isTransitioning) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {\n relatedTarget\n })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._isTransitioning = true\n\n this._scrollBar.hide()\n\n document.body.classList.add(CLASS_NAME_OPEN)\n\n this._adjustDialog()\n\n this._backdrop.show(() => this._showElement(relatedTarget))\n }\n\n hide() {\n if (!this._isShown || this._isTransitioning) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._isShown = false\n this._isTransitioning = true\n this._focustrap.deactivate()\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n this._queueCallback(() => this._hideModal(), this._element, this._isAnimated())\n }\n\n dispose() {\n for (const htmlElement of [window, this._dialog]) {\n EventHandler.off(htmlElement, EVENT_KEY)\n }\n\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n handleUpdate() {\n this._adjustDialog()\n }\n\n // Private\n _initializeBackDrop() {\n return new Backdrop({\n isVisible: Boolean(this._config.backdrop), // 'static' option will be translated to true, and booleans will keep their value,\n isAnimated: this._isAnimated()\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _showElement(relatedTarget) {\n // try to append dynamic modal\n if (!document.body.contains(this._element)) {\n document.body.append(this._element)\n }\n\n this._element.style.display = 'block'\n this._element.removeAttribute('aria-hidden')\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.scrollTop = 0\n\n const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog)\n if (modalBody) {\n modalBody.scrollTop = 0\n }\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const transitionComplete = () => {\n if (this._config.focus) {\n this._focustrap.activate()\n }\n\n this._isTransitioning = false\n EventHandler.trigger(this._element, EVENT_SHOWN, {\n relatedTarget\n })\n }\n\n this._queueCallback(transitionComplete, this._dialog, this._isAnimated())\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (this._config.keyboard) {\n event.preventDefault()\n this.hide()\n return\n }\n\n this._triggerBackdropTransition()\n })\n\n EventHandler.on(window, EVENT_RESIZE, () => {\n if (this._isShown && !this._isTransitioning) {\n this._adjustDialog()\n }\n })\n\n EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {\n // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks\n EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {\n if (this._element !== event.target || this._element !== event2.target) {\n return\n }\n\n if (this._config.backdrop === 'static') {\n this._triggerBackdropTransition()\n return\n }\n\n if (this._config.backdrop) {\n this.hide()\n }\n })\n })\n }\n\n _hideModal() {\n this._element.style.display = 'none'\n this._element.setAttribute('aria-hidden', true)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n this._isTransitioning = false\n\n this._backdrop.hide(() => {\n document.body.classList.remove(CLASS_NAME_OPEN)\n this._resetAdjustments()\n this._scrollBar.reset()\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n })\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_FADE)\n }\n\n _triggerBackdropTransition() {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const initialOverflowY = this._element.style.overflowY\n // return if the following background transition hasn't yet completed\n if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {\n return\n }\n\n if (!isModalOverflowing) {\n this._element.style.overflowY = 'hidden'\n }\n\n this._element.classList.add(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n this._element.classList.remove(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n this._element.style.overflowY = initialOverflowY\n }, this._dialog)\n }, this._dialog)\n\n this._element.focus()\n }\n\n /**\n * The following methods are used to handle overflowing modals\n */\n\n _adjustDialog() {\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const scrollbarWidth = this._scrollBar.getWidth()\n const isBodyOverflowing = scrollbarWidth > 0\n\n if (isBodyOverflowing && !isModalOverflowing) {\n const property = isRTL() ? 'paddingLeft' : 'paddingRight'\n this._element.style[property] = `${scrollbarWidth}px`\n }\n\n if (!isBodyOverflowing && isModalOverflowing) {\n const property = isRTL() ? 'paddingRight' : 'paddingLeft'\n this._element.style[property] = `${scrollbarWidth}px`\n }\n }\n\n _resetAdjustments() {\n this._element.style.paddingLeft = ''\n this._element.style.paddingRight = ''\n }\n\n // Static\n static jQueryInterface(config, relatedTarget) {\n return this.each(function () {\n const data = Modal.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](relatedTarget)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n EventHandler.one(target, EVENT_SHOW, showEvent => {\n if (showEvent.defaultPrevented) {\n // only register focus restorer if modal will actually get shown\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n if (isVisible(this)) {\n this.focus()\n }\n })\n })\n\n // avoid conflict when clicking modal toggler while another one is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen) {\n Modal.getInstance(alreadyOpen).hide()\n }\n\n const data = Modal.getOrCreateInstance(target)\n\n data.toggle(this)\n})\n\nenableDismissTrigger(Modal)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Modal)\n\nexport default Modal\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): offcanvas.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n defineJQueryPlugin,\n getElementFromSelector,\n isDisabled,\n isVisible\n} from './util/index'\nimport ScrollBarHelper from './util/scrollbar'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\nimport SelectorEngine from './dom/selector-engine'\nimport Backdrop from './util/backdrop'\nimport FocusTrap from './util/focustrap'\nimport { enableDismissTrigger } from './util/component-functions'\n\n/**\n * Constants\n */\n\nconst NAME = 'offcanvas'\nconst DATA_KEY = 'bs.offcanvas'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst ESCAPE_KEY = 'Escape'\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_SHOWING = 'showing'\nconst CLASS_NAME_HIDING = 'hiding'\nconst CLASS_NAME_BACKDROP = 'offcanvas-backdrop'\nconst OPEN_SELECTOR = '.offcanvas.show'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"offcanvas\"]'\n\nconst Default = {\n backdrop: true,\n keyboard: true,\n scroll: false\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n keyboard: 'boolean',\n scroll: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Offcanvas extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isShown = false\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._addEventListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._backdrop.show()\n\n if (!this._config.scroll) {\n new ScrollBarHelper().hide()\n }\n\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.classList.add(CLASS_NAME_SHOWING)\n\n const completeCallBack = () => {\n if (!this._config.scroll || this._config.backdrop) {\n this._focustrap.activate()\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOWING)\n EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget })\n }\n\n this._queueCallback(completeCallBack, this._element, true)\n }\n\n hide() {\n if (!this._isShown) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._focustrap.deactivate()\n this._element.blur()\n this._isShown = false\n this._element.classList.add(CLASS_NAME_HIDING)\n this._backdrop.hide()\n\n const completeCallback = () => {\n this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_HIDING)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n\n if (!this._config.scroll) {\n new ScrollBarHelper().reset()\n }\n\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._queueCallback(completeCallback, this._element, true)\n }\n\n dispose() {\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n // Private\n _initializeBackDrop() {\n const clickCallback = () => {\n if (this._config.backdrop === 'static') {\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n return\n }\n\n this.hide()\n }\n\n // 'static' option will be translated to true, and booleans will keep their value\n const isVisible = Boolean(this._config.backdrop)\n\n return new Backdrop({\n className: CLASS_NAME_BACKDROP,\n isVisible,\n isAnimated: true,\n rootElement: this._element.parentNode,\n clickCallback: isVisible ? clickCallback : null\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (!this._config.keyboard) {\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n return\n }\n\n this.hide()\n })\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Offcanvas.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n // focus on trigger when it is closed\n if (isVisible(this)) {\n this.focus()\n }\n })\n\n // avoid conflict when clicking a toggler of an offcanvas, while another is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen && alreadyOpen !== target) {\n Offcanvas.getInstance(alreadyOpen).hide()\n }\n\n const data = Offcanvas.getOrCreateInstance(target)\n data.toggle(this)\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {\n Offcanvas.getOrCreateInstance(selector).show()\n }\n})\n\nEventHandler.on(window, EVENT_RESIZE, () => {\n for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {\n if (getComputedStyle(element).position !== 'fixed') {\n Offcanvas.getOrCreateInstance(element).hide()\n }\n }\n})\n\nenableDismissTrigger(Offcanvas)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Offcanvas)\n\nexport default Offcanvas\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/sanitizer.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst uriAttributes = new Set([\n 'background',\n 'cite',\n 'href',\n 'itemtype',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href'\n])\n\nconst ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i\n\n/**\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\n *\n * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts\n */\nconst SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i\n\n/**\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\n *\n * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts\n */\nconst DATA_URL_PATTERN = /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[\\d+/a-z]+=*$/i\n\nconst allowedAttribute = (attribute, allowedAttributeList) => {\n const attributeName = attribute.nodeName.toLowerCase()\n\n if (allowedAttributeList.includes(attributeName)) {\n if (uriAttributes.has(attributeName)) {\n return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue))\n }\n\n return true\n }\n\n // Check if a regular expression validates the attribute.\n return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)\n .some(regex => regex.test(attributeName))\n}\n\nexport const DefaultAllowlist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n}\n\nexport function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {\n if (!unsafeHtml.length) {\n return unsafeHtml\n }\n\n if (sanitizeFunction && typeof sanitizeFunction === 'function') {\n return sanitizeFunction(unsafeHtml)\n }\n\n const domParser = new window.DOMParser()\n const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')\n const elements = [].concat(...createdDocument.body.querySelectorAll('*'))\n\n for (const element of elements) {\n const elementName = element.nodeName.toLowerCase()\n\n if (!Object.keys(allowList).includes(elementName)) {\n element.remove()\n\n continue\n }\n\n const attributeList = [].concat(...element.attributes)\n const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])\n\n for (const attribute of attributeList) {\n if (!allowedAttribute(attribute, allowedAttributes)) {\n element.removeAttribute(attribute.nodeName)\n }\n }\n }\n\n return createdDocument.body.innerHTML\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): util/template-factory.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { DefaultAllowlist, sanitizeHtml } from './sanitizer'\nimport { getElement, isElement } from '../util/index'\nimport SelectorEngine from '../dom/selector-engine'\nimport Config from './config'\n\n/**\n * Constants\n */\n\nconst NAME = 'TemplateFactory'\n\nconst Default = {\n allowList: DefaultAllowlist,\n content: {}, // { selector : text , selector2 : text2 , }\n extraClass: '',\n html: false,\n sanitize: true,\n sanitizeFn: null,\n template: '
'\n}\n\nconst DefaultType = {\n allowList: 'object',\n content: 'object',\n extraClass: '(string|function)',\n html: 'boolean',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n template: 'string'\n}\n\nconst DefaultContentType = {\n entry: '(string|element|function|null)',\n selector: '(string|element)'\n}\n\n/**\n * Class definition\n */\n\nclass TemplateFactory extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n getContent() {\n return Object.values(this._config.content)\n .map(config => this._resolvePossibleFunction(config))\n .filter(Boolean)\n }\n\n hasContent() {\n return this.getContent().length > 0\n }\n\n changeContent(content) {\n this._checkContent(content)\n this._config.content = { ...this._config.content, ...content }\n return this\n }\n\n toHtml() {\n const templateWrapper = document.createElement('div')\n templateWrapper.innerHTML = this._maybeSanitize(this._config.template)\n\n for (const [selector, text] of Object.entries(this._config.content)) {\n this._setContent(templateWrapper, text, selector)\n }\n\n const template = templateWrapper.children[0]\n const extraClass = this._resolvePossibleFunction(this._config.extraClass)\n\n if (extraClass) {\n template.classList.add(...extraClass.split(' '))\n }\n\n return template\n }\n\n // Private\n _typeCheckConfig(config) {\n super._typeCheckConfig(config)\n this._checkContent(config.content)\n }\n\n _checkContent(arg) {\n for (const [selector, content] of Object.entries(arg)) {\n super._typeCheckConfig({ selector, entry: content }, DefaultContentType)\n }\n }\n\n _setContent(template, content, selector) {\n const templateElement = SelectorEngine.findOne(selector, template)\n\n if (!templateElement) {\n return\n }\n\n content = this._resolvePossibleFunction(content)\n\n if (!content) {\n templateElement.remove()\n return\n }\n\n if (isElement(content)) {\n this._putElementInTemplate(getElement(content), templateElement)\n return\n }\n\n if (this._config.html) {\n templateElement.innerHTML = this._maybeSanitize(content)\n return\n }\n\n templateElement.textContent = content\n }\n\n _maybeSanitize(arg) {\n return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg\n }\n\n _resolvePossibleFunction(arg) {\n return typeof arg === 'function' ? arg(this) : arg\n }\n\n _putElementInTemplate(element, templateElement) {\n if (this._config.html) {\n templateElement.innerHTML = ''\n templateElement.append(element)\n return\n }\n\n templateElement.textContent = element.textContent\n }\n}\n\nexport default TemplateFactory\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): tooltip.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\nimport { defineJQueryPlugin, findShadowRoot, getElement, getUID, isRTL, noop } from './util/index'\nimport { DefaultAllowlist } from './util/sanitizer'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport BaseComponent from './base-component'\nimport TemplateFactory from './util/template-factory'\n\n/**\n * Constants\n */\n\nconst NAME = 'tooltip'\nconst DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_MODAL = 'modal'\nconst CLASS_NAME_SHOW = 'show'\n\nconst SELECTOR_TOOLTIP_INNER = '.tooltip-inner'\nconst SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`\n\nconst EVENT_MODAL_HIDE = 'hide.bs.modal'\n\nconst TRIGGER_HOVER = 'hover'\nconst TRIGGER_FOCUS = 'focus'\nconst TRIGGER_CLICK = 'click'\nconst TRIGGER_MANUAL = 'manual'\n\nconst EVENT_HIDE = 'hide'\nconst EVENT_HIDDEN = 'hidden'\nconst EVENT_SHOW = 'show'\nconst EVENT_SHOWN = 'shown'\nconst EVENT_INSERTED = 'inserted'\nconst EVENT_CLICK = 'click'\nconst EVENT_FOCUSIN = 'focusin'\nconst EVENT_FOCUSOUT = 'focusout'\nconst EVENT_MOUSEENTER = 'mouseenter'\nconst EVENT_MOUSELEAVE = 'mouseleave'\n\nconst AttachmentMap = {\n AUTO: 'auto',\n TOP: 'top',\n RIGHT: isRTL() ? 'left' : 'right',\n BOTTOM: 'bottom',\n LEFT: isRTL() ? 'right' : 'left'\n}\n\nconst Default = {\n allowList: DefaultAllowlist,\n animation: true,\n boundary: 'clippingParents',\n container: false,\n customClass: '',\n delay: 0,\n fallbackPlacements: ['top', 'right', 'bottom', 'left'],\n html: false,\n offset: [0, 0],\n placement: 'top',\n popperConfig: null,\n sanitize: true,\n sanitizeFn: null,\n selector: false,\n template: '
' +\n '
' +\n '
' +\n '
',\n title: '',\n trigger: 'hover focus'\n}\n\nconst DefaultType = {\n allowList: 'object',\n animation: 'boolean',\n boundary: '(string|element)',\n container: '(string|element|boolean)',\n customClass: '(string|function)',\n delay: '(number|object)',\n fallbackPlacements: 'array',\n html: 'boolean',\n offset: '(array|string|function)',\n placement: '(string|function)',\n popperConfig: '(null|object|function)',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n selector: '(string|boolean)',\n template: 'string',\n title: '(string|element|function)',\n trigger: 'string'\n}\n\n/**\n * Class definition\n */\n\nclass Tooltip extends BaseComponent {\n constructor(element, config) {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s tooltips require Popper (https://popper.js.org)')\n }\n\n super(element, config)\n\n // Private\n this._isEnabled = true\n this._timeout = 0\n this._isHovered = null\n this._activeTrigger = {}\n this._popper = null\n this._templateFactory = null\n this._newContent = null\n\n // Protected\n this.tip = null\n\n this._setListeners()\n\n if (!this._config.selector) {\n this._fixTitle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle() {\n if (!this._isEnabled) {\n return\n }\n\n this._activeTrigger.click = !this._activeTrigger.click\n if (this._isShown()) {\n this._leave()\n return\n }\n\n this._enter()\n }\n\n dispose() {\n clearTimeout(this._timeout)\n\n EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n\n if (this.tip) {\n this.tip.remove()\n }\n\n if (this._element.getAttribute('data-bs-original-title')) {\n this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'))\n }\n\n this._disposePopper()\n super.dispose()\n }\n\n show() {\n if (this._element.style.display === 'none') {\n throw new Error('Please use show on visible elements')\n }\n\n if (!(this._isWithContent() && this._isEnabled)) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW))\n const shadowRoot = findShadowRoot(this._element)\n const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element)\n\n if (showEvent.defaultPrevented || !isInTheDom) {\n return\n }\n\n // todo v6 remove this OR make it optional\n if (this.tip) {\n this.tip.remove()\n this.tip = null\n }\n\n const tip = this._getTipElement()\n\n this._element.setAttribute('aria-describedby', tip.getAttribute('id'))\n\n const { container } = this._config\n\n if (!this._element.ownerDocument.documentElement.contains(this.tip)) {\n container.append(tip)\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED))\n }\n\n if (this._popper) {\n this._popper.update()\n } else {\n this._popper = this._createPopper(tip)\n }\n\n tip.classList.add(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.on(element, 'mouseover', noop)\n }\n }\n\n const complete = () => {\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN))\n\n if (this._isHovered === false) {\n this._leave()\n }\n\n this._isHovered = false\n }\n\n this._queueCallback(complete, this.tip, this._isAnimated())\n }\n\n hide() {\n if (!this._isShown()) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE))\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const tip = this._getTipElement()\n tip.classList.remove(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.off(element, 'mouseover', noop)\n }\n }\n\n this._activeTrigger[TRIGGER_CLICK] = false\n this._activeTrigger[TRIGGER_FOCUS] = false\n this._activeTrigger[TRIGGER_HOVER] = false\n this._isHovered = null // it is a trick to support manual triggering\n\n const complete = () => {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n if (!this._isHovered) {\n tip.remove()\n }\n\n this._element.removeAttribute('aria-describedby')\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN))\n\n this._disposePopper()\n }\n\n this._queueCallback(complete, this.tip, this._isAnimated())\n }\n\n update() {\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Protected\n _isWithContent() {\n return Boolean(this._getTitle())\n }\n\n _getTipElement() {\n if (!this.tip) {\n this.tip = this._createTipElement(this._newContent || this._getContentForTemplate())\n }\n\n return this.tip\n }\n\n _createTipElement(content) {\n const tip = this._getTemplateFactory(content).toHtml()\n\n // todo: remove this check on v6\n if (!tip) {\n return null\n }\n\n tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)\n // todo: on v6 the following can be achieved with CSS only\n tip.classList.add(`bs-${this.constructor.NAME}-auto`)\n\n const tipId = getUID(this.constructor.NAME).toString()\n\n tip.setAttribute('id', tipId)\n\n if (this._isAnimated()) {\n tip.classList.add(CLASS_NAME_FADE)\n }\n\n return tip\n }\n\n setContent(content) {\n this._newContent = content\n if (this._isShown()) {\n this._disposePopper()\n this.show()\n }\n }\n\n _getTemplateFactory(content) {\n if (this._templateFactory) {\n this._templateFactory.changeContent(content)\n } else {\n this._templateFactory = new TemplateFactory({\n ...this._config,\n // the `content` var has to be after `this._config`\n // to override config.content in case of popover\n content,\n extraClass: this._resolvePossibleFunction(this._config.customClass)\n })\n }\n\n return this._templateFactory\n }\n\n _getContentForTemplate() {\n return {\n [SELECTOR_TOOLTIP_INNER]: this._getTitle()\n }\n }\n\n _getTitle() {\n return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title')\n }\n\n // Private\n _initializeOnDelegatedTarget(event) {\n return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig())\n }\n\n _isAnimated() {\n return this._config.animation || (this.tip && this.tip.classList.contains(CLASS_NAME_FADE))\n }\n\n _isShown() {\n return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW)\n }\n\n _createPopper(tip) {\n const placement = typeof this._config.placement === 'function' ?\n this._config.placement.call(this, tip, this._element) :\n this._config.placement\n const attachment = AttachmentMap[placement.toUpperCase()]\n return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment))\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(value => Number.parseInt(value, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _resolvePossibleFunction(arg) {\n return typeof arg === 'function' ? arg.call(this._element) : arg\n }\n\n _getPopperConfig(attachment) {\n const defaultBsPopperConfig = {\n placement: attachment,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: this._config.fallbackPlacements\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n },\n {\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'arrow',\n options: {\n element: `.${this.constructor.NAME}-arrow`\n }\n },\n {\n name: 'preSetPlacement',\n enabled: true,\n phase: 'beforeMain',\n fn: data => {\n // Pre-set Popper's placement attribute in order to read the arrow sizes properly.\n // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement\n this._getTipElement().setAttribute('data-popper-placement', data.state.placement)\n }\n }\n ]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)\n }\n }\n\n _setListeners() {\n const triggers = this._config.trigger.split(' ')\n\n for (const trigger of triggers) {\n if (trigger === 'click') {\n EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context.toggle()\n })\n } else if (trigger !== TRIGGER_MANUAL) {\n const eventIn = trigger === TRIGGER_HOVER ?\n this.constructor.eventName(EVENT_MOUSEENTER) :\n this.constructor.eventName(EVENT_FOCUSIN)\n const eventOut = trigger === TRIGGER_HOVER ?\n this.constructor.eventName(EVENT_MOUSELEAVE) :\n this.constructor.eventName(EVENT_FOCUSOUT)\n\n EventHandler.on(this._element, eventIn, this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true\n context._enter()\n })\n EventHandler.on(this._element, eventOut, this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] =\n context._element.contains(event.relatedTarget)\n\n context._leave()\n })\n }\n }\n\n this._hideModalHandler = () => {\n if (this._element) {\n this.hide()\n }\n }\n\n EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n }\n\n _fixTitle() {\n const title = this._element.getAttribute('title')\n\n if (!title) {\n return\n }\n\n if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {\n this._element.setAttribute('aria-label', title)\n }\n\n this._element.setAttribute('data-bs-original-title', title) // DO NOT USE IT. Is only for backwards compatibility\n this._element.removeAttribute('title')\n }\n\n _enter() {\n if (this._isShown() || this._isHovered) {\n this._isHovered = true\n return\n }\n\n this._isHovered = true\n\n this._setTimeout(() => {\n if (this._isHovered) {\n this.show()\n }\n }, this._config.delay.show)\n }\n\n _leave() {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n this._isHovered = false\n\n this._setTimeout(() => {\n if (!this._isHovered) {\n this.hide()\n }\n }, this._config.delay.hide)\n }\n\n _setTimeout(handler, timeout) {\n clearTimeout(this._timeout)\n this._timeout = setTimeout(handler, timeout)\n }\n\n _isWithActiveTrigger() {\n return Object.values(this._activeTrigger).includes(true)\n }\n\n _getConfig(config) {\n const dataAttributes = Manipulator.getDataAttributes(this._element)\n\n for (const dataAttribute of Object.keys(dataAttributes)) {\n if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {\n delete dataAttributes[dataAttribute]\n }\n }\n\n config = {\n ...dataAttributes,\n ...(typeof config === 'object' && config ? config : {})\n }\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n config.container = config.container === false ? document.body : getElement(config.container)\n\n if (typeof config.delay === 'number') {\n config.delay = {\n show: config.delay,\n hide: config.delay\n }\n }\n\n if (typeof config.title === 'number') {\n config.title = config.title.toString()\n }\n\n if (typeof config.content === 'number') {\n config.content = config.content.toString()\n }\n\n return config\n }\n\n _getDelegateConfig() {\n const config = {}\n\n for (const key in this._config) {\n if (this.constructor.Default[key] !== this._config[key]) {\n config[key] = this._config[key]\n }\n }\n\n config.selector = false\n config.trigger = 'manual'\n\n // In the future can be replaced with:\n // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])\n // `Object.fromEntries(keysWithDifferentValues)`\n return config\n }\n\n _disposePopper() {\n if (this._popper) {\n this._popper.destroy()\n this._popper = null\n }\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Tooltip.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Tooltip)\n\nexport default Tooltip\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport Tooltip from './tooltip'\n\n/**\n * Constants\n */\n\nconst NAME = 'popover'\n\nconst SELECTOR_TITLE = '.popover-header'\nconst SELECTOR_CONTENT = '.popover-body'\n\nconst Default = {\n ...Tooltip.Default,\n content: '',\n offset: [0, 8],\n placement: 'right',\n template: '
' +\n '
' +\n '

' +\n '
' +\n '
',\n trigger: 'click'\n}\n\nconst DefaultType = {\n ...Tooltip.DefaultType,\n content: '(null|string|element|function)'\n}\n\n/**\n * Class definition\n */\n\nclass Popover extends Tooltip {\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Overrides\n _isWithContent() {\n return this._getTitle() || this._getContent()\n }\n\n // Private\n _getContentForTemplate() {\n return {\n [SELECTOR_TITLE]: this._getTitle(),\n [SELECTOR_CONTENT]: this._getContent()\n }\n }\n\n _getContent() {\n return this._resolvePossibleFunction(this._config.content)\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Popover.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Popover)\n\nexport default Popover\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.2): scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin, getElement, isDisabled, isVisible } from './util/index'\nimport EventHandler from './dom/event-handler'\nimport SelectorEngine from './dom/selector-engine'\nimport BaseComponent from './base-component'\n\n/**\n * Constants\n */\n\nconst NAME = 'scrollspy'\nconst DATA_KEY = 'bs.scrollspy'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_ACTIVATE = `activate${EVENT_KEY}`\nconst EVENT_CLICK = `click${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_SPY = '[data-bs-spy=\"scroll\"]'\nconst SELECTOR_TARGET_LINKS = '[href]'\nconst SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'\nconst SELECTOR_NAV_LINKS = '.nav-link'\nconst SELECTOR_NAV_ITEMS = '.nav-item'\nconst SELECTOR_LIST_ITEMS = '.list-group-item'\nconst SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`\nconst SELECTOR_DROPDOWN = '.dropdown'\nconst SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'\n\nconst Default = {\n offset: null, // TODO: v6 @deprecated, keep it for backwards compatibility reasons\n rootMargin: '0px 0px -25%',\n smoothScroll: false,\n target: null,\n threshold: [0.1, 0.5, 1]\n}\n\nconst DefaultType = {\n offset: '(number|null)', // TODO v6 @deprecated, keep it for backwards compatibility reasons\n rootMargin: 'string',\n smoothScroll: 'boolean',\n target: 'element',\n threshold: 'array'\n}\n\n/**\n * Class definition\n */\n\nclass ScrollSpy extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n // this._element is the observablesContainer and config.target the menu links wrapper\n this._targetLinks = new Map()\n this._observableSections = new Map()\n this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element\n this._activeTarget = null\n this._observer = null\n this._previousScrollData = {\n visibleEntryTop: 0,\n parentScrollTop: 0\n }\n this.refresh() // initialize\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n refresh() {\n this._initializeTargetsAndObservables()\n this._maybeEnableSmoothScroll()\n\n if (this._observer) {\n this._observer.disconnect()\n } else {\n this._observer = this._getNewObserver()\n }\n\n for (const section of this._observableSections.values()) {\n this._observer.observe(section)\n }\n }\n\n dispose() {\n this._observer.disconnect()\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case\n config.target = getElement(config.target) || document.body\n\n // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only\n config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin\n\n if (typeof config.threshold === 'string') {\n config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value))\n }\n\n return config\n }\n\n _maybeEnableSmoothScroll() {\n if (!this._config.smoothScroll) {\n return\n }\n\n // unregister any previous listeners\n EventHandler.off(this._config.target, EVENT_CLICK)\n\n EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {\n const observableSection = this._observableSections.get(event.target.hash)\n if (observableSection) {\n event.preventDefault()\n const root = this._rootElement || window\n const height = observableSection.offsetTop - this._element.offsetTop\n if (root.scrollTo) {\n root.scrollTo({ top: height, behavior: 'smooth' })\n return\n }\n\n // Chrome 60 doesn't support `scrollTo`\n root.scrollTop = height\n }\n })\n }\n\n _getNewObserver() {\n const options = {\n root: this._rootElement,\n threshold: this._config.threshold,\n rootMargin: this._config.rootMargin\n }\n\n return new IntersectionObserver(entries => this._observerCallback(entries), options)\n }\n\n // The logic of selection\n _observerCallback(entries) {\n const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`)\n const activate = entry => {\n this._previousScrollData.visibleEntryTop = entry.target.offsetTop\n this._process(targetElement(entry))\n }\n\n const parentScrollTop = (this._rootElement || document.documentElement).scrollTop\n const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop\n this._previousScrollData.parentScrollTop = parentScrollTop\n\n for (const entry of entries) {\n if (!entry.isIntersecting) {\n this._activeTarget = null\n this._clearActiveClass(targetElement(entry))\n\n continue\n }\n\n const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop\n // if we are scrolling down, pick the bigger offsetTop\n if (userScrollsDown && entryIsLowerThanPrevious) {\n activate(entry)\n // if parent isn't scrolled, let's keep the first visible item, breaking the iteration\n if (!parentScrollTop) {\n return\n }\n\n continue\n }\n\n // if we are scrolling up, pick the smallest offsetTop\n if (!userScrollsDown && !entryIsLowerThanPrevious) {\n activate(entry)\n }\n }\n }\n\n _initializeTargetsAndObservables() {\n this._targetLinks = new Map()\n this._observableSections = new Map()\n\n const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target)\n\n for (const anchor of targetLinks) {\n // ensure that the anchor has an id and is not disabled\n if (!anchor.hash || isDisabled(anchor)) {\n continue\n }\n\n const observableSection = SelectorEngine.findOne(anchor.hash, this._element)\n\n // ensure that the observableSection exists & is visible\n if (isVisible(observableSection)) {\n this._targetLinks.set(anchor.hash, anchor)\n this._observableSections.set(anchor.hash, observableSection)\n }\n }\n }\n\n _process(target) {\n if (this._activeTarget === target) {\n return\n }\n\n this._clearActiveClass(this._config.target)\n this._activeTarget = target\n target.classList.add(CLASS_NAME_ACTIVE)\n this._activateParents(target)\n\n EventHandler.trigger(this._element, EVENT_ACTIVATE, { relatedTarget: target })\n }\n\n _activateParents(target) {\n // Activate dropdown parents\n if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {\n SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN))\n .classList.add(CLASS_NAME_ACTIVE)\n return\n }\n\n for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {\n // Set triggered links parents as active\n // With both
    and
", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - - // Support: Chrome 86+ - // In Chrome, if an element having a focusout handler is blurred by - // clicking outside of it, it invokes the handler synchronously. If - // that handler calls `.remove()` on the element, the data is cleared, - // leaving `result` undefined. We need to guard against this. - return result && result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - which: true -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - // Suppress native focus or blur as it's already being fired - // in leverageNative. - _default: function() { - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - // - // Support: Firefox 70+ - // Only Firefox includes border widths - // in computed dimensions. (gh-4529) - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "border:1px solid"; - - // Support: Chrome 86+ - // Height set through cssText does not get applied. - // Computed height then comes back as 0. - tr.style.height = "1px"; - trChild.style.height = "9px"; - - // Support: Android 8 Chrome 86+ - // In our bodyBackground.html iframe, - // display for all div elements is set to "inline", - // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is display: block - // gets around this issue. - trChild.style.display = "block"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + - parseInt( trStyle.borderTopWidth, 10 ) + - parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, parserErrorElem; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) {} - - parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; - if ( !xml || parserErrorElem ) { - jQuery.error( "Invalid XML: " + ( - parserErrorElem ? - jQuery.map( parserErrorElem.childNodes, function( el ) { - return el.textContent; - } ).join( "\n" ) : - data - ) ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ).filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ).map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - -originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script but not if jsonp - if ( !isSuccess && - jQuery.inArray( "script", s.dataTypes ) > -1 && - jQuery.inArray( "json", s.dataTypes ) < 0 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( " - - - - - - - - - - - - Skip to contents - - -
-
-
- -

A badge verifying if this package has passed all its tests.

-
-

About -

-

Animint2 is an R package for generating and sharing interactive data visualizations, sometimes referred to as animints. It is a fork of, and uses similar syntax to, ggplot2. Animint2 is especially useful for large datasets, but smaller datasets can be made interactive, too. It is also capable of generating static data visualizations.

-

Play around with this interactive data visualization of data from the World Bank. For more examples, go to the animint gallery.

-

To learn how to generate your own interactive data visualizations, go to the official Animint2 Manual. If you encounter problems, please see the animint2 wiki or report them.

-

A screencast of an interactive data visualization displaying fertility data from the World Bank. The user types in the selection menu and clicks on the legend, which causes changes in the visualization. GIF.

-
-
-

Installation -

-
-# Install the official package from CRAN.
-# This is the option most people should choose:
-install.packages("animint2")
-
-# If you want to install the development version:
-devtools::install_github("animint/animint2")
-
-
-

Use -

-

Animint2 uses the same implementation of ggplot2’s grammar of graphics—with a few additions. If you’re familiar with ggplot2, using animint2 will be easy. If you’re not, no worries. To get started, see the brief Animint2 Quick Start Guide or read the first few chapters of the Animint2 Manual.

-

animint2 renders and animates data visualizations. It can neither manipulate the datasets you give it nor generate its own data.

-
-
-

Similar Packages -

-

animint2 isn’t the only R package that can create animated or interactive data visualizations.

-

animation and gganimate can animate changes between variables over time. The loon package specializes in exploratory data analysis. plotly is probably most similar to animint2 in terms of functionality.

-

For comparisons between the aforementioned packages and animint2, see the differences wiki page.

-
-
-

Problems? -

-

The animint2 package is a work in progress. If you spot any bugs or unexpected behaviors, please let us know by reporting it as an issue on GitHub. Thanks! Have a great day.

-
-
-
-
- - -
- - - -
-
- - - - - - - diff --git a/docs/link.svg b/docs/link.svg deleted file mode 100644 index 88ad82769..000000000 --- a/docs/link.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/docs/news/index.html b/docs/news/index.html deleted file mode 100644 index 2e7a65790..000000000 --- a/docs/news/index.html +++ /dev/null @@ -1,165 +0,0 @@ - -Changelog • animint2 - Skip to contents - - -
-
-
- -
-

Changes in 2023.6.11

-
  • Remove maptools dependency.
  • -
  • split.x -> split_recursive to silence new CRAN check.
  • -
  • setDTthreads(1) in examples for CRAN.
  • -
-
-

Changes in 2023.3.14

-
  • Changes to satisfy CRAN (import is, consistent function args, graphical-units.Rd, rm Fox book URL in stat_ellipse.Rd).
  • -
  • facet and plot title text size configurable via theme(strip.text, axis.text).
  • -
-
-

Changes in 2022.9.14

-
  • Include Yufan Fei as contributor in DESCRIPTION.
  • -
-
-

Changes in 2022.9.14

-
  • Allow configurable legend/axis text size via theme.
  • -
-
-

Changes in 2022.8.31

-
  • User-configurable selection styles, alpha_off and colour_off.
  • -
-
-

Changes in 2022.8.25

-
  • import data.table, for faster compilation.
  • -
-
-

Changes in 2022.5.25

-
  • Add ability to rotate geom_text labels, following ggplot2’s semantics of rotation direction.
  • -
-
-

Changes in 2022.5.24

-
  • Fixed small test regression and set up Github Actions. Neither of these is user facing.
  • -
-
-

Changes in 2022.2.2

-
  • Default x/y axis text size increased to 16px from 11px in animint.js.
  • -
  • Suggest RColorBrewer to avoid CRAN NOTE “Undeclared package RColorBrewer in Rd xrefs”.
  • -
-
-

Changes in 2022.1.25

-
  • Remove geom/stat_boxplot/quantile due to errors from CRAN check.
  • -
-
-

Changes in 2020.9.18

-
  • update moved mcmaster URL in docs.
  • -
-
-

Changes in 2020.8.19

-
  • Move geom-specific code from saveLayer/if-else to Geom$export_animint and pre_process methods in Geom sub-classes.
  • -
-
-

Changes in 2020.7.9

-
  • Using RSelenium 1.7.4.
  • -
  • Removed Defunct and Redundant code/examples.
  • -
  • User can test using docker to avoid incompatibility issues.
  • -
  • imports knitr as knit_print imported in namespace.
  • -
  • Use new grid::unitType() to determine unit type of margin in pt/points to line conversion.
  • -
-
-

Changes in 2020.3.2

-
  • data.frame(stringsAsFactors=TRUE) in tests.
  • -
-
-

Changes in 2019.7.12

-
  • Added three authors which are mentioned in Rd/R files.
  • -
-
-

Changes in 2019.7.3

-
  • ggsave(file.path(tempdir(), f)) in examples.
  • -
-
-

Changes in 2019.7.2

-
  • animint2dir writes to temp dir rather than user dir during examples/tests.
  • -
-
-

Changes in 2019.6.4

-
  • bugfix for facet_grid(scales/space=“free”)
  • -
  • bugfix for update_axes with geom_abline
  • -
  • bugfix for graph height computation, which only showed up when there were lots of rows in the facet spec.
  • -
-
-

Changes in 2018.12.14

-
  • animint fun, export print method.
  • -
  • infinite values converted to range min/max before saving tsv files.
  • -
-
-

Changes in 2018.10.4

-
  • DEP: no longer depend on any branch of ggplot2.
  • -
  • train_layout from ggplot2 - R/panel.r function is now g_train_layout. train_layout from animint2 - R/z_facet.R function is the same. Both are internal functions.
  • -
-
-

Changes in 2017.08.24

-
  • DSL: clickSelects/showSelected are now specified as parameters rather than aesthetics.
  • -
-
- - -
- - - -
- - - - - - - diff --git a/docs/pkgdown.js b/docs/pkgdown.js deleted file mode 100644 index 5fccd9c0e..000000000 --- a/docs/pkgdown.js +++ /dev/null @@ -1,156 +0,0 @@ -/* http://gregfranko.com/blog/jquery-best-practices/ */ -(function($) { - $(function() { - - $('nav.navbar').headroom(); - - Toc.init({ - $nav: $("#toc"), - $scope: $("main h2, main h3, main h4, main h5, main h6") - }); - - if ($('#toc').length) { - $('body').scrollspy({ - target: '#toc', - offset: $("nav.navbar").outerHeight() + 1 - }); - } - - // Activate popovers - $('[data-bs-toggle="popover"]').popover({ - container: 'body', - html: true, - trigger: 'focus', - placement: "top", - sanitize: false, - }); - - $('[data-bs-toggle="tooltip"]').tooltip(); - - /* Clipboard --------------------------*/ - - function changeTooltipMessage(element, msg) { - var tooltipOriginalTitle=element.getAttribute('data-original-title'); - element.setAttribute('data-original-title', msg); - $(element).tooltip('show'); - element.setAttribute('data-original-title', tooltipOriginalTitle); - } - - if(ClipboardJS.isSupported()) { - $(document).ready(function() { - var copyButton = ""; - - $("div.sourceCode").addClass("hasCopyButton"); - - // Insert copy buttons: - $(copyButton).prependTo(".hasCopyButton"); - - // Initialize tooltips: - $('.btn-copy-ex').tooltip({container: 'body'}); - - // Initialize clipboard: - var clipboard = new ClipboardJS('[data-clipboard-copy]', { - text: function(trigger) { - return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); - } - }); - - clipboard.on('success', function(e) { - changeTooltipMessage(e.trigger, 'Copied!'); - e.clearSelection(); - }); - - clipboard.on('error', function() { - changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); - }); - - }); - } - - /* Search marking --------------------------*/ - var url = new URL(window.location.href); - var toMark = url.searchParams.get("q"); - var mark = new Mark("main#main"); - if (toMark) { - mark.mark(toMark, { - accuracy: { - value: "complementary", - limiters: [",", ".", ":", "/"], - } - }); - } - - /* Search --------------------------*/ - /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ - // Initialise search index on focus - var fuse; - $("#search-input").focus(async function(e) { - if (fuse) { - return; - } - - $(e.target).addClass("loading"); - var response = await fetch($("#search-input").data("search-index")); - var data = await response.json(); - - var options = { - keys: ["what", "text", "code"], - ignoreLocation: true, - threshold: 0.1, - includeMatches: true, - includeScore: true, - }; - fuse = new Fuse(data, options); - - $(e.target).removeClass("loading"); - }); - - // Use algolia autocomplete - var options = { - autoselect: true, - debug: true, - hint: false, - minLength: 2, - }; - var q; -async function searchFuse(query, callback) { - await fuse; - - var items; - if (!fuse) { - items = []; - } else { - q = query; - var results = fuse.search(query, { limit: 20 }); - items = results - .filter((x) => x.score <= 0.75) - .map((x) => x.item); - if (items.length === 0) { - items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; - } - } - callback(items); -} - $("#search-input").autocomplete(options, [ - { - name: "content", - source: searchFuse, - templates: { - suggestion: (s) => { - if (s.title == s.what) { - return `${s.dir} >
${s.title}
`; - } else if (s.previous_headings == "") { - return `${s.dir} >
${s.title}
> ${s.what}`; - } else { - return `${s.dir} >
${s.title}
> ${s.previous_headings} > ${s.what}`; - } - }, - }, - }, - ]).on('autocomplete:selected', function(event, s) { - window.location.href = s.path + "?q=" + q + "#" + s.id; - }); - }); -})(window.jQuery || window.$) - - diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml deleted file mode 100644 index d68aa333e..000000000 --- a/docs/pkgdown.yml +++ /dev/null @@ -1,10 +0,0 @@ -pandoc: 3.1.6.2 -pkgdown: 2.0.7 -pkgdown_sha: ~ -articles: - animint2: animint2.html -last_built: 2023-08-30T04:22Z -urls: - reference: https://animint.github.io/animint2/reference - article: https://animint.github.io/animint2/articles - diff --git a/docs/readme_website.html b/docs/readme_website.html deleted file mode 100644 index f04fa1536..000000000 --- a/docs/readme_website.html +++ /dev/null @@ -1,152 +0,0 @@ - -Maintaining & Debugging the Animint2 Website • animint2 - Skip to contents - - -
-
-
- -
- -
-

About

-

First written 2023-06-28. Last revised 2023-08-22.

-

This is an internal document intended for animint2 contributors. It explains how to maintain and debug the animint2 reference website and gives some reasons why you might need to. Feel free to add to and edit this document.

-

Maintaining the site is neither hard nor annoying, but it’s also not automatic. Most of the time, you can leave the website alone. But there are some circumstances when you would need to maintain or update the website:

-
  • You added a new function to animint2.
  • -
  • You’re getting errors about the GitHub access token or the PAT.
  • -
  • You made changes to the quick start guide.
  • -
  • You wanna change the reference website’s URL.
  • -
  • You wanna change the reference website’s typeface or font.
  • -
  • The website is messed up or has stopped working in some way.
  • -
  • You made changes to some file in the animint2 repository and it should have some effect on the website. Examples include NEWS.md, _pkgdown.yml, or pkgdown/extra.css.
  • -
-
-

Have You Tried Re-Building It?

-

You can solve a lot of maintenance problems by running the following:

-
cd whatever/your/path/is/animint/animint2
-pkgdown::build_site()
-

This takes a few minutes and re-builds the site. Then push the changes to the animint2 repository.

-

For a lot of problems, that’s it. But if (substantial) changes aren’t showing up when they should, or if this doesn’t fix the bug, you’ll need to read on.

-
-
-

Adding a Function

-

You added a new function to the animint2 package. Congratulations! It was probably a lot of work. But now you need it to show up on the website. The process is straightforward.

-

First, do everything in the “Have You Tried Re-Building It?” section. If your new function starts with “animint,” “make,” or “get,” your new function will appear on the website. No further work needed.

-

If it doesn’t, probably because it doesn’t start with any of those prefixes, you’ll have to do more work. First, open _pkgdown.yml, scroll down to references:, and find the section where your new function should be categorized. My guess is that it’d fall under

-
- subtitle: "Animint Helpers"
-

but you’d know best. Next, slot it under - contents:. Then run the code in the “Have You Tried Re-Building It?” section again and push the changes to the animint2 repo.

-
-
-

Refreshing the GitHub Access Token

-

If you’re getting errors about GitHub access tokens or PATs, that means that they have either expired, changed, or been destroyed, run

-
cd whatever/your/path/is/animint/animint2
-usethis::create_github_token()
-gitcreds::gitcreds_set()
-

and follow the instructions.

-
-
-

Changes to the Quick Start Guide

-

First, do everything in the “Have You Tried Re-Building It?” section. If your new content hasn’t been added, it’s probably because you used animint2, which renders animints in vignettes/ instead of docs/. You’ll need to cut/paste the rendered directories and drop them in docs/articles/. Then run the code in the “Have You Tried Re-Building It?” section again and push the changes to the animint2 repo.

-

It might be possible to use animint2::animint2dir() to automate this. Unfortunately, I haven’t figured out a way to use it in a way that’s more elegant and maintainable than the cut/paste solution. If you figure it out, feel free to implement it.

-
-
-

Changes to the URL

-

If you wanna change the URL: go to _pkgdown.yml, edit the url: or add another, and then do everything in the “Have You Tried Re-Building It?” section.

-
-
-

Changes to the Typeface or Font

-

If you wanna change the typeface (often referred to as the font): go to _pkgdown.yml, then bslib:. You’ll see:

-
  • -base_font, which controls the default typeface,
  • -
  • -heading_font, which controls the typeface for titles and headings, and
  • -
  • -code_font, which controls the font in the codeblocks and in in-line code.
  • -

Swap out the current font with ones of your choice, and then do everything in the “Have You Tried Re-Building It?” section.

-
-
-

The Website is Messed Up

-

Is the website messed up after you pushed some commits to the animint2 repository? Revert your commits with git revert $SHA or something. Then debug to find out what happened.

-

If the website is messed up cuz of changes you made via the GitHub API or via the GitHub website, you’ll need to figure out exactly what you changed and how that’s affect the website. Good luck.

-
-
-

Changes to Other Animint2 Files

-

If a change to the repository is meant to affect animint2’s CRAN page, then you’ll also need to update the website, too. Do everything in the “Have You Tried Re-Building It?” section.

-

Some changes to the repository are only meant to affect animint2’s reference website. If that’s the case, do everything in the “Have You Tried Re-Building It?” section.

-
-
-

Why Don’t You Just Use GitHub Actions?

-

Using GitHub Actions would automate many parts of maintaining the site, though it’d leave some parts untouched (e.g. refreshing the access token). The main reason I haven’t done it is cuz I dunno how! Feel free to set up the site via GitHub Actions. That’d be great.

-
- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ChromHMMiterations.html b/docs/reference/ChromHMMiterations.html deleted file mode 100644 index b5c8c5ec8..000000000 --- a/docs/reference/ChromHMMiterations.html +++ /dev/null @@ -1,94 +0,0 @@ - -ChromHMM iterations — ChromHMMiterations • animint2 - Skip to contents - - -
-
-
- -
-

ChromHMM was run for one iPS sample for 100 iterations - and its convergence metrics and parameter values were saved - at each iteration.

-
- -
-

Usage

-
data("ChromHMMiterations")
-
- -
-

Format

-

Named list of 3 data.frames: metrics, transition, emission.

-
-
-

Source

-

https://github.com/tdhock/ChromHMM-viz/blob/master/iterations.R

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/FluView.html b/docs/reference/FluView.html deleted file mode 100644 index 1ac8cd5bd..000000000 --- a/docs/reference/FluView.html +++ /dev/null @@ -1,84 +0,0 @@ - -FluView — FluView • animint2 - Skip to contents - - -
-
-
- -
-

Data about Flu outbreaks.

-
- -
-

Usage

-
data("FluView")
-
- -
-

Format

-

The format is a named list of two data.frames.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/FunctionalPruning.html b/docs/reference/FunctionalPruning.html deleted file mode 100644 index e85a99a63..000000000 --- a/docs/reference/FunctionalPruning.html +++ /dev/null @@ -1,88 +0,0 @@ - -Functional Pruning Algorithm — FunctionalPruning • animint2 - Skip to contents - - -
-
-
- -
-

Output of an algorithm for optimal change-point detection.

-
- -
-

Usage

-
data("FunctionalPruning")
-
- -
-

Format

-

a named list of 4 data.frames

-
-
-

Source

-

https://github.com/tdhock/PeakSegFPOP-paper/blob/master/figure-constrained-PDPA-normal-real.R

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/PeakConsistency.html b/docs/reference/PeakConsistency.html deleted file mode 100644 index 5a86aa84d..000000000 --- a/docs/reference/PeakConsistency.html +++ /dev/null @@ -1,94 +0,0 @@ - -Consistency of segmentation models in simulated Poisson peaks — PeakConsistency • animint2 - Skip to contents - - -
-
-
- -
-

For each of 4 seed and ten samples, a sequence of noisy Poisson data - was generated, and then PeakSeg and PeakSegJoint were used to detect - the peak.

-
- -
-

Usage

-
data("PeakConsistency")
-
- -
-

Format

-

A list of four data.frames: model, truth, signal, guess.

-
-
-

Source

-

https://github.com/tdhock/PeakSegJoint-paper/blob/master/figure-consistency.R

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png deleted file mode 100644 index 8fa051255..000000000 Binary files a/docs/reference/Rplot001.png and /dev/null differ diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png deleted file mode 100644 index fadb71e0a..000000000 Binary files a/docs/reference/Rplot002.png and /dev/null differ diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png deleted file mode 100644 index 1aa6b0565..000000000 Binary files a/docs/reference/Rplot003.png and /dev/null differ diff --git a/docs/reference/Rplot004.png b/docs/reference/Rplot004.png deleted file mode 100644 index f62be6abe..000000000 Binary files a/docs/reference/Rplot004.png and /dev/null differ diff --git a/docs/reference/Rplot005.png b/docs/reference/Rplot005.png deleted file mode 100644 index bfcc05cb7..000000000 Binary files a/docs/reference/Rplot005.png and /dev/null differ diff --git a/docs/reference/Rplot006.png b/docs/reference/Rplot006.png deleted file mode 100644 index 6cbf51c38..000000000 Binary files a/docs/reference/Rplot006.png and /dev/null differ diff --git a/docs/reference/Rplot007.png b/docs/reference/Rplot007.png deleted file mode 100644 index 6143cdd53..000000000 Binary files a/docs/reference/Rplot007.png and /dev/null differ diff --git a/docs/reference/Rplot008.png b/docs/reference/Rplot008.png deleted file mode 100644 index 87a4711f2..000000000 Binary files a/docs/reference/Rplot008.png and /dev/null differ diff --git a/docs/reference/Rplot009.png b/docs/reference/Rplot009.png deleted file mode 100644 index 5b6692aa0..000000000 Binary files a/docs/reference/Rplot009.png and /dev/null differ diff --git a/docs/reference/Rplot010.png b/docs/reference/Rplot010.png deleted file mode 100644 index 4737a66dc..000000000 Binary files a/docs/reference/Rplot010.png and /dev/null differ diff --git a/docs/reference/Rplot011.png b/docs/reference/Rplot011.png deleted file mode 100644 index b47b684bb..000000000 Binary files a/docs/reference/Rplot011.png and /dev/null differ diff --git a/docs/reference/Rplot012.png b/docs/reference/Rplot012.png deleted file mode 100644 index a25beff3a..000000000 Binary files a/docs/reference/Rplot012.png and /dev/null differ diff --git a/docs/reference/Rplot013.png b/docs/reference/Rplot013.png deleted file mode 100644 index a4e6661e3..000000000 Binary files a/docs/reference/Rplot013.png and /dev/null differ diff --git a/docs/reference/Rplot014.png b/docs/reference/Rplot014.png deleted file mode 100644 index 421903f1a..000000000 Binary files a/docs/reference/Rplot014.png and /dev/null differ diff --git a/docs/reference/Rplot015.png b/docs/reference/Rplot015.png deleted file mode 100644 index 3a4f22a69..000000000 Binary files a/docs/reference/Rplot015.png and /dev/null differ diff --git a/docs/reference/Rplot016.png b/docs/reference/Rplot016.png deleted file mode 100644 index dac902f6a..000000000 Binary files a/docs/reference/Rplot016.png and /dev/null differ diff --git a/docs/reference/Rplot017.png b/docs/reference/Rplot017.png deleted file mode 100644 index 156396b2a..000000000 Binary files a/docs/reference/Rplot017.png and /dev/null differ diff --git a/docs/reference/Rplot018.png b/docs/reference/Rplot018.png deleted file mode 100644 index ea3f60bdf..000000000 Binary files a/docs/reference/Rplot018.png and /dev/null differ diff --git a/docs/reference/Rplot019.png b/docs/reference/Rplot019.png deleted file mode 100644 index ce4117b0d..000000000 Binary files a/docs/reference/Rplot019.png and /dev/null differ diff --git a/docs/reference/Rplot020.png b/docs/reference/Rplot020.png deleted file mode 100644 index bda43ad49..000000000 Binary files a/docs/reference/Rplot020.png and /dev/null differ diff --git a/docs/reference/Rplot021.png b/docs/reference/Rplot021.png deleted file mode 100644 index f97737805..000000000 Binary files a/docs/reference/Rplot021.png and /dev/null differ diff --git a/docs/reference/Rplot022.png b/docs/reference/Rplot022.png deleted file mode 100644 index d3380d41b..000000000 Binary files a/docs/reference/Rplot022.png and /dev/null differ diff --git a/docs/reference/Rplot023.png b/docs/reference/Rplot023.png deleted file mode 100644 index d724d3491..000000000 Binary files a/docs/reference/Rplot023.png and /dev/null differ diff --git a/docs/reference/Rplot024.png b/docs/reference/Rplot024.png deleted file mode 100644 index bf0d03a4b..000000000 Binary files a/docs/reference/Rplot024.png and /dev/null differ diff --git a/docs/reference/Rplot025.png b/docs/reference/Rplot025.png deleted file mode 100644 index 2e86ad49e..000000000 Binary files a/docs/reference/Rplot025.png and /dev/null differ diff --git a/docs/reference/Rplot026.png b/docs/reference/Rplot026.png deleted file mode 100644 index 58d75f694..000000000 Binary files a/docs/reference/Rplot026.png and /dev/null differ diff --git a/docs/reference/Rplot027.png b/docs/reference/Rplot027.png deleted file mode 100644 index 687c04c9a..000000000 Binary files a/docs/reference/Rplot027.png and /dev/null differ diff --git a/docs/reference/Rplot028.png b/docs/reference/Rplot028.png deleted file mode 100644 index 5498c6fdf..000000000 Binary files a/docs/reference/Rplot028.png and /dev/null differ diff --git a/docs/reference/Rplot029.png b/docs/reference/Rplot029.png deleted file mode 100644 index 2ed353260..000000000 Binary files a/docs/reference/Rplot029.png and /dev/null differ diff --git a/docs/reference/Rplot030.png b/docs/reference/Rplot030.png deleted file mode 100644 index 8390a8f13..000000000 Binary files a/docs/reference/Rplot030.png and /dev/null differ diff --git a/docs/reference/Rplot031.png b/docs/reference/Rplot031.png deleted file mode 100644 index a75f7c3cc..000000000 Binary files a/docs/reference/Rplot031.png and /dev/null differ diff --git a/docs/reference/Rplot032.png b/docs/reference/Rplot032.png deleted file mode 100644 index 922d083ee..000000000 Binary files a/docs/reference/Rplot032.png and /dev/null differ diff --git a/docs/reference/Rplot033.png b/docs/reference/Rplot033.png deleted file mode 100644 index 9f89640b3..000000000 Binary files a/docs/reference/Rplot033.png and /dev/null differ diff --git a/docs/reference/Rplot034.png b/docs/reference/Rplot034.png deleted file mode 100644 index 3cb3d0e08..000000000 Binary files a/docs/reference/Rplot034.png and /dev/null differ diff --git a/docs/reference/Rplot035.png b/docs/reference/Rplot035.png deleted file mode 100644 index 5dab7bc48..000000000 Binary files a/docs/reference/Rplot035.png and /dev/null differ diff --git a/docs/reference/Rplot036.png b/docs/reference/Rplot036.png deleted file mode 100644 index e6c5835c5..000000000 Binary files a/docs/reference/Rplot036.png and /dev/null differ diff --git a/docs/reference/Rplot037.png b/docs/reference/Rplot037.png deleted file mode 100644 index f41aa51b6..000000000 Binary files a/docs/reference/Rplot037.png and /dev/null differ diff --git a/docs/reference/Rplot038.png b/docs/reference/Rplot038.png deleted file mode 100644 index 9314df7e1..000000000 Binary files a/docs/reference/Rplot038.png and /dev/null differ diff --git a/docs/reference/Rplot039.png b/docs/reference/Rplot039.png deleted file mode 100644 index fce391888..000000000 Binary files a/docs/reference/Rplot039.png and /dev/null differ diff --git a/docs/reference/Rplot040.png b/docs/reference/Rplot040.png deleted file mode 100644 index de2b651ff..000000000 Binary files a/docs/reference/Rplot040.png and /dev/null differ diff --git a/docs/reference/Rplot041.png b/docs/reference/Rplot041.png deleted file mode 100644 index f97737805..000000000 Binary files a/docs/reference/Rplot041.png and /dev/null differ diff --git a/docs/reference/Rplot042.png b/docs/reference/Rplot042.png deleted file mode 100644 index ae9d41bc0..000000000 Binary files a/docs/reference/Rplot042.png and /dev/null differ diff --git a/docs/reference/Rplot043.png b/docs/reference/Rplot043.png deleted file mode 100644 index 5b9801d94..000000000 Binary files a/docs/reference/Rplot043.png and /dev/null differ diff --git a/docs/reference/Rplot044.png b/docs/reference/Rplot044.png deleted file mode 100644 index b40f92b1e..000000000 Binary files a/docs/reference/Rplot044.png and /dev/null differ diff --git a/docs/reference/Rplot045.png b/docs/reference/Rplot045.png deleted file mode 100644 index 6b9012b47..000000000 Binary files a/docs/reference/Rplot045.png and /dev/null differ diff --git a/docs/reference/Rplot046.png b/docs/reference/Rplot046.png deleted file mode 100644 index 86160a5b0..000000000 Binary files a/docs/reference/Rplot046.png and /dev/null differ diff --git a/docs/reference/Rplot047.png b/docs/reference/Rplot047.png deleted file mode 100644 index 12f0dad7a..000000000 Binary files a/docs/reference/Rplot047.png and /dev/null differ diff --git a/docs/reference/Rplot048.png b/docs/reference/Rplot048.png deleted file mode 100644 index 638c96e1f..000000000 Binary files a/docs/reference/Rplot048.png and /dev/null differ diff --git a/docs/reference/TestROC.html b/docs/reference/TestROC.html deleted file mode 100644 index 078c7ce24..000000000 --- a/docs/reference/TestROC.html +++ /dev/null @@ -1,88 +0,0 @@ - -Test ROC curves — TestROC • animint2 - Skip to contents - - -
-
-
- -
-

Five peak detection models were evaluated.

-
- -
-

Usage

-
data("TestROC")
-
- -
-

Format

-

A list of two data frames.

-
-
-

Source

-

https://bitbucket.org/mugqic/chip-seq-paper/src/master/figure-roc-test.R

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/UStornadoes.html b/docs/reference/UStornadoes.html deleted file mode 100644 index 1c306c135..000000000 --- a/docs/reference/UStornadoes.html +++ /dev/null @@ -1,185 +0,0 @@ - -Tornadoes in the United States from 1950 to 2012 — UStornadoes • animint2 - Skip to contents - - -
-
-
- -
-

Each row documents 1 tornado.

-
- -
-

Usage

-
data(UStornadoes)
-
- -
-

Format

-

A data frame with 41620 observations on the following 32 variables.

fips
-

a numeric vector

- -
ID
-

a numeric vector

- -
year
-

a numeric vector

- -
month
-

a numeric vector

- -
day
-

a numeric vector

- -
date
-

factor

- -
time
-

a numeric vector

- -
tz
-

a numeric vector

- -
state
-

factor

- -
state.tnum
-

a numeric vector

- -
f
-

a numeric vector

- -
injuries
-

a numeric vector

- -
fatalities
-

a numeric vector

- -
propertyLoss
-

a numeric vector

- -
cropLoss
-

a numeric vector

- -
startLat
-

a numeric vector

- -
startLong
-

a numeric vector

- -
endLat
-

a numeric vector

- -
endLong
-

a numeric vector

- -
trackLength
-

a numeric vector

- -
trackWidth
-

a numeric vector

- -
numStatesAffected
-

a numeric vector

- -
stateNumber
-

a numeric vector

- -
segmentNumber
-

a numeric vector

- -
FipsCounty1
-

a numeric vector

- -
FipsCounty2
-

a numeric vector

- -
FipsCounty3
-

a numeric vector

- -
FipsCounty4
-

a numeric vector

- -
TotalPop2012
-

a numeric vector

- -
LandArea
-

a numeric vector

- -
TornadoesSqMile
-

a numeric vector

- -
weight
-

a numeric vector

- - -
-
-

Source

-

NOAA SVRGIS data (Severe Report Database + Geographic Information System) -http://www.spc.noaa.gov/gis/svrgis/

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/VariantModels.html b/docs/reference/VariantModels.html deleted file mode 100644 index e7afc043a..000000000 --- a/docs/reference/VariantModels.html +++ /dev/null @@ -1,94 +0,0 @@ - -Error rates of supervised learning methods for variant calling — VariantModels • animint2 - Skip to contents - - -
-
-
- -
-

Several supervised machine learning models were applied to the binary - classification task of predicting True Positive or False Positive - variants, using several filtering scores as input.

-
- -
-

Usage

-
data("VariantModels")
-
- -
-

Format

-

List of 6 data.frames: roc, auc, error, ranks, thresholds, minima.

-
-
-

Source

-

https://github.com/tdhock/malaria-evolution-viz/blob/master/figure-folds.R

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/WorldBank.html b/docs/reference/WorldBank.html deleted file mode 100644 index 29db01078..000000000 --- a/docs/reference/WorldBank.html +++ /dev/null @@ -1,133 +0,0 @@ - -Demographics by country from 1960 to 2012 — WorldBank • animint2 - Skip to contents - - -
-
-
- -
-

Each row is one year of demographics for one country.

-
- -
-

Usage

-
data(WorldBank)
-
- -
-

Format

-

A data frame with 11342 observations on the following 15 variables.

iso2c
-

a character vector

- -
country
-

a character vector

- -
year
-

a numeric vector

- -
fertility.rate
-

a numeric vector

- -
life.expectancy
-

a numeric vector

- -
population
-

a numeric vector

- -
GDP.per.capita.Current.USD
-

a numeric vector

- -
15.to.25.yr.female.literacy
-

a numeric vector

- -
iso3c
-

factor

- -
region
-

factor

- -
capital
-

factor

- -
longitude
-

factor

- -
latitude
-

factor

- -
income
-

factor

- -
lending
-

factor

- - -
-
-

Source

-

Copied from the googleVis package.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/absoluteGrob.html b/docs/reference/absoluteGrob.html deleted file mode 100644 index dc0f45c10..000000000 --- a/docs/reference/absoluteGrob.html +++ /dev/null @@ -1,91 +0,0 @@ - -Absolute grob — absoluteGrob • animint2 - Skip to contents - - -
-
-
- -
-

This grob has fixed dimensions and position.

-
- -
-

Usage

-
absoluteGrob(
-  grob,
-  width = NULL,
-  height = NULL,
-  xmin = NULL,
-  ymin = NULL,
-  vp = NULL
-)
-
- -
-

Details

-

It's still experimental

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/addSSandCSasAesthetics.html b/docs/reference/addSSandCSasAesthetics.html deleted file mode 100644 index 49ec1a817..000000000 --- a/docs/reference/addSSandCSasAesthetics.html +++ /dev/null @@ -1,102 +0,0 @@ - -Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics • animint2 - Skip to contents - - -
-
-
- -
-

Add the showSelected/clickSelects params to the aesthetics mapping

-
- -
-

Usage

-
addSSandCSasAesthetics(aesthetics, extra_params)
-
- -
-

Arguments

-
aesthetics
-

list. Original aesthetics mapping of the layer

- - -
extra_params
-

named list containing the details of showSelected -and clickSelects values of the layer

- -
-
-

Value

- - -

Modified aesthetics list with showSelected/clickSelects params added

-
-
-

Details

-

Used before calling ggplot_build in parsePlot and while checking -animint extensions to raise error

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/addShowSelectedForLegend.html b/docs/reference/addShowSelectedForLegend.html deleted file mode 100644 index ba3628640..000000000 --- a/docs/reference/addShowSelectedForLegend.html +++ /dev/null @@ -1,100 +0,0 @@ - -Add a showSelected aesthetic if legend is specified — addShowSelectedForLegend • animint2 - Skip to contents - - -
-
-
- -
-

Add a showSelected aesthetic if legend is specified

-
- -
-

Usage

-
addShowSelectedForLegend(meta, legend, L)
-
- -
-

Arguments

-
meta
-

meta object with all information

- - -
legend
-

legend to scan for showSelected

- - -
L
-

layer of the plot

- -
-
-

Value

- - -

L : Layer with additional mapping to new aesthetic

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/add_theme.html b/docs/reference/add_theme.html deleted file mode 100644 index 125b0da51..000000000 --- a/docs/reference/add_theme.html +++ /dev/null @@ -1,95 +0,0 @@ - -Modify properties of an element in a theme object — add_theme • animint2 - Skip to contents - - -
-
-
- -
-

Modify properties of an element in a theme object

-
- -
-

Usage

-
add_theme(t1, t2, t2name)
-
- -
-

Arguments

-
t1
-

A theme object

- - -
t2
-

A theme object that is to be added to t1

- - -
t2name
-

A name of the t2 object. This is used for printing -informative error messages.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes-1.png b/docs/reference/aes-1.png deleted file mode 100644 index 1430e770c..000000000 Binary files a/docs/reference/aes-1.png and /dev/null differ diff --git a/docs/reference/aes-2.png b/docs/reference/aes-2.png deleted file mode 100644 index 1430e770c..000000000 Binary files a/docs/reference/aes-2.png and /dev/null differ diff --git a/docs/reference/aes.html b/docs/reference/aes.html deleted file mode 100644 index 4e21929a0..000000000 --- a/docs/reference/aes.html +++ /dev/null @@ -1,143 +0,0 @@ - -Define aesthetic mappings. — aes • animint2 - Skip to contents - - -
-
-
- -
-

Generate aesthetic mappings that describe how variables in the data are -mapped to visual properties (aesthetics) of geoms. This function also -standardise aesthetic names by performs partial name matching, converting -color to colour, and old style R names to ggplot names (eg. pch to shape, -cex to size)

-
- -
-

Usage

-
aes(x, y, ...)
-
- -
-

Arguments

-
x, y, ...
-

List of name value pairs giving aesthetics to map to -variables. The names for x and y aesthetics can be omitted (because -they are so common); all other aesthetics must be named.

- -
-
-

See also

-

See aes_q/aes_string for standard - evaluation versions of aes.

-

See - aes_colour_fill_alpha, - aes_linetype_size_shape and aes_position - for more specific examples with different aesthetics.

-
- -
-

Examples

-
aes(x = mpg, y = wt)
-#> * x -> mpg
-#> * y -> wt
-aes(mpg, wt)
-#> * x -> mpg
-#> * y -> wt
-
-# You can also map aesthetics to functions of variables
-aes(x = mpg ^ 2, y = wt / cyl)
-#> * x -> mpg^2
-#> * y -> wt/cyl
-
-# Aesthetic names are automatically standardised
-aes(col = x)
-#> * colour -> x
-aes(fg = x)
-#> * colour -> x
-aes(color = x)
-#> * colour -> x
-aes(colour = x)
-#> * colour -> x
-
-# aes is almost always used with ggplot() or a layer
-ggplot(mpg, aes(displ, hwy)) + geom_point()
-
-ggplot(mpg) + geom_point(aes(displ, hwy))
-
-
-# Aesthetics supplied to ggplot() are used as defaults for every layer
-# you can override them, or supply different aesthetics for each layer
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes_.html b/docs/reference/aes_.html deleted file mode 100644 index 0acd67597..000000000 --- a/docs/reference/aes_.html +++ /dev/null @@ -1,160 +0,0 @@ - -Define aesthetic mappings from strings, or quoted calls and formulas. — aes_ • animint2 - Skip to contents - - -
-
-
- -
-

Aesthetic mappings describe how variables in the data are mapped to visual -properties (aesthetics) of geoms. aes uses non-standard -evaluation to capture the variable names. aes_ and aes_string -require you to explicitly quote the inputs either with "" for -aes_string(), or with quote or ~ for aes_(). -(aes_q is an alias to aes_)

-
- -
-

Usage

-
aes_(x, y, ...)
-
-aes_string(x, y, ...)
-
-aes_q(x, y, ...)
-
- -
-

Arguments

-
x, y, ...
-

List of name value pairs. Elements must be either -quoted calls, strings, one-sided formulas or constants.

- -
-
-

Details

-

It's better to use aes_q(), because there's no easy way to create the -equivalent to aes(colour = "my colour") or aes{x = `X$1`} -with aes_string().

-

aes_string and aes_ are particularly useful when writing -functions that create plots because you can use strings or quoted -names/calls to define the aesthetic mappings, rather than having to use -substitute to generate a call to aes().

-
-
-

See also

- -
- -
-

Examples

-
# Three ways of generating the same aesthetics
-aes(mpg, wt, col = cyl)
-#> * x      -> mpg
-#> * y      -> wt
-#> * colour -> cyl
-aes_(quote(mpg), quote(wt), col = quote(cyl))
-#> * colour -> cyl
-#> * x      -> mpg
-#> * y      -> wt
-aes_(~mpg, ~wt, col = ~cyl)
-#> * colour -> cyl
-#> * x      -> mpg
-#> * y      -> wt
-aes_string("mpg", "wt", col = "cyl")
-#> * colour -> cyl
-#> * x      -> mpg
-#> * y      -> wt
-
-# You can't easily mimic these calls with aes_string
-aes(`$100`, colour = "smooth")
-#> * x      -> `$100`
-#> * colour -> "smooth"
-aes_(~ `$100`, colour = "smooth")
-#> * colour -> "smooth"
-#> * x      -> `$100`
-# Ok, you can, but it requires a _lot_ of quotes
-aes_string("`$100`", colour = '"smooth"')
-#> * colour -> "smooth"
-#> * x      -> `$100`
-
-# Convert strings to names with as.name
-var <- "cyl"
-aes(col = x)
-#> * colour -> x
-aes_(col = as.name(var))
-#> * colour -> cyl
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes_all.html b/docs/reference/aes_all.html deleted file mode 100644 index caf939bfb..000000000 --- a/docs/reference/aes_all.html +++ /dev/null @@ -1,107 +0,0 @@ - -Given a character vector, create a set of identity mappings — aes_all • animint2 - Skip to contents - - -
-
-
- -
-

Given a character vector, create a set of identity mappings

-
- -
-

Usage

-
aes_all(vars)
-
- -
-

Arguments

-
vars
-

vector of variable names

- -
- -
-

Examples

-
aes_all(names(mtcars))
-#> * mpg  -> mpg
-#> * cyl  -> cyl
-#> * disp -> disp
-#> * hp   -> hp
-#> * drat -> drat
-#> * wt   -> wt
-#> * qsec -> qsec
-#> * vs   -> vs
-#> * am   -> am
-#> * gear -> gear
-#> * carb -> carb
-aes_all(c("x", "y", "col", "pch"))
-#> * x      -> x
-#> * y      -> y
-#> * colour -> col
-#> * shape  -> pch
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes_auto.html b/docs/reference/aes_auto.html deleted file mode 100644 index 36682c0b9..000000000 --- a/docs/reference/aes_auto.html +++ /dev/null @@ -1,90 +0,0 @@ - -Automatic aesthetic mapping — aes_auto • animint2 - Skip to contents - - -
-
-
- -
-

Automatic aesthetic mapping

-
- -
-

Usage

-
aes_auto(data = NULL, ...)
-
- -
-

Arguments

-
data
-

data.frame or names of variables

- - -
...
-

aesthetics that need to be explicitly mapped.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes_colour_fill_alpha-1.png b/docs/reference/aes_colour_fill_alpha-1.png deleted file mode 100644 index adf4e92b8..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-1.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-10.png b/docs/reference/aes_colour_fill_alpha-10.png deleted file mode 100644 index 0d37d81ee..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-10.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-11.png b/docs/reference/aes_colour_fill_alpha-11.png deleted file mode 100644 index 4b8f73db4..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-11.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-12.png b/docs/reference/aes_colour_fill_alpha-12.png deleted file mode 100644 index c58413798..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-12.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-13.png b/docs/reference/aes_colour_fill_alpha-13.png deleted file mode 100644 index b940dfdb1..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-13.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-14.png b/docs/reference/aes_colour_fill_alpha-14.png deleted file mode 100644 index bfd83f4b8..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-14.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-15.png b/docs/reference/aes_colour_fill_alpha-15.png deleted file mode 100644 index 77bb12fc7..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-15.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-16.png b/docs/reference/aes_colour_fill_alpha-16.png deleted file mode 100644 index 1d4e6c6f5..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-16.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-17.png b/docs/reference/aes_colour_fill_alpha-17.png deleted file mode 100644 index 77fa35ecb..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-17.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-2.png b/docs/reference/aes_colour_fill_alpha-2.png deleted file mode 100644 index 6b71de0c8..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-2.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-3.png b/docs/reference/aes_colour_fill_alpha-3.png deleted file mode 100644 index a1acdc2bc..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-3.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-4.png b/docs/reference/aes_colour_fill_alpha-4.png deleted file mode 100644 index 7cbc1a597..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-4.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-5.png b/docs/reference/aes_colour_fill_alpha-5.png deleted file mode 100644 index bbd1b99f9..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-5.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-6.png b/docs/reference/aes_colour_fill_alpha-6.png deleted file mode 100644 index f35eb7d3a..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-6.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-7.png b/docs/reference/aes_colour_fill_alpha-7.png deleted file mode 100644 index 4c5372a84..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-7.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-8.png b/docs/reference/aes_colour_fill_alpha-8.png deleted file mode 100644 index 77bb12fc7..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-8.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha-9.png b/docs/reference/aes_colour_fill_alpha-9.png deleted file mode 100644 index edf13a507..000000000 Binary files a/docs/reference/aes_colour_fill_alpha-9.png and /dev/null differ diff --git a/docs/reference/aes_colour_fill_alpha.html b/docs/reference/aes_colour_fill_alpha.html deleted file mode 100644 index f1bf37ec4..000000000 --- a/docs/reference/aes_colour_fill_alpha.html +++ /dev/null @@ -1,146 +0,0 @@ - -Colour related aesthetics: colour, fill and alpha — aes_colour_fill_alpha • animint2 - Skip to contents - - -
-
-
- -
-

This page demonstrates the usage of a sub-group -of aesthetics; colour, fill and alpha.

-
- - - -
-

Examples

-
# \donttest{
-
-# Bar chart example
-c <- ggplot(mtcars, aes(factor(cyl)))
-# Default plotting
-c + geom_bar()
-
-# To change the interior colouring use fill aesthetic
-c + geom_bar(fill = "red")
-
-# Compare with the colour aesthetic which changes just the bar outline
-c + geom_bar(colour = "red")
-
-# Combining both, you can see the changes more clearly
-c + geom_bar(fill = "white", colour = "red")
-
-
-# The aesthetic fill also takes different colouring scales
-# setting fill equal to a factor variable uses a discrete colour scale
-k <- ggplot(mtcars, aes(factor(cyl), fill = factor(vs)))
-k + geom_bar()
-
-
-# Fill aesthetic can also be used with a continuous variable
-m <- ggplot(faithfuld, aes(waiting, eruptions))
-m + geom_raster()
-
-m + geom_raster(aes(fill = density))
-
-
-# Some geoms don't use both aesthetics (i.e. geom_point or geom_line)
-b <- ggplot(economics, aes(x = date, y = unemploy))
-b + geom_line()
-
-b + geom_line(colour = "green")
-
-b + geom_point()
-
-b + geom_point(colour = "red")
-
-
-# For large datasets with overplotting the alpha
-# aesthetic will make the points more transparent
-df <- data.frame(x = rnorm(5000), y = rnorm(5000))
-h  <- ggplot(df, aes(x,y))
-h + geom_point()
-
-h + geom_point(alpha = 0.5)
-
-h + geom_point(alpha = 1/10)
-
-
-# Alpha can also be used to add shading
-j <- b + geom_line()
-j
-
-yrng <- range(economics$unemploy)
-j <- j + geom_rect(aes(NULL, NULL, xmin = start, xmax = end, fill = party),
-ymin = yrng[1], ymax = yrng[2], data = presidential)
-j
-
-j + scale_fill_manual(values = alpha(c("blue", "red"), .3))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes_linetype_size_shape-1.png b/docs/reference/aes_linetype_size_shape-1.png deleted file mode 100644 index 9a9d0f601..000000000 Binary files a/docs/reference/aes_linetype_size_shape-1.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-10.png b/docs/reference/aes_linetype_size_shape-10.png deleted file mode 100644 index 840b0de6b..000000000 Binary files a/docs/reference/aes_linetype_size_shape-10.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-11.png b/docs/reference/aes_linetype_size_shape-11.png deleted file mode 100644 index 15673fa81..000000000 Binary files a/docs/reference/aes_linetype_size_shape-11.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-12.png b/docs/reference/aes_linetype_size_shape-12.png deleted file mode 100644 index 17d2754df..000000000 Binary files a/docs/reference/aes_linetype_size_shape-12.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-13.png b/docs/reference/aes_linetype_size_shape-13.png deleted file mode 100644 index 054dcba47..000000000 Binary files a/docs/reference/aes_linetype_size_shape-13.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-14.png b/docs/reference/aes_linetype_size_shape-14.png deleted file mode 100644 index 1b28a11b4..000000000 Binary files a/docs/reference/aes_linetype_size_shape-14.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-15.png b/docs/reference/aes_linetype_size_shape-15.png deleted file mode 100644 index c632e80bb..000000000 Binary files a/docs/reference/aes_linetype_size_shape-15.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-16.png b/docs/reference/aes_linetype_size_shape-16.png deleted file mode 100644 index 919c4ca99..000000000 Binary files a/docs/reference/aes_linetype_size_shape-16.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-2.png b/docs/reference/aes_linetype_size_shape-2.png deleted file mode 100644 index 7c70eb617..000000000 Binary files a/docs/reference/aes_linetype_size_shape-2.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-3.png b/docs/reference/aes_linetype_size_shape-3.png deleted file mode 100644 index c3985c046..000000000 Binary files a/docs/reference/aes_linetype_size_shape-3.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-4.png b/docs/reference/aes_linetype_size_shape-4.png deleted file mode 100644 index 788b0d94e..000000000 Binary files a/docs/reference/aes_linetype_size_shape-4.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-5.png b/docs/reference/aes_linetype_size_shape-5.png deleted file mode 100644 index 03e092031..000000000 Binary files a/docs/reference/aes_linetype_size_shape-5.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-6.png b/docs/reference/aes_linetype_size_shape-6.png deleted file mode 100644 index 622873bf5..000000000 Binary files a/docs/reference/aes_linetype_size_shape-6.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-7.png b/docs/reference/aes_linetype_size_shape-7.png deleted file mode 100644 index 8da6ac6d3..000000000 Binary files a/docs/reference/aes_linetype_size_shape-7.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-8.png b/docs/reference/aes_linetype_size_shape-8.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/aes_linetype_size_shape-8.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape-9.png b/docs/reference/aes_linetype_size_shape-9.png deleted file mode 100644 index 7bc0f0101..000000000 Binary files a/docs/reference/aes_linetype_size_shape-9.png and /dev/null differ diff --git a/docs/reference/aes_linetype_size_shape.html b/docs/reference/aes_linetype_size_shape.html deleted file mode 100644 index 2fba9f8bc..000000000 --- a/docs/reference/aes_linetype_size_shape.html +++ /dev/null @@ -1,154 +0,0 @@ - -Differentiation related aesthetics: linetype, size, shape — aes_linetype_size_shape • animint2 - Skip to contents - - -
-
-
- -
-

This page demonstrates the usage of a sub-group -of aesthetics; linetype, size and shape.

-
- - - -
-

Examples

-

-# Line types should be specified with either an integer, a name, or with a string of
-# an even number (up to eight) of hexadecimal digits which give the lengths in
-# consecutive positions in the string.
-# 0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash
-
-# Data
-df <- data.frame(x = 1:10 , y = 1:10)
-f <- ggplot(df, aes(x, y))
-f + geom_line(linetype = 2)
-
-f + geom_line(linetype = "dotdash")
-
-
-# An example with hex strings, the string "33" specifies three units on followed
-# by three off and "3313" specifies three units on followed by three off followed
-# by one on and finally three off.
-f + geom_line(linetype = "3313")
-
-
-# Mapping line type from a variable
-ggplot(economics_long, aes(date, value01)) +
-  geom_line(aes(linetype = variable))
-
-
-# Size examples
-# Should be specified with a numerical value (in millimetres),
-# or from a variable source
-p <- ggplot(mtcars, aes(wt, mpg))
-p + geom_point(size = 4)
-
-p + geom_point(aes(size = qsec))
-
-p + geom_point(size = 2.5) +
-  geom_hline(yintercept = 25, size = 3.5)
-
-
-# Shape examples
-# Shape takes four types of values: an integer in [0, 25],
-# a single character-- which uses that character as the plotting symbol,
-# a . to draw the smallest rectangle that is visible (i.e., about one pixel)
-# an NA to draw nothing
-p + geom_point()
-
-p + geom_point(shape = 5)
-
-p + geom_point(shape = "k", size = 3)
-
-p + geom_point(shape = ".")
-
-p + geom_point(shape = NA)
-#> Warning: Removed 32 rows containing missing values (geom_point).
-
-
-# Shape can also be mapped from a variable
-p + geom_point(aes(shape = factor(cyl)))
-
-
-# A look at all 25 symbols
-df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25)
-s <- ggplot(df2, aes(x, y))
-s + geom_point(aes(shape = z), size = 4) +
-  scale_shape_identity()
-
-# While all symbols have a foreground colour, symbols 19-25 also take a
-# background colour (fill)
-s + geom_point(aes(shape = z), size = 4, colour = "Red") +
-  scale_shape_identity()
-
-s + geom_point(aes(shape = z), size = 4, colour = "Red", fill = "Black") +
-  scale_shape_identity()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/aes_position-1.png b/docs/reference/aes_position-1.png deleted file mode 100644 index e737475ff..000000000 Binary files a/docs/reference/aes_position-1.png and /dev/null differ diff --git a/docs/reference/aes_position-2.png b/docs/reference/aes_position-2.png deleted file mode 100644 index 781fb8399..000000000 Binary files a/docs/reference/aes_position-2.png and /dev/null differ diff --git a/docs/reference/aes_position-3.png b/docs/reference/aes_position-3.png deleted file mode 100644 index bf958b5fe..000000000 Binary files a/docs/reference/aes_position-3.png and /dev/null differ diff --git a/docs/reference/aes_position-4.png b/docs/reference/aes_position-4.png deleted file mode 100644 index 39898d7b6..000000000 Binary files a/docs/reference/aes_position-4.png and /dev/null differ diff --git a/docs/reference/aes_position-5.png b/docs/reference/aes_position-5.png deleted file mode 100644 index d23ba8f6b..000000000 Binary files a/docs/reference/aes_position-5.png and /dev/null differ diff --git a/docs/reference/aes_position-6.png b/docs/reference/aes_position-6.png deleted file mode 100644 index ac6fff3d4..000000000 Binary files a/docs/reference/aes_position-6.png and /dev/null differ diff --git a/docs/reference/aes_position-7.png b/docs/reference/aes_position-7.png deleted file mode 100644 index ce4d1564f..000000000 Binary files a/docs/reference/aes_position-7.png and /dev/null differ diff --git a/docs/reference/aes_position.html b/docs/reference/aes_position.html deleted file mode 100644 index 9d6459685..000000000 --- a/docs/reference/aes_position.html +++ /dev/null @@ -1,119 +0,0 @@ - -Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend — aes_position • animint2 - Skip to contents - - -
-
-
- -
-

This page demonstrates the usage of a sub-group -of aesthetics; x, y, xmin, xmax, ymin, ymax, xend, and yend.

-
- - - -
-

Examples

-

-# Generate data: means and standard errors of means for prices
-# for each type of cut
-dmod <- lm(price ~ cut, data = diamonds)
-cuts <- data.frame(cut = unique(diamonds$cut), predict(dmod, data.frame(cut =
-unique(diamonds$cut)), se = TRUE)[c("fit", "se.fit")])
-se <- ggplot(cuts, aes(x = cut, y = fit, ymin = fit - se.fit,
-ymax = fit + se.fit, colour = cut))
-se + geom_pointrange()
-
-
-# Using annotate
-p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
-p + annotate("rect", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25,
-  fill = "dark grey", alpha = .5)
-
-
-# Geom_segment examples
-p + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25),
-  arrow = arrow(length = unit(0.5, "cm")))
-
-p + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15),
-  arrow = arrow(length = unit(0.5, "cm")))
-
-p + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25),
-  arrow = arrow(length = unit(0.5, "cm")))
-
-
-# You can also use geom_segment to recreate plot(type = "h") :
-counts <- as.data.frame(table(x = rpois(100, 5)))
-counts$x <- as.numeric(as.character(counts$x))
-with(counts, plot(x, Freq, type = "h", lwd = 10))
-
-
-ggplot(counts, aes(x, Freq)) +
-  geom_segment(aes(yend = 0, xend = x), size = 10)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/animint.html b/docs/reference/animint.html deleted file mode 100644 index 494db80dc..000000000 --- a/docs/reference/animint.html +++ /dev/null @@ -1,169 +0,0 @@ - -Create an animint — animint • animint2 - Skip to contents - - -
-
-
- -
-

Create an animated, interactive data visualization. The easiest -way to get started is by reading the Animint2 Manual, -https://rcdata.nau.edu/genomic-ml/animint2-manual/Ch02-ggplot2.html

-
- -
-

Usage

-
animint(...)
-
- -
-

Arguments

-
...
-

ggplots and options

- -
-
-

Value

- - -

list of class animint

-
-
-

Details

-

This function creates a list with the items in ... and - attaches the animint class. It also provides default names for - un-named ggplots. The list should contain ggplots and - options. Each geom can be made interactive by using the - showSelected and clickSelects parameters; each should be a - character vector of selection variable names. For example - geom_line(clickSelects="country") means that clicking the line - changes the value of the "country" selection variable; - geom_point(showSelected="year") means to only show the subset of - data for the currently selected year.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
-

Examples

-
if(require('data.table'))setDTthreads(1)#for CRAN.
-#> Loading required package: data.table
-library(animint2)
-data(WorldBank, package="animint2")
-years <- unique(WorldBank[, "year", drop=FALSE])
-y1960 <- subset(WorldBank, year==1960)
-animint(
-  title="Linked scatterplot and time series", #web page title.
-  time=list(variable="year",ms=3000), #variable and time delay used for animation.
-  duration=list(year=1000), #smooth transition duration in milliseconds.
-  selector.types=list(country="multiple"), #single/multiple selection for each variable.
-  first=list( #selected values to show when viz is first rendered.
-    country=c("Canada", "Japan"),
-    year=1970),
-  ## ggplots are rendered together for an interactive data viz.
-  ts=ggplot()+
-    theme_animint(width=500)+
-    make_tallrect(WorldBank, "year")+
-    geom_text(aes(
-      year, life.expectancy, label=country),
-      showSelected="country",
-      clickSelects="country",
-      hjust=1,
-      data=y1960)+
-    scale_x_continuous(limits=c(1950, NA))+
-    geom_line(aes(
-      year, life.expectancy, group=country, color=region),
-      clickSelects="country",
-      data=WorldBank,
-      size=4,
-      alpha=0.55),
-  scatter=ggplot()+
-    geom_point(aes(
-      fertility.rate, life.expectancy,
-      key=country, colour=region, size=population),
-      showSelected="year",
-      clickSelects="country",
-      data=WorldBank)+
-    geom_text(aes(
-      fertility.rate, life.expectancy,
-      key=country,
-      label=country),
-      showSelected=c("country", "year"),
-      data=WorldBank)+
-    geom_text(aes(
-      5, 80, key=1, label=paste("year =", year)),
-      showSelected="year",
-      data=years)+
-    scale_size_animint(pixel.range=c(2,20), breaks=10^(4:9)))
-#> Saving animint in temporary directory; specify output directory using animint(out.dir="path/to/directory")
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/animint2-gganimintproto.html b/docs/reference/animint2-gganimintproto.html deleted file mode 100644 index ef61cfb10..000000000 --- a/docs/reference/animint2-gganimintproto.html +++ /dev/null @@ -1,253 +0,0 @@ - -Base gganimintproto classes for ggplot2 — animint2-gganimintproto • animint2 - Skip to contents - - -
-
-
- -
-

If you are creating a new geom, stat, position, or scale in another package, -you'll need to extend from animint2::Geom, animint2::Stat, -animint2::Position, or animint2::Scale.

-
- -
-

Usage

-
a_scales_list()
-
-ScalesList
-
- -
-

Format

-

An object of class ScalesList (inherits from gganimintproto) of length 9.

-
-
-

Geoms

- - - -

All geom_* functions (like geom_point) return a layer that -contains a Geom* object (like GeomPoint). The Geom* -object is responsible for rendering the data in the plot.

-

Each of the Geom* objects is a gganimintproto object, descended -from the top-level Geom, and each implements various methods and -fields. To create a new type of Geom object, you typically will want to -implement one or more of the following:

-

Compared to Stat and Position, Geom is a little -different because the execution of the setup and compute functions is -split up. setup_data runs before position adjustments, and -draw_layer is not run until render time, much later. This -means there is no setup_params because it's hard to communicate -the changes.

-
  • Override either draw_panel(self, data, panel_scales, coord) or - draw_group(self, data, panel_scales, coord). draw_panel is - called once per panel, draw_group is called once per group.

    -

    Use draw_panel if each row in the data represents a - single element. Use draw_group if each group represents - an element (e.g. a smooth, a violin).

    -

    data is a data frame of scaled aesthetics. panel_scales - is a list containing information about the scales in the current - panel. coord is a coordinate specification. You'll - need to call coord$transform(data, panel_scales) to work - with non-Cartesian coords. To work with non-linear coordinate systems, - you typically need to convert into a primitive geom (e.g. point, path - or polygon), and then pass on to the corresponding draw method - for munching.

    -

    Must return a grob. Use zeroGrob if there's nothing to - draw.

  • -
  • draw_key: Renders a single legend key.

  • -
  • required_aes: A character vector of aesthetics needed to - render the geom.

  • -
  • default_aes: A list (generated by aes() of - default values for aesthetics.

  • -
  • reparameterise: Converts width and height to xmin and xmax, - and ymin and ymax values. It can potentially set other values as well.

  • -
-
-

Coordinate systems

- - - -

All coord_* functions (like coord_trans) return a Coord* -object (like CoordTrans). The Coord* object is responsible for -adjusting the position of overlapping geoms.

-

The way that the coord_* functions work is slightly different from the -geom_* and stat_* functions, because a coord_* function -actually "instantiates" the Coord* object by creating a descendant, -and returns that.

-

Each of the Coord* objects is a gganimintproto object, -descended from the top-level Coord. To create a new type of Coord -object, you typically will want to implement one or more of the following:

-
  • aspect: Returns the desired aspect ratio for the plot.

  • -
  • labels: Returns a list containing labels for x and y.

  • -
  • render_fg: Renders foreground elements.

  • -
  • render_bg: Renders background elements.

  • -
  • render_axis_h: Renders the horizontal axis.

  • -
  • render_axis_v: Renders the vertical axis.

  • -
  • range: Returns the x and y ranges

  • -
  • train: Return the trained scale ranges.

  • -
  • transform: Transforms x and y coordinates.

  • -
  • distance: Calculates distance.

  • -
  • is_linear: Returns TRUE if the coordinate system is - linear; FALSE otherwise.

  • -
-
-

Stats

- - - -

All stat_* functions (like stat_bin) return a layer that -contains a Stat* object (like StatBin). The Stat* -object is responsible for rendering the data in the plot.

-

Each of the Stat* objects is a gganimintproto object, descended -from the top-level Stat, and each implements various methods and -fields. To create a new type of Stat object, you typically will want to -implement one or more of the following:

-
  • Override one of : - compute_layer(self, data, scales, ...), - compute_panel(self, data, scales, ...), or - compute_group(self, data, scales, ...).

    -

    compute_layer() is called once per layer, compute_panel_() - is called once per panel, and compute_group() is called once per - group. All must return a data frame.

    -

    It's usually best to start by overriding compute_group: if - you find substantial performance optimisations, override higher up. - You'll need to read the source code of the default methods to see - what else you should be doing.

    -

    data is a data frame containing the variables named according - to the aesthetics that they're mapped to. scales is a list - containing the x and y scales. There functions are called - before the facets are trained, so they are global scales, not local - to the individual panels.... contains the parameters returned by - setup_params().

  • -
  • setup_params(data, params): called once for each layer. - Used to setup defaults that need to complete dataset, and to inform - the user of important choices. Should return list of parameters.

  • -
  • setup_data(data, params): called once for each layer, - after setp_params(). Should return modified data. - Default methods removes all rows containing a missing value in - required aesthetics (with a warning if !na.rm).

  • -
  • required_aes: A character vector of aesthetics needed to - render the geom.

  • -
  • default_aes: A list (generated by aes() of - default values for aesthetics.

  • -
-
-

Positions

- - - -

All position_* functions (like position_dodge) return a -Position* object (like PositionDodge). The Position* -object is responsible for adjusting the position of overlapping geoms.

-

The way that the position_* functions work is slightly different from -the geom_* and stat_* functions, because a position_* -function actually "instantiates" the Position* object by creating a -descendant, and returns that.

-

Each of the Position* objects is a gganimintproto object, -descended from the top-level Position, and each implements the -following methods:

-
  • compute_layer(self, data, params, panel) is called once - per layer. panel is currently an internal data structure, so - this method should not be overriden.

  • -
  • compute_panel(self, data, params, panel) is called once per - panel and should return a modified data frame.

    -

    data is a data frame containing the variables named according - to the aesthetics that they're mapped to. scales is a list - containing the x and y scales. There functions are called - before the facets are trained, so they are global scales, not local - to the individual panels. params contains the parameters returned by - setup_params().

  • -
  • setup_params(data, params): called once for each layer. - Used to setup defaults that need to complete dataset, and to inform - the user of important choices. Should return list of parameters.

  • -
  • setup_data(data, params): called once for each layer, - after setp_params(). Should return modified data. - Default checks that required aesthetics are present.

  • -

And the following fields

  • required_aes: a character vector giving the aesthetics - that must be present for this position adjustment to work.

  • -
-
-

Scales

- - - -

All scale_* functions (like scale_x_continuous) return a -Scale* object (like ScaleContinuous). The Scale* -object represents a single scale.

-

Each of the Scale* objects is a gganimintproto object, -descended from the top-level Scale.

-
-
-

See also

-

gganimintproto

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/animint2dir.html b/docs/reference/animint2dir.html deleted file mode 100644 index 9a17b3a06..000000000 --- a/docs/reference/animint2dir.html +++ /dev/null @@ -1,198 +0,0 @@ - -Compile and render an animint in a local directory. — animint2dir • animint2 - Skip to contents - - -
-
-
- -
-

This function converts an animint plot.list into a directory of -files which can be used to render the interactive data -visualization in a web browser.

-
- -
-

Usage

-
animint2dir(
-  plot.list,
-  out.dir = NULL,
-  json.file = "plot.json",
-  open.browser = interactive(),
-  css.file = ""
-)
-
- -
-

Arguments

-
plot.list
-

a named list of ggplots and option lists.

- - -
out.dir
-

directory to store html/js/csv files. If it exists -already, it will be removed before writing the new -directory/files.

- - -
json.file
-

character string that names the JSON file with -metadata associated with the plot.

- - -
open.browser
-

Should R open a browser? If yes, be sure to -configure your browser to allow access to local files, as some -browsers block this by default (e.g. chrome).

- - -
css.file
-

character string for non-empty css file to -include. Provided file will be copied to the output directory as -styles.css

- -
-
-

Value

- - -

invisible list of ggplots in list format.

-
- -
-

Examples

-
if(require('data.table'))setDTthreads(1)#for CRAN.
-
-## Make a Gapminder plot (aka Google motion chart), which is actually
-## just a scatterplot with size and color that moves over time.
-library(animint2)
-data(WorldBank)
-gapminder <- list(
-  title="Linked scatterplot and time series",
-  ts=ggplot()+
-    make_tallrect(WorldBank, "year")+
-    geom_line(aes(year, life.expectancy, group=country, color=region),
-              clickSelects="country",
-              data=WorldBank, size=4, alpha=3/5),
-  time=list(variable="year",ms=3000),
-  duration=list(year=1000),
-  scatter=ggplot()+
-    geom_point(aes(fertility.rate, life.expectancy,
-                   key=country, colour=region, size=population),
-               showSelected="year",
-               clickSelects="country",
-               data=WorldBank)+
-    geom_text(aes(fertility.rate, life.expectancy, label=country),
-              showSelected=c("country", "year"),
-              data=WorldBank)+
-    make_text(WorldBank, 5, 80, "year")+
-    scale_size_animint(pixel.range=c(2,20), breaks=10^(4:9)))
-animint2dir(gapminder)
-#> Warning: to ensure that smooth transitions are interpretable, aes(key) should be specifed for geoms with showSelected=year, problem: geom4_text_scatter
-
-data(worldPop)
-## Linked bar and line plots of world population by subcontinent,
-## inspired by polychartjs.
-popPlots <- list(
-  bars=ggplot()+
-    geom_bar(aes(x=subcontinent, y=population),
-             clickSelects="subcontinent",
-             showSelected="year",
-             data=worldPop, stat="identity", position="identity")+
-    ## This make_text creates a geom_text that shows the current
-    ## selected value of the year variable.
-    make_text(worldPop, 1, 3e6, "year")+
-    coord_flip(),
-  lines=ggplot()+
-    ## This make_tallrect tiles the background of the lineplot with
-    ## rects that can be clicked to select the year variable.
-    make_tallrect(worldPop, "year")+
-    ## This geom_point does not have aes(clickSelects) so its alpha
-    ## transparency behaves normally: all points have alpha=1/4.
-    geom_point(aes(year, population, colour=type),
-               data=worldPop, size=4, alpha=1/4)+
-    ## This geom_line DOES have aes(clickSelects) so only the
-    ## selected line has the specified alpha=3/4. The other
-    ## unselected lines have 0.5 less (alpha=1/4).
-    geom_line(aes(year, population, group=subcontinent),
-              clickSelects="subcontinent",
-              data=worldPop, size=4, alpha=3/4))
-animint2dir(popPlots)
-## Make it animated by specifying year as the variable to animate and
-## an interval of 2000 milliseconds between animation frames.
-popAnim <- c(popPlots, list(time=list(variable="year",ms=2000)))
-animint2dir(popAnim)
-## Make the animation smooth by specifying a duration of 1000 ms for
-## geoms with aes(showSelected=year).
-popSmooth <- c(popAnim, list(duration=list(year=1000)))
-animint2dir(popSmooth)
-#> Warning: to ensure that smooth transitions are interpretable, aes(key) should be specifed for geoms with showSelected=year, problem: geom1_bar_bars
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/animint2gist.html b/docs/reference/animint2gist.html deleted file mode 100644 index 291dba064..000000000 --- a/docs/reference/animint2gist.html +++ /dev/null @@ -1,114 +0,0 @@ - -Convert a list of ggplots to an interactive animation and post files as a gist — animint2gist • animint2 - Skip to contents - - -
-
-
- -
-

Before using this function set your appropriate 'github.username' and 'github.password' options

-
- -
-

Usage

-
animint2gist(plot.list, description = plot.list$title, browse = TRUE, ...)
-
- -
-

Arguments

-
plot.list
-

a named list of ggplots and option lists.

- - -
description
-

Brief description of gist. -This becomes the plot title on the bl.ocks/username page.

- - -
browse
-

logical. Prompt browser to view viz on bl.ocks.org

- - -
...
-

options passed onto animint2dir and gistr::gist_create

- -
- -
-

Examples

-
if (FALSE) {
-library(animint)
-iris$id <- 1:nrow(iris)
-viz <- list(petal=ggplot()+
-         geom_point(aes(Petal.Width, Petal.Length, fill=Species,
-                        clickSelects=id), data=iris),
-       sepal=ggplot()+
-         geom_point(aes(Sepal.Width, Sepal.Length, fill=Species,
-                        clickSelects=id), data=iris))
-animint2gist(viz, description = "My animint plot")
-}
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/animintOutput.html b/docs/reference/animintOutput.html deleted file mode 100644 index 55ac67efc..000000000 --- a/docs/reference/animintOutput.html +++ /dev/null @@ -1,90 +0,0 @@ - -Shiny ui output function — animintOutput • animint2 - Skip to contents - - -
-
-
- -
-

Shiny ui output function

-
- -
-

Usage

-
animintOutput(outputId)
-
- -
-

Arguments

-
outputId
-

output variable to read the plot from

- -
-
-

See also

-

http://shiny.rstudio.com/articles/building-outputs.html

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/annotate-1.png b/docs/reference/annotate-1.png deleted file mode 100644 index 528c4a289..000000000 Binary files a/docs/reference/annotate-1.png and /dev/null differ diff --git a/docs/reference/annotate-2.png b/docs/reference/annotate-2.png deleted file mode 100644 index dc31f3042..000000000 Binary files a/docs/reference/annotate-2.png and /dev/null differ diff --git a/docs/reference/annotate-3.png b/docs/reference/annotate-3.png deleted file mode 100644 index f5a9a910a..000000000 Binary files a/docs/reference/annotate-3.png and /dev/null differ diff --git a/docs/reference/annotate-4.png b/docs/reference/annotate-4.png deleted file mode 100644 index 051408f73..000000000 Binary files a/docs/reference/annotate-4.png and /dev/null differ diff --git a/docs/reference/annotate-5.png b/docs/reference/annotate-5.png deleted file mode 100644 index c777be89a..000000000 Binary files a/docs/reference/annotate-5.png and /dev/null differ diff --git a/docs/reference/annotate-6.png b/docs/reference/annotate-6.png deleted file mode 100644 index 22e8516a5..000000000 Binary files a/docs/reference/annotate-6.png and /dev/null differ diff --git a/docs/reference/annotate.html b/docs/reference/annotate.html deleted file mode 100644 index 661a63722..000000000 --- a/docs/reference/annotate.html +++ /dev/null @@ -1,155 +0,0 @@ - -Create an annotation layer. — annotate • animint2 - Skip to contents - - -
-
-
- -
-

This function adds geoms to a plot. Unlike typical a geom function, -the properties of the geoms are not mapped from variables of a data frame, -but are instead passed in as vectors. This is useful for adding small annotations -(such as text labels) or if you have your data in vectors, and for some -reason don't want to put them in a data frame.

-
- -
-

Usage

-
annotate(
-  geom,
-  x = NULL,
-  y = NULL,
-  xmin = NULL,
-  xmax = NULL,
-  ymin = NULL,
-  ymax = NULL,
-  xend = NULL,
-  yend = NULL,
-  ...,
-  na.rm = FALSE
-)
-
- -
-

Arguments

-
geom
-

name of geom to use for annotation

- - -
x, y, xmin, ymin, xmax, ymax, xend, yend
-

positioning aesthetics - -you must specify at least one of these.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- -
-
-

Details

-

Note that all position aesthetics are scaled (i.e. they will expand the -limits of the plot so they are visible), but all other aesthetics are -set. This means that layers created with this function will never -affect the legend.

-
- -
-

Examples

-
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
-p + annotate("text", x = 4, y = 25, label = "Some text")
-
-p + annotate("text", x = 2:5, y = 25, label = "Some text")
-
-p + annotate("rect", xmin = 3, xmax = 4.2, ymin = 12, ymax = 21,
-  alpha = .2)
-
-p + annotate("segment", x = 2.5, xend = 4, y = 15, yend = 25,
-  colour = "blue")
-
-p + annotate("pointrange", x = 3.5, y = 20, ymin = 12, ymax = 28,
-  colour = "red", size = 1.5)
-
-
-p + annotate("text", x = 2:3, y = 20:21, label = c("my label", "label 2"))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/annotation_custom-1.png b/docs/reference/annotation_custom-1.png deleted file mode 100644 index c666869a7..000000000 Binary files a/docs/reference/annotation_custom-1.png and /dev/null differ diff --git a/docs/reference/annotation_custom-2.png b/docs/reference/annotation_custom-2.png deleted file mode 100644 index 932ece0b1..000000000 Binary files a/docs/reference/annotation_custom-2.png and /dev/null differ diff --git a/docs/reference/annotation_custom.html b/docs/reference/annotation_custom.html deleted file mode 100644 index 4e4cd4a44..000000000 --- a/docs/reference/annotation_custom.html +++ /dev/null @@ -1,141 +0,0 @@ - -Annotation: Custom grob. — annotation_custom • animint2 - Skip to contents - - -
-
-
- -
-

This is a special geom intended for use as static annotations -that are the same in every panel. These annotations will not -affect scales (i.e. the x and y axes will not grow to cover the range -of the grob, and the grob will not be modified by any ggplot settings or mappings).

-
- -
-

Usage

-
annotation_custom(grob, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
-
- -
-

Arguments

-
grob
-

grob to display

- - -
xmin, xmax
-

x location (in data coordinates) giving horizontal -location of raster

- - -
ymin, ymax
-

y location (in data coordinates) giving vertical -location of raster

- -
-
-

Details

-

Most useful for adding tables, inset plots, and other grid-based decorations.

-
-
-

Note

-

annotation_custom expects the grob to fill the entire viewport -defined by xmin, xmax, ymin, ymax. Grobs with a different (absolute) size -will be center-justified in that region. -Inf values can be used to fill the full plot panel (see examples).

-
- -
-

Examples

-
# Dummy plot
-df <- data.frame(x = 1:10, y = 1:10)
-base <- ggplot(df, aes(x, y)) +
-  geom_blank() +
-  theme_bw()
-
-# Full panel annotation
-base + annotation_custom(
-  grob = grid::roundrectGrob(),
-  xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf
-)
-
-
-# Inset plot
-df2 <- data.frame(x = 1 , y = 1)
-g <- ggplotGrob(ggplot(df2, aes(x, y)) +
-  geom_point() +
-  theme(plot.background = element_rect(colour = "black")))
-base +
-  annotation_custom(grob = g, xmin = 1, xmax = 10, ymin = 8, ymax = 10)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/annotation_logticks-1.png b/docs/reference/annotation_logticks-1.png deleted file mode 100644 index 23749967b..000000000 Binary files a/docs/reference/annotation_logticks-1.png and /dev/null differ diff --git a/docs/reference/annotation_logticks-2.png b/docs/reference/annotation_logticks-2.png deleted file mode 100644 index f13a38be8..000000000 Binary files a/docs/reference/annotation_logticks-2.png and /dev/null differ diff --git a/docs/reference/annotation_logticks-3.png b/docs/reference/annotation_logticks-3.png deleted file mode 100644 index 7320a59d9..000000000 Binary files a/docs/reference/annotation_logticks-3.png and /dev/null differ diff --git a/docs/reference/annotation_logticks-4.png b/docs/reference/annotation_logticks-4.png deleted file mode 100644 index edb2d8529..000000000 Binary files a/docs/reference/annotation_logticks-4.png and /dev/null differ diff --git a/docs/reference/annotation_logticks-5.png b/docs/reference/annotation_logticks-5.png deleted file mode 100644 index b05fe99c2..000000000 Binary files a/docs/reference/annotation_logticks-5.png and /dev/null differ diff --git a/docs/reference/annotation_logticks-6.png b/docs/reference/annotation_logticks-6.png deleted file mode 100644 index 4cd331a3a..000000000 Binary files a/docs/reference/annotation_logticks-6.png and /dev/null differ diff --git a/docs/reference/annotation_logticks-7.png b/docs/reference/annotation_logticks-7.png deleted file mode 100644 index 2bbc73808..000000000 Binary files a/docs/reference/annotation_logticks-7.png and /dev/null differ diff --git a/docs/reference/annotation_logticks.html b/docs/reference/annotation_logticks.html deleted file mode 100644 index 5c222a760..000000000 --- a/docs/reference/annotation_logticks.html +++ /dev/null @@ -1,215 +0,0 @@ - -Annotation: log tick marks — annotation_logticks • animint2 - Skip to contents - - -
-
-
- -
-

This annotation adds log tick marks with diminishing spacing. -These tick marks probably make sense only for base 10.

-
- -
-

Usage

-
annotation_logticks(
-  base = 10,
-  sides = "bl",
-  scaled = TRUE,
-  short = unit(0.1, "cm"),
-  mid = unit(0.2, "cm"),
-  long = unit(0.3, "cm"),
-  colour = "black",
-  size = 0.5,
-  linetype = 1,
-  alpha = 1,
-  color = NULL,
-  ...
-)
-
- -
-

Arguments

-
base
-

the base of the log (default 10)

- - -
sides
-

a string that controls which sides of the plot the log ticks appear on. -It can be set to a string containing any of "trbl", for top, right, -bottom, and left.

- - -
scaled
-

is the data already log-scaled? This should be TRUE -(default) when the data is already transformed with log10() or when -using scale_y_log10. It should be FALSE when using -coord_trans(y = "log10").

- - -
short
-

a unit object specifying the length of the -short tick marks

- - -
mid
-

a unit object specifying the length of the -middle tick marks. In base 10, these are the "5" ticks.

- - -
long
-

a unit object specifying the length of the -long tick marks. In base 10, these are the "1" (or "10") ticks.

- - -
colour
-

Colour of the tick marks.

- - -
size
-

Thickness of tick marks, in mm.

- - -
linetype
-

Linetype of tick marks (solid, dashed, etc.)

- - -
alpha
-

The transparency of the tick marks.

- - -
color
-

An alias for colour.

- - -
...
-

Other parameters passed on to the layer

- -
-
-

See also

-

scale_y_continuous, scale_y_log10 for log scale - transformations.

-

coord_trans for log coordinate transformations.

-
- -
-

Examples

-
# Make a log-log plot (without log ticks)
-a <- ggplot(msleep, aes(bodywt, brainwt)) +
- geom_point(na.rm = TRUE) +
- scale_x_log10(
-   breaks = scales::trans_breaks("log10", function(x) 10^x),
-   labels = scales::trans_format("log10", scales::math_format(10^.x))
- ) +
- scale_y_log10(
-   breaks = scales::trans_breaks("log10", function(x) 10^x),
-   labels = scales::trans_format("log10", scales::math_format(10^.x))
- ) +
- theme_bw()
-
-a + annotation_logticks()                # Default: log ticks on bottom and left
-
-a + annotation_logticks(sides = "lr")    # Log ticks for y, on left and right
-
-a + annotation_logticks(sides = "trbl")  # All four sides
-
-
-# Hide the minor grid lines because they don't align with the ticks
-a + annotation_logticks(sides = "trbl") + theme(panel.grid.minor = element_blank())
-
-
-# Another way to get the same results as 'a' above: log-transform the data before
-# plotting it. Also hide the minor grid lines.
-b <- ggplot(msleep, aes(log10(bodywt), log10(brainwt))) +
- geom_point(na.rm = TRUE) +
- scale_x_continuous(name = "body", labels = scales::math_format(10^.x)) +
- scale_y_continuous(name = "brain", labels = scales::math_format(10^.x)) +
- theme_bw() + theme(panel.grid.minor = element_blank())
-
-b + annotation_logticks()
-
-
-# Using a coordinate transform requires scaled = FALSE
-t <- ggplot(msleep, aes(bodywt, brainwt)) +
-  geom_point() +
-  coord_trans(x = "log10", y = "log10") +
-  theme_bw()
-t + annotation_logticks(scaled = FALSE)
-#> Warning: Removed 27 rows containing missing values (geom_point).
-
-
-# Change the length of the ticks
-a + annotation_logticks(
-  short = unit(.5,"mm"),
-  mid = unit(3,"mm"),
-  long = unit(4,"mm")
-)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/annotation_map-1.png b/docs/reference/annotation_map-1.png deleted file mode 100644 index 8611b5b5e..000000000 Binary files a/docs/reference/annotation_map-1.png and /dev/null differ diff --git a/docs/reference/annotation_map.html b/docs/reference/annotation_map.html deleted file mode 100644 index 0e36a4968..000000000 --- a/docs/reference/annotation_map.html +++ /dev/null @@ -1,114 +0,0 @@ - -Annotation: maps. — annotation_map • animint2 - Skip to contents - - -
-
-
- -
-

Annotation: maps.

-
- -
-

Usage

-
annotation_map(map, ...)
-
- -
-

Arguments

-
map
-

data frame representing a map. Most map objects can be -converted into the right format by using fortify

- - -
...
-

other arguments used to modify aesthetics

- -
- -
-

Examples

-
if (require("maps")) {
-usamap <- map_data("state")
-
-seal.sub <- subset(seals, long > -130 & lat < 45 & lat > 40)
-ggplot(seal.sub, aes(x = long, y = lat)) +
-  annotation_map(usamap, fill = "NA", colour = "grey50") +
-  geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat))
-
-seal2 <- transform(seal.sub,
-  latr = cut(lat, 2),
-  longr = cut(long, 2))
-
-ggplot(seal2,  aes(x = long, y = lat)) +
-  annotation_map(usamap, fill = "NA", colour = "grey50") +
-  geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat)) +
-  facet_grid(latr ~ longr, scales = "free", space = "free")
-}
-#> Loading required package: maps
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/annotation_raster-1.png b/docs/reference/annotation_raster-1.png deleted file mode 100644 index 8e2e46833..000000000 Binary files a/docs/reference/annotation_raster-1.png and /dev/null differ diff --git a/docs/reference/annotation_raster-2.png b/docs/reference/annotation_raster-2.png deleted file mode 100644 index 9cffb0275..000000000 Binary files a/docs/reference/annotation_raster-2.png and /dev/null differ diff --git a/docs/reference/annotation_raster-3.png b/docs/reference/annotation_raster-3.png deleted file mode 100644 index 4280bfe54..000000000 Binary files a/docs/reference/annotation_raster-3.png and /dev/null differ diff --git a/docs/reference/annotation_raster-4.png b/docs/reference/annotation_raster-4.png deleted file mode 100644 index 8c640d680..000000000 Binary files a/docs/reference/annotation_raster-4.png and /dev/null differ diff --git a/docs/reference/annotation_raster.html b/docs/reference/annotation_raster.html deleted file mode 100644 index 253d00d60..000000000 --- a/docs/reference/annotation_raster.html +++ /dev/null @@ -1,140 +0,0 @@ - -Annotation: High-performance rectangular tiling. — annotation_raster • animint2 - Skip to contents - - -
-
-
- -
-

This is a special version of geom_raster optimised for static -annotations that are the same in every panel. These annotations will not -affect scales (i.e. the x and y axes will not grow to cover the range -of the raster, and the raster must already have its own colours).

-
- -
-

Usage

-
annotation_raster(raster, xmin, xmax, ymin, ymax, interpolate = FALSE)
-
- -
-

Arguments

-
raster
-

raster object to display

- - -
xmin, xmax
-

x location (in data coordinates) giving horizontal -location of raster

- - -
ymin, ymax
-

y location (in data coordinates) giving vertical -location of raster

- - -
interpolate
-

If TRUE interpolate linearly, if FALSE -(the default) don't interpolate.

- -
-
-

Details

-

Most useful for adding bitmap images.

-
- -
-

Examples

-
# Generate data
-rainbow <- matrix(hcl(seq(0, 360, length.out = 50 * 50), 80, 70), nrow = 50)
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point() +
-  annotation_raster(rainbow, 15, 20, 3, 4)
-
-# To fill up whole plot
-ggplot(mtcars, aes(mpg, wt)) +
-  annotation_raster(rainbow, -Inf, Inf, -Inf, Inf) +
-  geom_point()
-
-
-rainbow2 <- matrix(hcl(seq(0, 360, length.out = 10), 80, 70), nrow = 1)
-ggplot(mtcars, aes(mpg, wt)) +
-  annotation_raster(rainbow2, -Inf, Inf, -Inf, Inf) +
-  geom_point()
-
-rainbow2 <- matrix(hcl(seq(0, 360, length.out = 10), 80, 70), nrow = 1)
-ggplot(mtcars, aes(mpg, wt)) +
-  annotation_raster(rainbow2, -Inf, Inf, -Inf, Inf, interpolate = TRUE) +
-  geom_point()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/as.list.gganimintproto.html b/docs/reference/as.list.gganimintproto.html deleted file mode 100644 index e8ec5da5d..000000000 --- a/docs/reference/as.list.gganimintproto.html +++ /dev/null @@ -1,96 +0,0 @@ - -Convert a gganimintproto object to a list — as.list.gganimintproto • animint2 - Skip to contents - - -
-
-
- -
-

This will not include the object's super member.

-
- -
-

Usage

-
# S3 method for gganimintproto
-as.list(x, inherit = TRUE, ...)
-
- -
-

Arguments

-
x
-

A gganimintproto object to convert to a list.

- - -
inherit
-

If TRUE (the default), flatten all inherited items into -the returned list. If FALSE, do not include any inherited items.

- - -
...
-

Further arguments to pass to as.list.environment.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/as_labeller-1.png b/docs/reference/as_labeller-1.png deleted file mode 100644 index c3d43cacc..000000000 Binary files a/docs/reference/as_labeller-1.png and /dev/null differ diff --git a/docs/reference/as_labeller-2.png b/docs/reference/as_labeller-2.png deleted file mode 100644 index e0b29a11b..000000000 Binary files a/docs/reference/as_labeller-2.png and /dev/null differ diff --git a/docs/reference/as_labeller-3.png b/docs/reference/as_labeller-3.png deleted file mode 100644 index d01a1264e..000000000 Binary files a/docs/reference/as_labeller-3.png and /dev/null differ diff --git a/docs/reference/as_labeller-4.png b/docs/reference/as_labeller-4.png deleted file mode 100644 index ffc9403ed..000000000 Binary files a/docs/reference/as_labeller-4.png and /dev/null differ diff --git a/docs/reference/as_labeller.html b/docs/reference/as_labeller.html deleted file mode 100644 index cdfc97da7..000000000 --- a/docs/reference/as_labeller.html +++ /dev/null @@ -1,130 +0,0 @@ - -Coerce to labeller function — as_labeller • animint2 - Skip to contents - - -
-
-
- -
-

This transforms objects to labeller functions. Used internally by -labeller().

-
- -
-

Usage

-
as_labeller(x, default = label_value, multi_line = TRUE)
-
- -
-

Arguments

-
x
-

Object to coerce to a labeller function. If a named -character vector, it is used as a lookup table before being -passed on to default. If a non-labeller function, it is -assumed it takes and returns character vectors and is applied to -the labels. If a labeller, it is simply applied to the labels.

- - -
default
-

Default labeller to process the labels produced by -lookup tables or modified by non-labeller functions.

- - -
multi_line
-

Whether to display the labels of multiple factors -on separate lines. This is passed to the labeller function.

- -
-
-

See also

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(disp, drat)) + geom_point()
-p + facet_wrap(~am)
-
-
-# Rename labels on the fly with a lookup character vector
-to_string <- as_labeller(c(`0` = "Zero", `1` = "One"))
-p + facet_wrap(~am, labeller = to_string)
-
-
-# Quickly transform a function operating on character vectors to a
-# labeller function:
-appender <- function(string, suffix = "-foo") paste0(string, suffix)
-p + facet_wrap(~am, labeller = as_labeller(appender))
-
-
-# If you have more than one facetting variable, be sure to dispatch
-# your labeller to the right variable with labeller()
-p + facet_grid(cyl ~ am, labeller = labeller(am = to_string))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/autoplot.html b/docs/reference/autoplot.html deleted file mode 100644 index 341a8a5de..000000000 --- a/docs/reference/autoplot.html +++ /dev/null @@ -1,106 +0,0 @@ - -Create a complete ggplot appropriate to a particular data type — autoplot • animint2 - Skip to contents - - -
-
-
- -
-

autoplot uses ggplot2 to draw a particular plot for an object of a -particular class in a single command. This defines the S3 generic that -other classes and packages can extend.

-
- -
-

Usage

-
autoplot(object, ...)
-
- -
-

Arguments

-
object
-

an object, whose class will determine the behaviour of autoplot

- - -
...
-

other arguments passed to specific methods

- -
-
-

Value

- - -

a ggplot object

-
-
-

See also

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/benchplot-1.png b/docs/reference/benchplot-1.png deleted file mode 100644 index a0573f87f..000000000 Binary files a/docs/reference/benchplot-1.png and /dev/null differ diff --git a/docs/reference/benchplot.html b/docs/reference/benchplot.html deleted file mode 100644 index da3f30f6c..000000000 --- a/docs/reference/benchplot.html +++ /dev/null @@ -1,111 +0,0 @@ - -Benchmark plot creation time. -Broken down into construct, build, render and draw times. — benchplot • animint2 - Skip to contents - - -
-
-
- -
-

Benchmark plot creation time. -Broken down into construct, build, render and draw times.

-
- -
-

Usage

-
benchplot(x)
-
- -
-

Arguments

-
x
-

code to create ggplot2 plot

- -
- -
-

Examples

-
benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point())
-#>        step user.self sys.self elapsed
-#> 1 construct      0.00        0    0.00
-#> 2     build      0.00        0    0.00
-#> 3    render      0.02        0    0.01
-#> 4      draw      0.03        0    0.03
-#> 5     TOTAL      0.05        0    0.04
-benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl))
-
-#>        step user.self sys.self elapsed
-#> 1 construct      0.00        0    0.00
-#> 2     build      0.02        0    0.01
-#> 3    render      0.03        0    0.03
-#> 4      draw      0.04        0    0.05
-#> 5     TOTAL      0.09        0    0.09
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/borders-1.png b/docs/reference/borders-1.png deleted file mode 100644 index fe53a0507..000000000 Binary files a/docs/reference/borders-1.png and /dev/null differ diff --git a/docs/reference/borders.html b/docs/reference/borders.html deleted file mode 100644 index a77fc2f7f..000000000 --- a/docs/reference/borders.html +++ /dev/null @@ -1,144 +0,0 @@ - -Create a layer of map borders. — borders • animint2 - Skip to contents - - -
-
-
- -
-

Create a layer of map borders.

-
- -
-

Usage

-
borders(
-  database = "world",
-  regions = ".",
-  fill = NA,
-  colour = "grey50",
-  xlim = NULL,
-  ylim = NULL,
-  ...
-)
-
- -
-

Arguments

-
database
-

map data, see map for details

- - -
regions
-

map region

- - -
fill
-

fill colour

- - -
colour
-

border colour

- - -
xlim, ylim
-

latitudinal and logitudinal range for extracting map -polygons, see map for details.

- - -
...
-

other arguments passed onto geom_polygon

- -
- -
-

Examples

-
if (require("maps")) {
-
-ia <- map_data("county", "iowa")
-mid_range <- function(x) mean(range(x))
-seats <- plyr::ddply(ia, "subregion", plyr::colwise(mid_range, c("lat", "long")))
-ggplot(ia, aes(long, lat)) +
-  geom_polygon(aes(group = group), fill = NA, colour = "grey60") +
-  geom_text(aes(label = subregion), data = seats, size = 2, angle = 45)
-
-data(us.cities)
-capitals <- subset(us.cities, capital == 2)
-ggplot(capitals, aes(long, lat)) +
-  borders("state") +
-  geom_point(aes(size = pop)) +
-  scale_size_area() +
-  coord_quickmap()
-
-# Same map, with some world context
-ggplot(capitals, aes(long, lat)) +
-  borders("world", xlim = c(-130, -60), ylim = c(20, 50)) +
-  geom_point(aes(size = pop)) +
-  scale_size_area() +
-  coord_quickmap()
-}
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/breakpoints.html b/docs/reference/breakpoints.html deleted file mode 100644 index e167e32b9..000000000 --- a/docs/reference/breakpoints.html +++ /dev/null @@ -1,99 +0,0 @@ - -The breakpointError of simulated signals — breakpoints • animint2 - Skip to contents - - -
-
-
- -
-

Two noisy signals were sampled from a latent signal with known - breakpoints, which were used to measure the error of estimated - models with 1,...,20 segments.

-
- -
-

Usage

-
data(breakpoints)
-
- -
-

Format

-

A list of 5 data.frames: error contains the breakpointError of the -estimated models, signals contains the noisy signals, breaks contains -the breakpoints in the estimated signals, segments contains the -estimated segments, and imprecision contains the normalized imprecision -curves which were used to evaluate the error.

-
-
-

Source

-

The breakpointError package was used to measure the model error, see -etc/breakpoints.R.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/calc_element.html b/docs/reference/calc_element.html deleted file mode 100644 index 43fe407dc..000000000 --- a/docs/reference/calc_element.html +++ /dev/null @@ -1,194 +0,0 @@ - -Calculate the element properties, by inheriting properties from its parents — calc_element • animint2 - Skip to contents - - -
-
-
- -
-

Calculate the element properties, by inheriting properties from its parents

-
- -
-

Usage

-
calc_element(element, theme, verbose = FALSE)
-
- -
-

Arguments

-
element
-

The name of the theme element to calculate

- - -
theme
-

A theme object (like theme_grey())

- - -
verbose
-

If TRUE, print out which elements this one inherits from

- -
- -
-

Examples

-
t <- theme_grey()
-calc_element('text', t)
-#> List of 10
-#>  $ family    : chr ""
-#>  $ face      : chr "plain"
-#>  $ colour    : chr "black"
-#>  $ size      : num 11
-#>  $ hjust     : num 0.5
-#>  $ vjust     : num 0.5
-#>  $ angle     : num 0
-#>  $ lineheight: num 0.9
-#>  $ margin    : 'margin' num [1:4] 0points 0points 0points 0points
-#>   ..- attr(*, "unit")= int 8
-#>  $ debug     : logi FALSE
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-
-# Compare the "raw" element definition to the element with calculated inheritance
-t$axis.text.x
-#> List of 10
-#>  $ family    : NULL
-#>  $ face      : NULL
-#>  $ colour    : NULL
-#>  $ size      : NULL
-#>  $ hjust     : NULL
-#>  $ vjust     : num 1
-#>  $ angle     : NULL
-#>  $ lineheight: NULL
-#>  $ margin    : 'margin' num [1:4] 2.2points 0points 0points 0points
-#>   ..- attr(*, "unit")= int 8
-#>  $ debug     : NULL
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-calc_element('axis.text.x', t, verbose = TRUE)
-#> axis.text.x --> 
-#> axis.text
-#> axis.text --> 
-#> text
-#> text --> 
-#> nothing (top level)
-#> List of 10
-#>  $ family    : chr ""
-#>  $ face      : chr "plain"
-#>  $ colour    : chr "grey30"
-#>  $ size      : num 11
-#>  $ hjust     : num 0.5
-#>  $ vjust     : num 1
-#>  $ angle     : num 0
-#>  $ lineheight: num 0.9
-#>  $ margin    : 'margin' num [1:4] 2.2points 0points 0points 0points
-#>   ..- attr(*, "unit")= int 8
-#>  $ debug     : logi FALSE
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-
-# This reports that axis.text.x inherits from axis.text,
-# which inherits from text. You can view each of them with:
-t$axis.text.x
-#> List of 10
-#>  $ family    : NULL
-#>  $ face      : NULL
-#>  $ colour    : NULL
-#>  $ size      : NULL
-#>  $ hjust     : NULL
-#>  $ vjust     : num 1
-#>  $ angle     : NULL
-#>  $ lineheight: NULL
-#>  $ margin    : 'margin' num [1:4] 2.2points 0points 0points 0points
-#>   ..- attr(*, "unit")= int 8
-#>  $ debug     : NULL
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-t$axis.text
-#> List of 10
-#>  $ family    : NULL
-#>  $ face      : NULL
-#>  $ colour    : chr "grey30"
-#>  $ size      : NULL
-#>  $ hjust     : NULL
-#>  $ vjust     : NULL
-#>  $ angle     : NULL
-#>  $ lineheight: NULL
-#>  $ margin    : NULL
-#>  $ debug     : NULL
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-t$text
-#> List of 10
-#>  $ family    : chr ""
-#>  $ face      : chr "plain"
-#>  $ colour    : chr "black"
-#>  $ size      : num 11
-#>  $ hjust     : num 0.5
-#>  $ vjust     : num 0.5
-#>  $ angle     : num 0
-#>  $ lineheight: num 0.9
-#>  $ margin    : 'margin' num [1:4] 0points 0points 0points 0points
-#>   ..- attr(*, "unit")= int 8
-#>  $ debug     : logi FALSE
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/change.html b/docs/reference/change.html deleted file mode 100644 index 4ecf4d435..000000000 --- a/docs/reference/change.html +++ /dev/null @@ -1,102 +0,0 @@ - -Graphical model structure change — change • animint2 - Skip to contents - - -
-
-
- -
-

A model for detecting graphical model structure changes was applied to -some simulated data for which we know the real changes.

-
- -
-

Usage

-
data(change)
-
- -
-

Format

-

List of 4 data.frames: coefs contains the coefficients for every -variable at every point in the regularization path, -truth contains information about which -variables are real changes, likelihood contains the train and test -likelihood, and position contains positions for laying out the graphical -model nodes on the 2D plane.

-
-
-

Source

-

Song Liu, personal communication.

-
-
-

References

-

Liu S, Quinn JA, Gutmann MU, Sugiyama M. Direct Learning of Sparse - Changes in Markov Networks by Density Ratio Estimation. ECML/PKDD - 2013.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/checkAnimationTimeVar.html b/docs/reference/checkAnimationTimeVar.html deleted file mode 100644 index c59a9b680..000000000 --- a/docs/reference/checkAnimationTimeVar.html +++ /dev/null @@ -1,93 +0,0 @@ - -Check animation variable for errors — checkAnimationTimeVar • animint2 - Skip to contents - - -
-
-
- -
-

Check animation variable for errors

-
- -
-

Usage

-
checkAnimationTimeVar(timeVarList)
-
- -
-

Arguments

-
timeVarList
-

plot.list$time in animint2dir to check -for errors

- -
-
-

Value

- - -

NULL :Stops with an error for invalid input

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/checkExtraParams.html b/docs/reference/checkExtraParams.html deleted file mode 100644 index dad143f93..000000000 --- a/docs/reference/checkExtraParams.html +++ /dev/null @@ -1,97 +0,0 @@ - -Check extra_params argument for duplicates, non-named list — checkExtraParams • animint2 - Skip to contents - - -
-
-
- -
-

Check extra_params argument for duplicates, non-named list

-
- -
-

Usage

-
checkExtraParams(extra_params, aes_mapping)
-
- -
-

Arguments

-
extra_params
-

named list containing the details of showSelected -and clickSelects values of the layer

- - -
aes_mapping
-

aesthetics mapping of the layer

- -
-
-

Value

- - -

Modified extra_params list

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/checkForSSandCSasAesthetics.html b/docs/reference/checkForSSandCSasAesthetics.html deleted file mode 100644 index 3e9d68337..000000000 --- a/docs/reference/checkForSSandCSasAesthetics.html +++ /dev/null @@ -1,102 +0,0 @@ - -Check if showSelected and clickSelects have been used as aesthetics -as in old syntax. If yes, raise error — checkForSSandCSasAesthetics • animint2 - Skip to contents - - -
-
-
- -
-

Check if showSelected and clickSelects have been used as aesthetics -as in old syntax. If yes, raise error

-
- -
-

Usage

-
checkForSSandCSasAesthetics(aesthetics, plot_name)
-
- -
-

Arguments

-
aesthetics
-

list. aesthetics mapping of the layer

- - -
plot_name
-

character vector of the plot the layer belongs to

- -
-
-

Value

- - -

NULL Throws error if used as aesthetics

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/checkPlotForAnimintExtensions.html b/docs/reference/checkPlotForAnimintExtensions.html deleted file mode 100644 index f678a38c7..000000000 --- a/docs/reference/checkPlotForAnimintExtensions.html +++ /dev/null @@ -1,97 +0,0 @@ - -Performs error checking on the plot for animint extensions — checkPlotForAnimintExtensions • animint2 - Skip to contents - - -
-
-
- -
-

Performs error checking on the plot for animint extensions

-
- -
-

Usage

-
checkPlotForAnimintExtensions(p, plot_name)
-
- -
-

Arguments

-
p
-

plot from plot.list to check for errors

- - -
plot_name
-

plot name error check. Should be alphanumeric and should -begin with an alphabet

- -
-
-

Value

- - -

NULL :Stops with an error for invalid input

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/checkPlotList.html b/docs/reference/checkPlotList.html deleted file mode 100644 index 92bf58943..000000000 --- a/docs/reference/checkPlotList.html +++ /dev/null @@ -1,92 +0,0 @@ - -Check plot.list for errors — checkPlotList • animint2 - Skip to contents - - -
-
-
- -
-

Check that plot.list is a list and every element is named

-
- -
-

Usage

-
checkPlotList(plot.list)
-
- -
-

Arguments

-
plot.list
-

from animint2dir to check for errors

- -
-
-

Value

- - -

Throws an error for invalid values

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/checkSingleShowSelectedValue.html b/docs/reference/checkSingleShowSelectedValue.html deleted file mode 100644 index 95101c783..000000000 --- a/docs/reference/checkSingleShowSelectedValue.html +++ /dev/null @@ -1,100 +0,0 @@ - -Issue warnings for non interactive plots where there is only one -showSelected value — checkSingleShowSelectedValue • animint2 - Skip to contents - - -
-
-
- -
-

Issue warnings for non interactive plots where there is only one -showSelected value

-
- -
-

Usage

-
checkSingleShowSelectedValue(selectors)
-
- -
-

Arguments

-
selectors
-

selectors to check for warnings

- -
-
-

Value

- - -

NULL

- - -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/climate.html b/docs/reference/climate.html deleted file mode 100644 index acc37561f..000000000 --- a/docs/reference/climate.html +++ /dev/null @@ -1,150 +0,0 @@ - -Climate data in central America from 1995 to 2000 — climate • animint2 - Skip to contents - - -
-
-
- -
-

Monthly observations of atmospheric variables 1995-2000, -between 113.75W-56.25W, 21.25S-36.25N with 2.5 degree grid -spacing. Variables: pressure, temperature, ozone and low, medium, -high cloud cover. -Temperatures are given in degrees celsius (original data had Kelvin).

-
- -
-

Usage

-
data(climate)
-
- -
-

Format

-

A data frame with 41472 observations on the following 16 variables.

time
-

a numeric vector

- -
y
-

a numeric vector

- -
x
-

a numeric vector

- -
lat
-

a numeric vector

- -
long
-

a numeric vector

- -
date
-

a POSIXct

- -
cloudhigh
-

a numeric vector

- -
cloudlow
-

a numeric vector

- -
cloudmid
-

a numeric vector

- -
ozone
-

a numeric vector

- -
pressure
-

a numeric vector

- -
surftemp
-

a numeric vector

- -
temperature
-

a numeric vector

- -
id
-

a character vector

- -
month
-

a numeric vector

- -
year
-

a numeric vector

- - -
-
-

Source

-

NASA Goddard Institute for Space Studies (GISS) -subset of the monthly climatology of the International -Satellite Cloud Climatology Project (ISCCP)

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/colsNotToCopy.html b/docs/reference/colsNotToCopy.html deleted file mode 100644 index 40e5f5688..000000000 --- a/docs/reference/colsNotToCopy.html +++ /dev/null @@ -1,96 +0,0 @@ - -Filter out columns that do not need to be copied — colsNotToCopy • animint2 - Skip to contents - - -
-
-
- -
-

Filter out columns that do not need to be copied

-
- -
-

Usage

-
colsNotToCopy(g, s.aes)
-
- -
-

Arguments

-
g
-

Geom with columns

- - -
s.aes
-

Selector aesthetics

- -
-
-

Value

- - -

Character vector of columns not to be copied

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/compare.html b/docs/reference/compare.html deleted file mode 100644 index 487056e38..000000000 --- a/docs/reference/compare.html +++ /dev/null @@ -1,111 +0,0 @@ - -Testing rank and compare SVM on simulated patterns — compare • animint2 - Skip to contents - - -
-
-
- -
-

50, ..., 800 labeled pairs were generated according to the squared L1, -L2, and Linf norms, with input features in [-3, 3]. Labels are -1 when -there is no significant difference between the ranks of Xt and Xtp, -and 1 when the rank of Xtp is significantly higher than the rank of -Xt. SVMrank ignores the pairs labeled -1, but SVMcompare uses them to -learn a more accurate predictive model, as shown by the test error and -level curves of the learned functions.

-
- -
-

Usage

-
data(compare)
-
- -
-

Format

-

List of 4 data.frames: error contains the test error of the learned -models, bayes contains the Bayes classification error of the latent -ranking function applied to the test data, rank contains the ranking -functions evaluated on a grid of input points, train.pairs contains the -data that were used to train the algorithms.

-
-
-

References

-

Hocking TD, Spanurattana S, Sugiyama M. Support vector comparison -machines (2013).

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/continuous_scale.html b/docs/reference/continuous_scale.html deleted file mode 100644 index c1253e6e6..000000000 --- a/docs/reference/continuous_scale.html +++ /dev/null @@ -1,190 +0,0 @@ - -Continuous scale constructor. — continuous_scale • animint2 - Skip to contents - - -
-
-
- -
-

Continuous scale constructor.

-
- -
-

Usage

-
continuous_scale(
-  aesthetics,
-  scale_name,
-  palette,
-  name = waiver(),
-  breaks = waiver(),
-  minor_breaks = waiver(),
-  labels = waiver(),
-  limits = NULL,
-  rescaler = rescale,
-  oob = censor,
-  expand = waiver(),
-  na.value = NA_real_,
-  trans = "identity",
-  guide = "legend"
-)
-
- -
-

Arguments

-
aesthetics
-

the names of the aesthetics that this scale works with

- - -
scale_name
-

the name of the scale

- - -
palette
-

a palette function that when called with a single integer -argument (the number of levels in the scale) returns the values that -they should take

- - -
name
-

The name of the scale. Used as axis or legend title. If -NULL, the default, the name of the scale is taken from the first -mapping used for that aesthetic.

- - -
breaks
-

One of:

  • NULL for no breaks

  • -
  • waiver() for the default breaks computed by the - transformation object

  • -
  • A numeric vector of positions

  • -
  • A function that takes the limits as input and returns breaks - as output

  • -
- - -
minor_breaks
-

One of:

  • NULL for no minor breaks

  • -
  • waiver() for the default breaks (one minor break between - each major break)

  • -
  • A numeric vector of positions

  • -
  • A function that given the limits returns a vector of minor breaks.

  • -
- - -
labels
-

One of:

  • NULL for no labels

  • -
  • waiver() for the default labels computed by the - transformation object

  • -
  • A character vector giving labels (must be same length as breaks)

  • -
  • A function that takes the breaks as input and returns labels - as output

  • -
- - -
limits
-

A numeric vector of length two providing limits of the scale. -Use NA to refer to the existing minimum or maximum.

- - -
rescaler
-

Used by diverging and n colour gradients -(i.e. scale_colour_gradient2, scale_colour_gradientn). -A function used to scale the input values to the range [0, 1].

- - -
oob
-

Function that handles limits outside of the scale limits -(out of bounds). The default replaces out of bounds values with NA.

- - -
expand
-

A numeric vector of length two giving multiplicative and -additive expansion constants. These constants ensure that the data is -placed some distance away from the axes. The defaults are -c(0.05, 0) for continuous variables, and c(0, 0.6) for -discrete variables.

- - -
na.value
-

Missing values will be replaced with this value.

- - -
trans
-

Either the name of a transformation object, or the - object itself. Built-in transformations include "asn", "atanh", - "boxcox", "exp", "identity", "log", "log10", "log1p", "log2", - "logit", "probability", "probit", "reciprocal", "reverse" and "sqrt".

-

A transformation object bundles together a transform, it's inverse, - and methods for generating breaks and labels. Transformation objects - are defined in the scales package, and are called name_trans, e.g. - boxcox_trans. You can create your own - transformation with trans_new.

- - -
guide
-

Name of guide object, or object itself.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_cartesian-1.png b/docs/reference/coord_cartesian-1.png deleted file mode 100644 index 5cf88cffd..000000000 Binary files a/docs/reference/coord_cartesian-1.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-2.png b/docs/reference/coord_cartesian-2.png deleted file mode 100644 index e5c9d8fc3..000000000 Binary files a/docs/reference/coord_cartesian-2.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-3.png b/docs/reference/coord_cartesian-3.png deleted file mode 100644 index e7791594f..000000000 Binary files a/docs/reference/coord_cartesian-3.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-4.png b/docs/reference/coord_cartesian-4.png deleted file mode 100644 index b67d9d6b0..000000000 Binary files a/docs/reference/coord_cartesian-4.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-5.png b/docs/reference/coord_cartesian-5.png deleted file mode 100644 index 7d1aa7f47..000000000 Binary files a/docs/reference/coord_cartesian-5.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-6.png b/docs/reference/coord_cartesian-6.png deleted file mode 100644 index 0d8440832..000000000 Binary files a/docs/reference/coord_cartesian-6.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-7.png b/docs/reference/coord_cartesian-7.png deleted file mode 100644 index 1336d381a..000000000 Binary files a/docs/reference/coord_cartesian-7.png and /dev/null differ diff --git a/docs/reference/coord_cartesian-8.png b/docs/reference/coord_cartesian-8.png deleted file mode 100644 index 50b3c5182..000000000 Binary files a/docs/reference/coord_cartesian-8.png and /dev/null differ diff --git a/docs/reference/coord_cartesian.html b/docs/reference/coord_cartesian.html deleted file mode 100644 index bdebadc62..000000000 --- a/docs/reference/coord_cartesian.html +++ /dev/null @@ -1,152 +0,0 @@ - -Cartesian coordinates. — coord_cartesian • animint2 - Skip to contents - - -
-
-
- -
-

The Cartesian coordinate system is the most familiar, and common, type of -coordinate system. Setting limits on the coordinate system will zoom the -plot (like you're looking at it with a magnifying glass), and will not -change the underlying data like setting limits on a scale will.

-
- -
-

Usage

-
coord_cartesian(xlim = NULL, ylim = NULL, expand = TRUE)
-
- -
-

Arguments

-
xlim, ylim
-

Limits for the x and y axes.

- - -
expand
-

If TRUE, the default, adds a small expansion factor to -the limits to ensure that data and axes don't overlap. If FALSE, -limits are taken exactly from the data or xlim/ylim.

- -
- -
-

Examples

-
# There are two ways of zooming the plot display: with scales or
-# with coordinate systems.  They work in two rather different ways.
-
-p <- ggplot(mtcars, aes(disp, wt)) +
-  geom_point() +
-  geom_smooth()
-p
-
-
-# Setting the limits on a scale converts all values outside the range to NA.
-p + scale_x_continuous(limits = c(325, 500))
-#> Warning: Removed 24 rows containing non-finite values (stat_smooth).
-#> Warning: Removed 24 rows containing missing values (geom_point).
-
-
-# Setting the limits on the coordinate system performs a visual zoom.
-# The data is unchanged, and we just view a small portion of the original
-# plot. Note how smooth continues past the points visible on this plot.
-p + coord_cartesian(xlim = c(325, 500))
-
-
-# By default, the same expansion factor is applied as when setting scale
-# limits. You can set the limits precisely by setting expand = FALSE
-p + coord_cartesian(xlim = c(325, 500), expand = FALSE)
-
-
-# Simiarly, we can use expand = FALSE to turn off expansion with the
-# default limits
-p + coord_cartesian(expand = FALSE)
-
-
-# You can see the same thing with this 2d histogram
-d <- ggplot(diamonds, aes(carat, price)) +
-  stat_bin2d(bins = 25, colour = "white")
-d
-
-
-# When zooming the scale, the we get 25 new bins that are the same
-# size on the plot, but represent smaller regions of the data space
-d + scale_x_continuous(limits = c(0, 1))
-#> Warning: Removed 17502 rows containing non-finite values (stat_bin2d).
-
-
-# When zooming the coordinate system, we see a subset of original 50 bins,
-# displayed bigger
-d + coord_cartesian(xlim = c(0, 1))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_fixed-1.png b/docs/reference/coord_fixed-1.png deleted file mode 100644 index 6addd1210..000000000 Binary files a/docs/reference/coord_fixed-1.png and /dev/null differ diff --git a/docs/reference/coord_fixed-2.png b/docs/reference/coord_fixed-2.png deleted file mode 100644 index a299bf226..000000000 Binary files a/docs/reference/coord_fixed-2.png and /dev/null differ diff --git a/docs/reference/coord_fixed-3.png b/docs/reference/coord_fixed-3.png deleted file mode 100644 index b8cc8da5c..000000000 Binary files a/docs/reference/coord_fixed-3.png and /dev/null differ diff --git a/docs/reference/coord_fixed.html b/docs/reference/coord_fixed.html deleted file mode 100644 index 0438fcf81..000000000 --- a/docs/reference/coord_fixed.html +++ /dev/null @@ -1,130 +0,0 @@ - -Cartesian coordinates with fixed relationship between x and y scales. — coord_fixed • animint2 - Skip to contents - - -
-
-
- -
-

A fixed scale coordinate system forces a specified ratio between the -physical representation of data units on the axes. The ratio represents the -number of units on the y-axis equivalent to one unit on the x-axis. The -default, ratio = 1, ensures that one unit on the x-axis is the same -length as one unit on the y-axis. Ratios higher than one make units on the -y axis longer than units on the x-axis, and vice versa. This is similar to -eqscplot, but it works for all types of graphics.

-
- -
-

Usage

-
coord_fixed(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE)
-
- -
-

Arguments

-
ratio
-

aspect ratio, expressed as y / x

- - -
xlim, ylim
-

Limits for the x and y axes.

- - -
expand
-

If TRUE, the default, adds a small expansion factor to -the limits to ensure that data and axes don't overlap. If FALSE, -limits are taken exactly from the data or xlim/ylim.

- -
- -
-

Examples

-
# ensures that the ranges of axes are equal to the specified ratio by
-# adjusting the plot aspect ratio
-
-p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
-p + coord_fixed(ratio = 1)
-
-p + coord_fixed(ratio = 5)
-
-p + coord_fixed(ratio = 1/5)
-
-
-# Resize the plot to see that the specified aspect ratio is maintained
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_flip-1.png b/docs/reference/coord_flip-1.png deleted file mode 100644 index 84f2f0f0a..000000000 Binary files a/docs/reference/coord_flip-1.png and /dev/null differ diff --git a/docs/reference/coord_flip-2.png b/docs/reference/coord_flip-2.png deleted file mode 100644 index 9cc385e60..000000000 Binary files a/docs/reference/coord_flip-2.png and /dev/null differ diff --git a/docs/reference/coord_flip-3.png b/docs/reference/coord_flip-3.png deleted file mode 100644 index 32cf9807e..000000000 Binary files a/docs/reference/coord_flip-3.png and /dev/null differ diff --git a/docs/reference/coord_flip-4.png b/docs/reference/coord_flip-4.png deleted file mode 100644 index 3a7245675..000000000 Binary files a/docs/reference/coord_flip-4.png and /dev/null differ diff --git a/docs/reference/coord_flip-5.png b/docs/reference/coord_flip-5.png deleted file mode 100644 index b5ec6b409..000000000 Binary files a/docs/reference/coord_flip-5.png and /dev/null differ diff --git a/docs/reference/coord_flip.html b/docs/reference/coord_flip.html deleted file mode 100644 index 8652f57b1..000000000 --- a/docs/reference/coord_flip.html +++ /dev/null @@ -1,121 +0,0 @@ - -Flipped cartesian coordinates. — coord_flip • animint2 - Skip to contents - - -
-
-
- -
-

Flipped cartesian coordinates so that horizontal becomes vertical, and -vertical, horizontal. This is primarily useful for converting geoms and -statistics which display y conditional on x, to x conditional on y.

-
- -
-

Usage

-
coord_flip(xlim = NULL, ylim = NULL, expand = TRUE)
-
- -
-

Arguments

-
xlim, ylim
-

Limits for the x and y axes.

- - -
expand
-

If TRUE, the default, adds a small expansion factor to -the limits to ensure that data and axes don't overlap. If FALSE, -limits are taken exactly from the data or xlim/ylim.

- -
- -
-

Examples

-
h <- ggplot(diamonds, aes(carat)) +
-  geom_histogram()
-h
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-h + coord_flip()
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-h + coord_flip() + scale_x_reverse()
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-
-# You can also use it to flip line and area plots:
-df <- data.frame(x = 1:5, y = (1:5) ^ 2)
-ggplot(df, aes(x, y)) +
-  geom_area()
-
-last_plot() + coord_flip()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_map-1.png b/docs/reference/coord_map-1.png deleted file mode 100644 index 2322fe948..000000000 Binary files a/docs/reference/coord_map-1.png and /dev/null differ diff --git a/docs/reference/coord_map.html b/docs/reference/coord_map.html deleted file mode 100644 index 400813802..000000000 --- a/docs/reference/coord_map.html +++ /dev/null @@ -1,226 +0,0 @@ - -Map projections. — coord_map • animint2 - Skip to contents - - -
-
-
- -
-

The representation of a portion of the earth, which is approximately spherical, -onto a flat 2D plane requires a projection. This is what -coord_map does. These projections account for the fact that the -actual length (in km) of one degree of longitude varies between the equator -and the pole. Near the equator, the ratio between the lengths of one degree -of latitude and one degree of longitude is approximately 1. Near the pole, it -is tends towards infinity because the length of one degree of longitude tends -towards 0. For regions that span only a few degrees and are not too close to -the poles, setting the aspect ratio of the plot to the appropriate lat/lon -ratio approximates the usual mercator projection. This is what -coord_quickmap does. With coord_map all elements of the -graphic have to be projected which is not the case here. So -coord_quickmap has the advantage of being much faster, in -particular for complex plots such as those using with -geom_tile, at the expense of correctness in the projection. -This coordinate system provides the full range of map projections available -in the mapproj package.

-
- -
-

Usage

-
coord_map(
-  projection = "mercator",
-  ...,
-  orientation = NULL,
-  xlim = NULL,
-  ylim = NULL
-)
-
-coord_quickmap(xlim = NULL, ylim = NULL, expand = TRUE)
-
- -
-

Arguments

-
projection
-

projection to use, see -mapproject for list

- - -
...
-

other arguments passed on to -mapproject

- - -
orientation
-

projection orientation, which defaults to -c(90, 0, mean(range(x))). This is not optimal for many -projections, so you will have to supply your own. See -mapproject for more information.

- - -
xlim
-

manually specific x limits (in degrees of longitude)

- - -
ylim
-

manually specific y limits (in degrees of latitude)

- - -
expand
-

If TRUE, the default, adds a small expansion factor to -the limits to ensure that data and axes don't overlap. If FALSE, -limits are taken exactly from the data or xlim/ylim.

- -
- -
-

Examples

-
if (require("maps")) {
-nz <- map_data("nz")
-# Prepare a map of NZ
-nzmap <- ggplot(nz, aes(x = long, y = lat, group = group)) +
-  geom_polygon(fill = "white", colour = "black")
-
-# Plot it in cartesian coordinates
-nzmap
-# With correct mercator projection
-nzmap + coord_map()
-# With the aspect ratio approximation
-nzmap + coord_quickmap()
-
-# Other projections
-nzmap + coord_map("cylindrical")
-nzmap + coord_map("azequalarea", orientation = c(-36.92,174.6,0))
-
-states <- map_data("state")
-usamap <- ggplot(states, aes(long, lat, group = group)) +
-  geom_polygon(fill = "white", colour = "black")
-
-# Use cartesian coordinates
-usamap
-# With mercator projection
-usamap + coord_map()
-usamap + coord_quickmap()
-# See ?mapproject for coordinate systems and their parameters
-usamap + coord_map("gilbert")
-usamap + coord_map("lagrange")
-
-# For most projections, you'll need to set the orientation yourself
-# as the automatic selection done by mapproject is not available to
-# ggplot
-usamap + coord_map("orthographic")
-usamap + coord_map("stereographic")
-usamap + coord_map("conic", lat0 = 30)
-usamap + coord_map("bonne", lat0 = 50)
-
-# World map, using geom_path instead of geom_polygon
-world <- map_data("world")
-worldmap <- ggplot(world, aes(x = long, y = lat, group = group)) +
-  geom_path() +
-  scale_y_continuous(breaks = (-2:2) * 30) +
-  scale_x_continuous(breaks = (-4:4) * 45)
-
-# Orthographic projection with default orientation (looking down at North pole)
-worldmap + coord_map("ortho")
-# Looking up up at South Pole
-worldmap + coord_map("ortho", orientation = c(-90, 0, 0))
-# Centered on New York (currently has issues with closing polygons)
-worldmap + coord_map("ortho", orientation = c(41, -74, 0))
-}
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_munch.html b/docs/reference/coord_munch.html deleted file mode 100644 index 130b54831..000000000 --- a/docs/reference/coord_munch.html +++ /dev/null @@ -1,103 +0,0 @@ - -Munch coordinates data — coord_munch • animint2 - Skip to contents - - -
-
-
- -
-

This function "munches" lines, dividing each line into many small pieces -so they can be transformed independently. Used inside geom functions.

-
- -
-

Usage

-
coord_munch(coord, data, range, segment_length = 0.01)
-
- -
-

Arguments

-
coord
-

Coordinate system definition.

- - -
data
-

Data set to transform - should have variables x and -y are chopped up into small pieces (as defined by group). -All other variables are duplicated as needed.

- - -
range
-

Panel range specification.

- - -
segment_length
-

Target segment length

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_polar-1.png b/docs/reference/coord_polar-1.png deleted file mode 100644 index 8897e9c0e..000000000 Binary files a/docs/reference/coord_polar-1.png and /dev/null differ diff --git a/docs/reference/coord_polar-2.png b/docs/reference/coord_polar-2.png deleted file mode 100644 index 3855e31e7..000000000 Binary files a/docs/reference/coord_polar-2.png and /dev/null differ diff --git a/docs/reference/coord_polar-3.png b/docs/reference/coord_polar-3.png deleted file mode 100644 index 3002cf714..000000000 Binary files a/docs/reference/coord_polar-3.png and /dev/null differ diff --git a/docs/reference/coord_polar-4.png b/docs/reference/coord_polar-4.png deleted file mode 100644 index 820149c85..000000000 Binary files a/docs/reference/coord_polar-4.png and /dev/null differ diff --git a/docs/reference/coord_polar-5.png b/docs/reference/coord_polar-5.png deleted file mode 100644 index 3f60527f7..000000000 Binary files a/docs/reference/coord_polar-5.png and /dev/null differ diff --git a/docs/reference/coord_polar-6.png b/docs/reference/coord_polar-6.png deleted file mode 100644 index db2ea24dc..000000000 Binary files a/docs/reference/coord_polar-6.png and /dev/null differ diff --git a/docs/reference/coord_polar.html b/docs/reference/coord_polar.html deleted file mode 100644 index 803dc3c5f..000000000 --- a/docs/reference/coord_polar.html +++ /dev/null @@ -1,154 +0,0 @@ - -Polar coordinates. — coord_polar • animint2 - Skip to contents - - -
-
-
- -
-

The polar coordinate system is most commonly used for pie charts, which -are a stacked bar chart in polar coordinates.

-
- -
-

Usage

-
coord_polar(theta = "x", start = 0, direction = 1)
-
- -
-

Arguments

-
theta
-

variable to map angle to (x or y)

- - -
start
-

offset of starting point from 12 o'clock in radians

- - -
direction
-

1, clockwise; -1, anticlockwise

- -
- -
-

Examples

-
# NOTE: Use these plots with caution - polar coordinates has
-# major perceptual problems.  The main point of these examples is
-# to demonstrate how these common plots can be described in the
-# grammar.  Use with EXTREME caution.
-
-#' # A pie chart = stacked bar chart + polar coordinates
-pie <- ggplot(mtcars, aes(x = factor(1), fill = factor(cyl))) +
- geom_bar(width = 1)
-pie + coord_polar(theta = "y")
-
-
-# \donttest{
-
-# A coxcomb plot = bar chart + polar coordinates
-cxc <- ggplot(mtcars, aes(x = factor(cyl))) +
-  geom_bar(width = 1, colour = "black")
-cxc + coord_polar()
-
-# A new type of plot?
-cxc + coord_polar(theta = "y")
-
-
-# The bullseye chart
-pie + coord_polar()
-
-
-# Hadley's favourite pie chart
-df <- data.frame(
-  variable = c("does not resemble", "resembles"),
-  value = c(20, 80)
-)
-ggplot(df, aes(x = "", y = value, fill = variable)) +
-  geom_bar(width = 1, stat = "identity") +
-  scale_fill_manual(values = c("red", "yellow")) +
-  coord_polar("y", start = pi / 3) +
-  labs(title = "Pac man")
-
-
-# Windrose + doughnut plot
-if (require("ggplot2movies")) {
-movies$rrating <- cut_interval(movies$rating, length = 1)
-movies$budgetq <- cut_number(movies$budget, 4)
-
-doh <- ggplot(movies, aes(x = rrating, fill = budgetq))
-
-# Wind rose
-doh + geom_bar(width = 1) + coord_polar()
-# Race track plot
-doh + geom_bar(width = 0.9, position = "fill") + coord_polar(theta = "y")
-}
-#> Loading required package: ggplot2movies
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/coord_trans-1.png b/docs/reference/coord_trans-1.png deleted file mode 100644 index a57ddbeac..000000000 Binary files a/docs/reference/coord_trans-1.png and /dev/null differ diff --git a/docs/reference/coord_trans-2.png b/docs/reference/coord_trans-2.png deleted file mode 100644 index 5c06ff1d7..000000000 Binary files a/docs/reference/coord_trans-2.png and /dev/null differ diff --git a/docs/reference/coord_trans-3.png b/docs/reference/coord_trans-3.png deleted file mode 100644 index 78a41865c..000000000 Binary files a/docs/reference/coord_trans-3.png and /dev/null differ diff --git a/docs/reference/coord_trans-4.png b/docs/reference/coord_trans-4.png deleted file mode 100644 index 95f2b0fce..000000000 Binary files a/docs/reference/coord_trans-4.png and /dev/null differ diff --git a/docs/reference/coord_trans-5.png b/docs/reference/coord_trans-5.png deleted file mode 100644 index 710f24d45..000000000 Binary files a/docs/reference/coord_trans-5.png and /dev/null differ diff --git a/docs/reference/coord_trans-6.png b/docs/reference/coord_trans-6.png deleted file mode 100644 index cc08100e0..000000000 Binary files a/docs/reference/coord_trans-6.png and /dev/null differ diff --git a/docs/reference/coord_trans-7.png b/docs/reference/coord_trans-7.png deleted file mode 100644 index dc4ada895..000000000 Binary files a/docs/reference/coord_trans-7.png and /dev/null differ diff --git a/docs/reference/coord_trans-8.png b/docs/reference/coord_trans-8.png deleted file mode 100644 index 7f8a28378..000000000 Binary files a/docs/reference/coord_trans-8.png and /dev/null differ diff --git a/docs/reference/coord_trans-9.png b/docs/reference/coord_trans-9.png deleted file mode 100644 index 824a52d7d..000000000 Binary files a/docs/reference/coord_trans-9.png and /dev/null differ diff --git a/docs/reference/coord_trans.html b/docs/reference/coord_trans.html deleted file mode 100644 index 53aa754c6..000000000 --- a/docs/reference/coord_trans.html +++ /dev/null @@ -1,186 +0,0 @@ - -Transformed cartesian coordinate system. — coord_trans • animint2 - Skip to contents - - -
-
-
- -
-

coord_trans is different to scale transformations in that it occurs after -statistical transformation and will affect the visual appearance of geoms - there is -no guarantee that straight lines will continue to be straight.

-
- -
-

Usage

-
coord_trans(
-  x = "identity",
-  y = "identity",
-  limx = NULL,
-  limy = NULL,
-  xtrans,
-  ytrans
-)
-
- -
-

Arguments

-
x, y
-

transformers for x and y axes

- - -
limx, limy
-

limits for x and y axes. (Named so for backward -compatibility)

- - -
xtrans, ytrans
-

Deprecated; use x and y instead.

- -
-
-

Details

-

All current transformations only work with continuous values - see -trans_new for list of transformations, and instructions on -how to create your own.

-
- -
-

Examples

-
# \donttest{
-# Three ways of doing transformation in ggplot:
-#  * by transforming the data
-ggplot(diamonds, aes(log10(carat), log10(price))) +
-  geom_point()
-
-#  * by transforming the scales
-ggplot(diamonds, aes(carat, price)) +
-  geom_point() +
-  scale_x_log10() +
-  scale_y_log10()
-
-#  * by transforming the coordinate system:
-ggplot(diamonds, aes(carat, price)) +
-  geom_point() +
-  coord_trans(x = "log10", y = "log10")
-
-
-# The difference between transforming the scales and
-# transforming the coordinate system is that scale
-# transformation occurs BEFORE statistics, and coordinate
-# transformation afterwards.  Coordinate transformation also
-# changes the shape of geoms:
-
-d <- subset(diamonds, carat > 0.5)
-
-ggplot(d, aes(carat, price)) +
-  geom_point() +
-  geom_smooth(method = "lm") +
-  scale_x_log10() +
-  scale_y_log10()
-
-
-ggplot(d, aes(carat, price)) +
-  geom_point() +
-  geom_smooth(method = "lm") +
-  coord_trans(x = "log10", y = "log10")
-
-
-# Here I used a subset of diamonds so that the smoothed line didn't
-# drop below zero, which obviously causes problems on the log-transformed
-# scale
-
-# With a combination of scale and coordinate transformation, it's
-# possible to do back-transformations:
-ggplot(diamonds, aes(carat, price)) +
-  geom_point() +
-  geom_smooth(method = "lm") +
-  scale_x_log10() +
-  scale_y_log10() +
-  coord_trans(x = scales::exp_trans(10), y = scales::exp_trans(10))
-
-
-# cf.
-ggplot(diamonds, aes(carat, price)) +
-  geom_point() +
-  geom_smooth(method = "lm")
-
-
-# Also works with discrete scales
-df <- data.frame(a = abs(rnorm(26)),letters)
-plot <- ggplot(df,aes(a,letters)) + geom_point()
-
-plot + coord_trans(x = "log10")
-
-plot + coord_trans(x = "sqrt")
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/cut_interval.html b/docs/reference/cut_interval.html deleted file mode 100644 index e82faeb6f..000000000 --- a/docs/reference/cut_interval.html +++ /dev/null @@ -1,184 +0,0 @@ - -Cut up numeric vector into useful groups. — cut_interval • animint2 - Skip to contents - - -
-
-
- -
-

cut_interval makes n groups with equal range, cut_number -makes n groups with (approximately) equal numbers of observations; -cut_width makes groups of width width.

-
- -
-

Usage

-
cut_interval(x, n = NULL, length = NULL, ...)
-
-cut_number(x, n = NULL, ...)
-
-cut_width(
-  x,
-  width,
-  center = NULL,
-  boundary = NULL,
-  closed = c("right", "left")
-)
-
- -
-

Arguments

-
x
-

numeric vector

- - -
n
-

number of intervals to create, OR

- - -
length
-

length of each interval

- - -
...
-

other arguments passed on to cut

- - -
width
-

The bin width.

- - -
center, boundary
-

Specify either the position of edge or the center of - a bin. Since all bins are aligned, specifying the position of a single bin - (which doesn't need to be in the range of the data) affects the location of - all bins. If not specified, uses the "tile layers algorithm", and sets - the boundary to half of the binwidth.

-

To center on integers, width = 1 and center = 0. - boundary = 0.5.

- - -
closed
-

One of "right" or "left" indicating whether right -or left edges of bins are included in the bin.

- -
-
-

See also

-

cut_number

-
-
-

Author

-

Randall Prium contributed most of the implementation of - cut_width.

-
- -
-

Examples

-
table(cut_interval(1:100, 10))
-#> 
-#>    [1,10.9] (10.9,20.8] (20.8,30.7] (30.7,40.6] (40.6,50.5] (50.5,60.4] 
-#>          10          10          10          10          10          10 
-#> (60.4,70.3] (70.3,80.2] (80.2,90.1]  (90.1,100] 
-#>          10          10          10          10 
-table(cut_interval(1:100, 11))
-#> 
-#>   [1,10]  (10,19]  (19,28]  (28,37]  (37,46]  (46,55]  (55,64]  (64,73] 
-#>       10        9        9        9        9        9        9        9 
-#>  (73,82]  (82,91] (91,100] 
-#>        9        9        9 
-
-table(cut_number(runif(1000), 10))
-#> 
-#> [0.00155,0.119]   (0.119,0.216]   (0.216,0.297]   (0.297,0.392]   (0.392,0.482] 
-#>             100             100             100             100             100 
-#>   (0.482,0.588]   (0.588,0.697]   (0.697,0.794]   (0.794,0.897]       (0.897,1] 
-#>             100             100             100             100             100 
-
-table(cut_width(runif(1000), 0.1))
-#> 
-#> [-0.05,0.05]  (0.05,0.15]  (0.15,0.25]  (0.25,0.35]  (0.35,0.45]  (0.45,0.55] 
-#>           40           95          107           96          114          105 
-#>  (0.55,0.65]  (0.65,0.75]  (0.75,0.85]  (0.85,0.95]  (0.95,1.05] 
-#>          103           97          106           96           41 
-table(cut_width(runif(1000), 0.1, boundary = 0))
-#> 
-#>   [0,0.1] (0.1,0.2] (0.2,0.3] (0.3,0.4] (0.4,0.5] (0.5,0.6] (0.6,0.7] (0.7,0.8] 
-#>        99       106       107        93        91        89       108       113 
-#> (0.8,0.9]   (0.9,1] 
-#>        88       106 
-table(cut_width(runif(1000), 0.1, center = 0))
-#> 
-#> [-0.05,0.05]  (0.05,0.15]  (0.15,0.25]  (0.25,0.35]  (0.35,0.45]  (0.45,0.55] 
-#>           47          104          106          107           85          121 
-#>  (0.55,0.65]  (0.65,0.75]  (0.75,0.85]  (0.85,0.95]  (0.95,1.05] 
-#>          106           99           99           80           46 
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/diamonds.html b/docs/reference/diamonds.html deleted file mode 100644 index 1b04d9874..000000000 --- a/docs/reference/diamonds.html +++ /dev/null @@ -1,97 +0,0 @@ - -Prices of 50,000 round cut diamonds — diamonds • animint2 - Skip to contents - - -
-
-
- -
-

A dataset containing the prices and other attributes of almost 54,000 - diamonds. The variables are as follows:

-
- -
-

Usage

-
diamonds
-
- -
-

Format

-

A data frame with 53940 rows and 10 variables:

  • price: price in US dollars ($326--$18,823)

  • -
  • carat: weight of the diamond (0.2--5.01)

  • -
  • cut: quality of the cut (Fair, Good, Very Good, Premium, Ideal)

  • -
  • color: diamond colour, from J (worst) to D (best)

  • -
  • clarity: a measurement of how clear the diamond is - (I1 (worst), SI1, SI2, VS1, VS2, VVS1, VVS2, IF (best))

  • -
  • x: length in mm (0--10.74)

  • -
  • y: width in mm (0--58.9)

  • -
  • z: depth in mm (0--31.8)

  • -
  • depth: total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79)

  • -
  • table: width of top of diamond relative to widest point (43--95)

  • -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/discrete_scale.html b/docs/reference/discrete_scale.html deleted file mode 100644 index 0110d1bff..000000000 --- a/docs/reference/discrete_scale.html +++ /dev/null @@ -1,160 +0,0 @@ - -Discrete scale constructor. — discrete_scale • animint2 - Skip to contents - - -
-
-
- -
-

Discrete scale constructor.

-
- -
-

Usage

-
discrete_scale(
-  aesthetics,
-  scale_name,
-  palette,
-  name = waiver(),
-  breaks = waiver(),
-  labels = waiver(),
-  limits = NULL,
-  expand = waiver(),
-  na.value = NA,
-  drop = TRUE,
-  guide = "legend"
-)
-
- -
-

Arguments

-
aesthetics
-

the names of the aesthetics that this scale works with

- - -
scale_name
-

the name of the scale

- - -
palette
-

a palette function that when called with a single integer -argument (the number of levels in the scale) returns the values that -they should take

- - -
name
-

the name of the scale - used as the axis label or the legend -title

- - -
breaks
-

control the breaks in the guide. There are four possible -types of input:

  • NULL: don't display any breaks

  • -
  • a character vector giving the breaks as they should appear on the - axis or in the legend.

  • -
  • waiver() to use the default break computation.

  • -
  • a function, that when called with a single argument, a character - vector giving the limits of the scale, returns a character vector - specifying which breaks to display.

  • -

This parameter does not affect in any way how the data is scaled - it -only affects the appearance of the legend.

- - -
labels
-

NULL for no labels, waiver() for default -labels (labels the same as breaks), a character vector the same length -as breaks, or a named character vector whose names are used to match -replacement the labels for matching breaks.

- - -
limits
-

A character vector specifying the data range for the scale. -and the default order of their display in guides.

- - -
expand
-

a numeric vector of length two, giving a multiplicative and -additive constant used to expand the range of the scales so that there -is a small gap between the data and the axes. The defaults are (0,0.6) -for discrete scales and (0.05,0) for continuous scales.

- - -
na.value
-

how should missing values be displayed?

- - -
drop
-

Should unused factor levels be omitted from the scale? -The default, TRUE, uses the levels that appear in the data; -FALSE uses all the levels in the factor.

- - -
guide
-

the name of, or actual function, used to create the -guide. See guides for more info.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/draw_key.html b/docs/reference/draw_key.html deleted file mode 100644 index b9739e497..000000000 --- a/docs/reference/draw_key.html +++ /dev/null @@ -1,130 +0,0 @@ - -Key drawing functions — draw_key • animint2 - Skip to contents - - -
-
-
- -
-

Each Geom has an associated function that draws the key when the geom needs -to be displayed in a legend. These are the options built into ggplot2.

-
- -
-

Usage

-
draw_key_point(data, params, size)
-
-draw_key_abline(data, params, size)
-
-draw_key_rect(data, params, size)
-
-draw_key_polygon(data, params, size)
-
-draw_key_blank(data, params, size)
-
-draw_key_crossbar(data, params, size)
-
-draw_key_path(data, params, size)
-
-draw_key_vpath(data, params, size)
-
-draw_key_dotplot(data, params, size)
-
-draw_key_pointrange(data, params, size)
-
-draw_key_smooth(data, params, size)
-
-draw_key_text(data, params, size)
-
-draw_key_label(data, params, size)
-
-draw_key_vline(data, params, size)
-
- -
-

Arguments

-
data
-

A single row data frame containing the scaled aesthetics to -display in this key

- - -
params
-

A list of additional parameters supplied to the geom.

- - -
size
-

Width and height of key in mm.

- -
-
-

Value

- - -

A grid grob.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/economics.html b/docs/reference/economics.html deleted file mode 100644 index c28fad688..000000000 --- a/docs/reference/economics.html +++ /dev/null @@ -1,98 +0,0 @@ - -US economic time series. — economics • animint2 - Skip to contents - - -
-
-
- -
-

This dataset was produced from US economic time series data available from -https://fred.stlouisfed.org/. economics is in "wide" -format, economics_long is in "long" format.

-
- -
-

Usage

-
economics
-
-economics_long
-
- -
-

Format

-

A data frame with 478 rows and 6 variables

  • date. Month of data collection

  • -
  • psavert, personal savings rate,

  • -
  • pce, personal consumption expenditures, in billions of dollars,

  • -
  • unemploy, number of unemployed in thousands,

  • -
  • uempmed, median duration of unemployment, in week,

  • -
  • pop, total population, in thousands,

  • -

An object of class data.frame with 2870 rows and 4 columns.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/element_blank.html b/docs/reference/element_blank.html deleted file mode 100644 index f7fbbea3f..000000000 --- a/docs/reference/element_blank.html +++ /dev/null @@ -1,85 +0,0 @@ - -Theme element: blank. -This theme element draws nothing, and assigns no space — element_blank • animint2 - Skip to contents - - -
-
-
- -
-

Theme element: blank. -This theme element draws nothing, and assigns no space

-
- -
-

Usage

-
element_blank()
-
- - -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/element_grob.html b/docs/reference/element_grob.html deleted file mode 100644 index f7dcdb3ff..000000000 --- a/docs/reference/element_grob.html +++ /dev/null @@ -1,91 +0,0 @@ - -Generate grid grob from theme element — element_grob • animint2 - Skip to contents - - -
-
-
- -
-

Generate grid grob from theme element

-
- -
-

Usage

-
element_grob(element, ...)
-
- -
-

Arguments

-
element
-

Theme element, i.e. element_rect or similar.

- - -
...
-

Other arguments to control specific of rendering. This is -usually at least position. See the source code for individual methods.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/element_line.html b/docs/reference/element_line.html deleted file mode 100644 index ca34464da..000000000 --- a/docs/reference/element_line.html +++ /dev/null @@ -1,108 +0,0 @@ - -Theme element: line. — element_line • animint2 - Skip to contents - - -
-
-
- -
-

Theme element: line.

-
- -
-

Usage

-
element_line(
-  colour = NULL,
-  size = NULL,
-  linetype = NULL,
-  lineend = NULL,
-  color = NULL
-)
-
- -
-

Arguments

-
colour
-

line colour

- - -
size
-

line size

- - -
linetype
-

line type

- - -
lineend
-

line end

- - -
color
-

an alias for colour

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/element_rect.html b/docs/reference/element_rect.html deleted file mode 100644 index eaea24506..000000000 --- a/docs/reference/element_rect.html +++ /dev/null @@ -1,108 +0,0 @@ - -Theme element: rectangle. — element_rect • animint2 - Skip to contents - - -
-
-
- -
-

Most often used for backgrounds and borders.

-
- -
-

Usage

-
element_rect(
-  fill = NULL,
-  colour = NULL,
-  size = NULL,
-  linetype = NULL,
-  color = NULL
-)
-
- -
-

Arguments

-
fill
-

fill colour

- - -
colour
-

border colour

- - -
size
-

border size

- - -
linetype
-

border linetype

- - -
color
-

an alias for colour

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/element_text.html b/docs/reference/element_text.html deleted file mode 100644 index 3029774a4..000000000 --- a/docs/reference/element_text.html +++ /dev/null @@ -1,142 +0,0 @@ - -Theme element: text. — element_text • animint2 - Skip to contents - - -
-
-
- -
-

Theme element: text.

-
- -
-

Usage

-
element_text(
-  family = NULL,
-  face = NULL,
-  colour = NULL,
-  size = NULL,
-  hjust = NULL,
-  vjust = NULL,
-  angle = NULL,
-  lineheight = NULL,
-  color = NULL,
-  margin = NULL,
-  debug = NULL
-)
-
- -
-

Arguments

-
family
-

font family

- - -
face
-

font face ("plain", "italic", "bold", "bold.italic")

- - -
colour
-

text colour

- - -
size
-

text size (in pts)

- - -
hjust
-

horizontal justification (in [0, 1])

- - -
vjust
-

vertical justification (in [0, 1])

- - -
angle
-

angle (in [0, 360])

- - -
lineheight
-

line height

- - -
color
-

an alias for colour

- - -
margin
-

margins around the text. See margin for more -details. When creating a theme, the margins should be placed on the -side of the text facing towards the center of the plot.

- - -
debug
-

If TRUE, aids visual debugging by drawing a solid -rectangle behind the complete text area, and a point where each label -is anchored.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/expand_limits-1.png b/docs/reference/expand_limits-1.png deleted file mode 100644 index b7c1044fe..000000000 Binary files a/docs/reference/expand_limits-1.png and /dev/null differ diff --git a/docs/reference/expand_limits-2.png b/docs/reference/expand_limits-2.png deleted file mode 100644 index 8cc1e14df..000000000 Binary files a/docs/reference/expand_limits-2.png and /dev/null differ diff --git a/docs/reference/expand_limits-3.png b/docs/reference/expand_limits-3.png deleted file mode 100644 index 9e8780737..000000000 Binary files a/docs/reference/expand_limits-3.png and /dev/null differ diff --git a/docs/reference/expand_limits-4.png b/docs/reference/expand_limits-4.png deleted file mode 100644 index 767587d36..000000000 Binary files a/docs/reference/expand_limits-4.png and /dev/null differ diff --git a/docs/reference/expand_limits-5.png b/docs/reference/expand_limits-5.png deleted file mode 100644 index 67efea6a4..000000000 Binary files a/docs/reference/expand_limits-5.png and /dev/null differ diff --git a/docs/reference/expand_limits.html b/docs/reference/expand_limits.html deleted file mode 100644 index 7899bc55c..000000000 --- a/docs/reference/expand_limits.html +++ /dev/null @@ -1,110 +0,0 @@ - -Expand the plot limits with data. — expand_limits • animint2 - Skip to contents - - -
-
-
- -
-

panels or all plots. This function is a thin wrapper around -geom_blank that makes it easy to add such values.

-
- -
-

Usage

-
expand_limits(...)
-
- -
-

Arguments

-
...
-

named list of aesthetics specifying the value (or values) that -should be included in each scale.

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
-p + expand_limits(x = 0)
-
-p + expand_limits(y = c(1, 9))
-
-p + expand_limits(x = 0, y = 0)
-
-
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(colour = cyl)) +
-  expand_limits(colour = seq(2, 10, by = 2))
-
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(colour = factor(cyl))) +
-  expand_limits(colour = factor(seq(2, 10, by = 2)))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/facet.html b/docs/reference/facet.html deleted file mode 100644 index 0d64badb7..000000000 --- a/docs/reference/facet.html +++ /dev/null @@ -1,90 +0,0 @@ - -Facet specification. — facet • animint2 - Skip to contents - - -
-
-
- -
-

Create new facetting specification. For internal use only.

-
- -
-

Usage

-
facet(..., shrink = TRUE, subclass = c())
-
- -
-

Arguments

-
...
-

object fields

- - -
shrink
-

shrink scales to fit output of statistics, not raw data

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/facet_grid-1.png b/docs/reference/facet_grid-1.png deleted file mode 100644 index 90d9d0dc9..000000000 Binary files a/docs/reference/facet_grid-1.png and /dev/null differ diff --git a/docs/reference/facet_grid-10.png b/docs/reference/facet_grid-10.png deleted file mode 100644 index 4b07943a2..000000000 Binary files a/docs/reference/facet_grid-10.png and /dev/null differ diff --git a/docs/reference/facet_grid-11.png b/docs/reference/facet_grid-11.png deleted file mode 100644 index 2cdd66b91..000000000 Binary files a/docs/reference/facet_grid-11.png and /dev/null differ diff --git a/docs/reference/facet_grid-12.png b/docs/reference/facet_grid-12.png deleted file mode 100644 index 9b60e1ab1..000000000 Binary files a/docs/reference/facet_grid-12.png and /dev/null differ diff --git a/docs/reference/facet_grid-13.png b/docs/reference/facet_grid-13.png deleted file mode 100644 index 700ccd819..000000000 Binary files a/docs/reference/facet_grid-13.png and /dev/null differ diff --git a/docs/reference/facet_grid-14.png b/docs/reference/facet_grid-14.png deleted file mode 100644 index ef590cd6f..000000000 Binary files a/docs/reference/facet_grid-14.png and /dev/null differ diff --git a/docs/reference/facet_grid-15.png b/docs/reference/facet_grid-15.png deleted file mode 100644 index 785bebef6..000000000 Binary files a/docs/reference/facet_grid-15.png and /dev/null differ diff --git a/docs/reference/facet_grid-16.png b/docs/reference/facet_grid-16.png deleted file mode 100644 index 523c52a0e..000000000 Binary files a/docs/reference/facet_grid-16.png and /dev/null differ diff --git a/docs/reference/facet_grid-17.png b/docs/reference/facet_grid-17.png deleted file mode 100644 index 52bc92bdf..000000000 Binary files a/docs/reference/facet_grid-17.png and /dev/null differ diff --git a/docs/reference/facet_grid-18.png b/docs/reference/facet_grid-18.png deleted file mode 100644 index 87b2ef46d..000000000 Binary files a/docs/reference/facet_grid-18.png and /dev/null differ diff --git a/docs/reference/facet_grid-2.png b/docs/reference/facet_grid-2.png deleted file mode 100644 index 1cbb31842..000000000 Binary files a/docs/reference/facet_grid-2.png and /dev/null differ diff --git a/docs/reference/facet_grid-3.png b/docs/reference/facet_grid-3.png deleted file mode 100644 index 530690fca..000000000 Binary files a/docs/reference/facet_grid-3.png and /dev/null differ diff --git a/docs/reference/facet_grid-4.png b/docs/reference/facet_grid-4.png deleted file mode 100644 index 5eef4c24f..000000000 Binary files a/docs/reference/facet_grid-4.png and /dev/null differ diff --git a/docs/reference/facet_grid-5.png b/docs/reference/facet_grid-5.png deleted file mode 100644 index 6004f7a0f..000000000 Binary files a/docs/reference/facet_grid-5.png and /dev/null differ diff --git a/docs/reference/facet_grid-6.png b/docs/reference/facet_grid-6.png deleted file mode 100644 index a63808aa4..000000000 Binary files a/docs/reference/facet_grid-6.png and /dev/null differ diff --git a/docs/reference/facet_grid-7.png b/docs/reference/facet_grid-7.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/facet_grid-7.png and /dev/null differ diff --git a/docs/reference/facet_grid-8.png b/docs/reference/facet_grid-8.png deleted file mode 100644 index fe6435468..000000000 Binary files a/docs/reference/facet_grid-8.png and /dev/null differ diff --git a/docs/reference/facet_grid-9.png b/docs/reference/facet_grid-9.png deleted file mode 100644 index 945ec8e72..000000000 Binary files a/docs/reference/facet_grid-9.png and /dev/null differ diff --git a/docs/reference/facet_grid.html b/docs/reference/facet_grid.html deleted file mode 100644 index eabdb7f9e..000000000 --- a/docs/reference/facet_grid.html +++ /dev/null @@ -1,260 +0,0 @@ - -Lay out panels in a grid. — facet_grid • animint2 - Skip to contents - - -
-
-
- -
-

Lay out panels in a grid.

-
- -
-

Usage

-
facet_grid(
-  facets,
-  margins = FALSE,
-  scales = "fixed",
-  space = "fixed",
-  shrink = TRUE,
-  labeller = "label_value",
-  as.table = TRUE,
-  switch = NULL,
-  drop = TRUE
-)
-
- -
-

Arguments

-
facets
-

a formula with the rows (of the tabular display) on the LHS -and the columns (of the tabular display) on the RHS; the dot in the -formula is used to indicate there should be no faceting on this dimension -(either row or column). The formula can also be provided as a string -instead of a classical formula object

- - -
margins
-

either a logical value or a character -vector. Margins are additional facets which contain all the data -for each of the possible values of the faceting variables. If -FALSE, no additional facets are included (the -default). If TRUE, margins are included for all faceting -variables. If specified as a character vector, it is the names of -variables for which margins are to be created.

- - -
scales
-

Are scales shared across all facets (the default, -"fixed"), or do they vary across rows ("free_x"), -columns ("free_y"), or both rows and columns ("free")

- - -
space
-

If "fixed", the default, all panels have the same size. - If "free_y" their height will be proportional to the length of the - y scale; if "free_x" their width will be proportional to the -length of the x scale; or if "free" both height and width will -vary. This setting has no effect unless the appropriate scales also vary.

- - -
shrink
-

If TRUE, will shrink scales to fit output of -statistics, not raw data. If FALSE, will be range of raw data -before statistical summary.

- - -
labeller
-

A function that takes one data frame of labels and -returns a list or data frame of character vectors. Each input -column corresponds to one factor. Thus there will be more than -one with formulae of the type ~cyl + am. Each output -column gets displayed as one separate line in the strip -label. This function should inherit from the "labeller" S3 class -for compatibility with labeller(). See -label_value for more details and pointers to other -options.

- - -
as.table
-

If TRUE, the default, the facets are laid out like -a table with highest values at the bottom-right. If FALSE, the -facets are laid out like a plot with the highest value at the top-right.

- - -
switch
-

By default, the labels are displayed on the top and -right of the plot. If "x", the top labels will be -displayed to the bottom. If "y", the right-hand side -labels will be displayed to the left. Can also be set to -"both".

- - -
drop
-

If TRUE, the default, all factor levels not used in the -data will automatically be dropped. If FALSE, all factor levels -will be shown, regardless of whether or not they appear in the data.

- -
- -
-

Examples

-
p <- ggplot(mpg, aes(displ, cty)) + geom_point()
-
-p + facet_grid(. ~ cyl)
-
-p + facet_grid(drv ~ .)
-
-p + facet_grid(drv ~ cyl)
-
-
-# To change plot order of facet grid,
-# change the order of variable levels with factor()
-
-# If you combine a facetted dataset with a dataset that lacks those
-# facetting variables, the data will be repeated across the missing
-# combinations:
-df <- data.frame(displ = mean(mpg$displ), cty = mean(mpg$cty))
-p +
-  facet_grid(. ~ cyl) +
-  geom_point(data = df, colour = "red", size = 2)
-
-
-# Free scales -------------------------------------------------------
-# You can also choose whether the scales should be constant
-# across all panels (the default), or whether they should be allowed
-# to vary
-mt <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) +
-  geom_point()
-
-mt + facet_grid(. ~ cyl, scales = "free")
-
-
-# If scales and space are free, then the mapping between position
-# and values in the data will be the same across all panels. This
-# is particularly useful for categorical axes
-ggplot(mpg, aes(drv, model)) +
-  geom_point() +
-  facet_grid(manufacturer ~ ., scales = "free", space = "free") +
-  theme(strip.text.y = element_text(angle = 0))
-
-
-# Facet labels ------------------------------------------------------
-p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
-p
-
-
-# label_both() displays both variable name and value
-p + facet_grid(vs ~ cyl, labeller = label_both)
-
-
-# label_parsed() parses text into mathematical expressions, see ?plotmath
-mtcars$cyl2 <- factor(mtcars$cyl, labels = c("alpha", "beta", "sqrt(x, y)"))
-ggplot(mtcars, aes(wt, mpg)) +
-  geom_point() +
-  facet_grid(. ~ cyl2, labeller = label_parsed)
-
-
-# label_bquote() makes it easy to construct math expressions
-p + facet_grid(. ~ vs, labeller = label_bquote(cols = alpha ^ .(vs)))
-
-
-# The facet strips can be displayed near the axes with switch
-data <- transform(mtcars,
-  am = factor(am, levels = 0:1, c("Automatic", "Manual")),
-  gear = factor(gear, levels = 3:5, labels = c("Three", "Four", "Five"))
-)
-p <- ggplot(data, aes(mpg, disp)) + geom_point()
-p + facet_grid(am ~ gear, switch = "both")
-
-# It looks better without boxes around the strips
-p + facet_grid(am ~ gear, switch = "both") +
-  theme(strip.background = element_blank())
-
-
-# Margins ----------------------------------------------------------
-# \donttest{
-# Margins can be specified by logically (all yes or all no) or by specific
-# variables as (character) variable names
-mg <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point()
-mg + facet_grid(vs + am ~ gear)
-
-mg + facet_grid(vs + am ~ gear, margins = TRUE)
-
-mg + facet_grid(vs + am ~ gear, margins = "am")
-
-# when margins are made over "vs", since the facets for "am" vary
-# within the values of "vs", the marginal facet for "vs" is also
-# a margin over "am".
-mg + facet_grid(vs + am ~ gear, margins = "vs")
-
-mg + facet_grid(vs + am ~ gear, margins = "gear")
-
-mg + facet_grid(vs + am ~ gear, margins = c("gear", "am"))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/facet_null-1.png b/docs/reference/facet_null-1.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/facet_null-1.png and /dev/null differ diff --git a/docs/reference/facet_null.html b/docs/reference/facet_null.html deleted file mode 100644 index d6568cb3c..000000000 --- a/docs/reference/facet_null.html +++ /dev/null @@ -1,96 +0,0 @@ - -Facet specification: a single panel. — facet_null • animint2 - Skip to contents - - -
-
-
- -
-

Facet specification: a single panel.

-
- -
-

Usage

-
facet_null(shrink = TRUE)
-
- -
-

Arguments

-
shrink
-

If TRUE, will shrink scales to fit output of -statistics, not raw data. If FALSE, will be range of raw data -before statistical summary.

- -
- -
-

Examples

-
# facet_null is the default facetting specification if you
-# don't override it with facet_grid or facet_wrap
-ggplot(mtcars, aes(mpg, wt)) + geom_point()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/facet_wrap-1.png b/docs/reference/facet_wrap-1.png deleted file mode 100644 index 0ea3e668b..000000000 Binary files a/docs/reference/facet_wrap-1.png and /dev/null differ diff --git a/docs/reference/facet_wrap-2.png b/docs/reference/facet_wrap-2.png deleted file mode 100644 index 8da72e69e..000000000 Binary files a/docs/reference/facet_wrap-2.png and /dev/null differ diff --git a/docs/reference/facet_wrap-3.png b/docs/reference/facet_wrap-3.png deleted file mode 100644 index 861039208..000000000 Binary files a/docs/reference/facet_wrap-3.png and /dev/null differ diff --git a/docs/reference/facet_wrap-4.png b/docs/reference/facet_wrap-4.png deleted file mode 100644 index 861039208..000000000 Binary files a/docs/reference/facet_wrap-4.png and /dev/null differ diff --git a/docs/reference/facet_wrap-5.png b/docs/reference/facet_wrap-5.png deleted file mode 100644 index cb730e1d7..000000000 Binary files a/docs/reference/facet_wrap-5.png and /dev/null differ diff --git a/docs/reference/facet_wrap-6.png b/docs/reference/facet_wrap-6.png deleted file mode 100644 index cb857fc9e..000000000 Binary files a/docs/reference/facet_wrap-6.png and /dev/null differ diff --git a/docs/reference/facet_wrap-7.png b/docs/reference/facet_wrap-7.png deleted file mode 100644 index 3c663ac30..000000000 Binary files a/docs/reference/facet_wrap-7.png and /dev/null differ diff --git a/docs/reference/facet_wrap-8.png b/docs/reference/facet_wrap-8.png deleted file mode 100644 index 22aa36c75..000000000 Binary files a/docs/reference/facet_wrap-8.png and /dev/null differ diff --git a/docs/reference/facet_wrap-9.png b/docs/reference/facet_wrap-9.png deleted file mode 100644 index 8a248895a..000000000 Binary files a/docs/reference/facet_wrap-9.png and /dev/null differ diff --git a/docs/reference/facet_wrap.html b/docs/reference/facet_wrap.html deleted file mode 100644 index e9dd046c9..000000000 --- a/docs/reference/facet_wrap.html +++ /dev/null @@ -1,226 +0,0 @@ - -Wrap a 1d ribbon of panels into 2d. — facet_wrap • animint2 - Skip to contents - - -
-
-
- -
-

Most displays are roughly rectangular, so if you have a categorical -variable with many levels, it doesn't make sense to try and display them -all in one row (or one column). To solve this dilemma, facet_wrap -wraps a 1d sequence of panels into 2d, making best use of screen real estate.

-
- -
-

Usage

-
facet_wrap(
-  facets,
-  nrow = NULL,
-  ncol = NULL,
-  scales = "fixed",
-  shrink = TRUE,
-  labeller = "label_value",
-  as.table = TRUE,
-  switch = NULL,
-  drop = TRUE,
-  dir = "h"
-)
-
- -
-

Arguments

-
facets
-

Either a formula or character vector. Use either a -one sided formula, ~a + b, or a character vector, c("a", "b").

- - -
nrow, ncol
-

Number of rows and columns.

- - -
scales
-

should Scales be fixed ("fixed", the default), -free ("free"), or free in one dimension ("free_x", -"free_y").

- - -
shrink
-

If TRUE, will shrink scales to fit output of -statistics, not raw data. If FALSE, will be range of raw data -before statistical summary.

- - -
labeller
-

A function that takes one data frame of labels and -returns a list or data frame of character vectors. Each input -column corresponds to one factor. Thus there will be more than -one with formulae of the type ~cyl + am. Each output -column gets displayed as one separate line in the strip -label. This function should inherit from the "labeller" S3 class -for compatibility with labeller(). See -label_value for more details and pointers to other -options.

- - -
as.table
-

If TRUE, the default, the facets are laid out like -a table with highest values at the bottom-right. If FALSE, the -facets are laid out like a plot with the highest value at the top-right.

- - -
switch
-

By default, the labels are displayed on the top of -the plot. If switch is "x", they will be displayed -to the bottom. If "y", they will be displayed to the -left, near the y axis.

- - -
drop
-

If TRUE, the default, all factor levels not used in the -data will automatically be dropped. If FALSE, all factor levels -will be shown, regardless of whether or not they appear in the data.

- - -
dir
-

Direction: either "h" for horizontal, the default, or "v", for -vertical.

- -
- -
-

Examples

-
ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(~class)
-
-
-# Control the number of rows and columns with nrow and ncol
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(~class, nrow = 4)
-
-
-# \donttest{
-# You can facet by multiple variables
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(~ cyl + drv)
-
-# Or use a character vector:
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(c("cyl", "drv"))
-
-
-# Use the `labeller` option to control how labels are printed:
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(c("cyl", "drv"), labeller = "label_both")
-
-
-# To change the order in which the panels appear, change the levels
-# of the underlying factor.
-mpg$class2 <- reorder(mpg$class, mpg$displ)
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(~class2)
-
-
-# By default, the same scales are used for all panels. You can allow
-# scales to vary across the panels with the `scales` argument.
-# Free scales make it easier to see patterns within each panel, but
-# harder to compare across panels.
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  facet_wrap(~class, scales = "free")
-
-
-# To repeat the same data in every panel, simply construct a data frame
-# that does not contain the facetting variable.
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point(data = transform(mpg, class = NULL), colour = "grey85") +
-  geom_point() +
-  facet_wrap(~class)
-
-
-# Use `switch` to display the facet labels near an axis, acting as
-# a subtitle for this axis. This is typically used with free scales
-# and a theme without boxes around strip labels.
-ggplot(economics_long, aes(date, value)) +
-  geom_line() +
-  facet_wrap(~variable, scales = "free_y", nrow = 2, switch = "x") +
-  theme(strip.background = element_blank())
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/faithfuld.html b/docs/reference/faithfuld.html deleted file mode 100644 index 68c5619f1..000000000 --- a/docs/reference/faithfuld.html +++ /dev/null @@ -1,87 +0,0 @@ - -2d density estimate of Old Faithful data — faithfuld • animint2 - Skip to contents - - -
-
-
- -
-

A 2d density estimate of the waiting and eruptions variables data -faithful.

-
- -
-

Usage

-
faithfuld
-
- -
-

Format

-

A data frame with 5,625 observations and 3 variables.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/figures/world_bank_screencast.gif b/docs/reference/figures/world_bank_screencast.gif deleted file mode 100644 index 55f0e100e..000000000 Binary files a/docs/reference/figures/world_bank_screencast.gif and /dev/null differ diff --git a/docs/reference/format.gganimintproto.html b/docs/reference/format.gganimintproto.html deleted file mode 100644 index 6e6297f3d..000000000 --- a/docs/reference/format.gganimintproto.html +++ /dev/null @@ -1,97 +0,0 @@ - -Format a gganimintproto object — format.gganimintproto • animint2 - Skip to contents - - -
-
-
- -
-

Format a gganimintproto object

-
- -
-

Usage

-
# S3 method for gganimintproto
-format(x, ..., flat = TRUE)
-
- -
-

Arguments

-
x
-

A gganimintproto object to print.

- - -
...
-

If the gganimintproto object has a print method, further arguments -will be passed to it. Otherwise, these arguments are unused.

- - -
flat
-

If TRUE (the default), show a flattened list of all local -and inherited members. If FALSE, show the inheritance hierarchy.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/fortify.html b/docs/reference/fortify.html deleted file mode 100644 index 8984a3552..000000000 --- a/docs/reference/fortify.html +++ /dev/null @@ -1,104 +0,0 @@ - -Fortify a model with data. — fortify • animint2 - Skip to contents - - -
-
-
- -
-

Rather than using this function, I now recomend using the broom -package, which implements a much wider range of methods. fortify -may be deprecated in the future.

-
- -
-

Usage

-
fortify(model, data, ...)
-
- -
-

Arguments

-
model
-

model or other R object to convert to data frame

- - -
data
-

original dataset, if needed

- - -
...
-

other arguments passed to methods

- -
-
-

See also

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/fortify.lm-1.png b/docs/reference/fortify.lm-1.png deleted file mode 100644 index 0a25409eb..000000000 Binary files a/docs/reference/fortify.lm-1.png and /dev/null differ diff --git a/docs/reference/fortify.lm-10.png b/docs/reference/fortify.lm-10.png deleted file mode 100644 index 4e27d2725..000000000 Binary files a/docs/reference/fortify.lm-10.png and /dev/null differ diff --git a/docs/reference/fortify.lm-11.png b/docs/reference/fortify.lm-11.png deleted file mode 100644 index 91498441a..000000000 Binary files a/docs/reference/fortify.lm-11.png and /dev/null differ diff --git a/docs/reference/fortify.lm-12.png b/docs/reference/fortify.lm-12.png deleted file mode 100644 index 0d80dec87..000000000 Binary files a/docs/reference/fortify.lm-12.png and /dev/null differ diff --git a/docs/reference/fortify.lm-13.png b/docs/reference/fortify.lm-13.png deleted file mode 100644 index 82a414c42..000000000 Binary files a/docs/reference/fortify.lm-13.png and /dev/null differ diff --git a/docs/reference/fortify.lm-14.png b/docs/reference/fortify.lm-14.png deleted file mode 100644 index 96ba67f62..000000000 Binary files a/docs/reference/fortify.lm-14.png and /dev/null differ diff --git a/docs/reference/fortify.lm-15.png b/docs/reference/fortify.lm-15.png deleted file mode 100644 index 2f8303502..000000000 Binary files a/docs/reference/fortify.lm-15.png and /dev/null differ diff --git a/docs/reference/fortify.lm-16.png b/docs/reference/fortify.lm-16.png deleted file mode 100644 index 15c3dee2f..000000000 Binary files a/docs/reference/fortify.lm-16.png and /dev/null differ diff --git a/docs/reference/fortify.lm-17.png b/docs/reference/fortify.lm-17.png deleted file mode 100644 index ad8a1b99d..000000000 Binary files a/docs/reference/fortify.lm-17.png and /dev/null differ diff --git a/docs/reference/fortify.lm-2.png b/docs/reference/fortify.lm-2.png deleted file mode 100644 index 467073d12..000000000 Binary files a/docs/reference/fortify.lm-2.png and /dev/null differ diff --git a/docs/reference/fortify.lm-3.png b/docs/reference/fortify.lm-3.png deleted file mode 100644 index 695f175cb..000000000 Binary files a/docs/reference/fortify.lm-3.png and /dev/null differ diff --git a/docs/reference/fortify.lm-4.png b/docs/reference/fortify.lm-4.png deleted file mode 100644 index ec84ff8cc..000000000 Binary files a/docs/reference/fortify.lm-4.png and /dev/null differ diff --git a/docs/reference/fortify.lm-5.png b/docs/reference/fortify.lm-5.png deleted file mode 100644 index 41d1f79af..000000000 Binary files a/docs/reference/fortify.lm-5.png and /dev/null differ diff --git a/docs/reference/fortify.lm-6.png b/docs/reference/fortify.lm-6.png deleted file mode 100644 index c04580001..000000000 Binary files a/docs/reference/fortify.lm-6.png and /dev/null differ diff --git a/docs/reference/fortify.lm-7.png b/docs/reference/fortify.lm-7.png deleted file mode 100644 index 9760d3d87..000000000 Binary files a/docs/reference/fortify.lm-7.png and /dev/null differ diff --git a/docs/reference/fortify.lm-8.png b/docs/reference/fortify.lm-8.png deleted file mode 100644 index 9bc412eb1..000000000 Binary files a/docs/reference/fortify.lm-8.png and /dev/null differ diff --git a/docs/reference/fortify.lm-9.png b/docs/reference/fortify.lm-9.png deleted file mode 100644 index 52989cc38..000000000 Binary files a/docs/reference/fortify.lm-9.png and /dev/null differ diff --git a/docs/reference/fortify.lm.html b/docs/reference/fortify.lm.html deleted file mode 100644 index 7ecac01c2..000000000 --- a/docs/reference/fortify.lm.html +++ /dev/null @@ -1,228 +0,0 @@ - -Supplement the data fitted to a linear model with model fit statistics. — fortify.lm • animint2 - Skip to contents - - -
-
-
- -
-

If you have missing values in your model data, you may need to refit -the model with na.action = na.exclude.

-
- -
-

Usage

-
# S3 method for lm
-fortify(model, data = model$model, ...)
-
- -
-

Arguments

-
model
-

linear model

- - -
data
-

data set, defaults to data used to fit model

- - -
...
-

not used by this method

- -
-
-

Value

- - -

The original data with extra columns:

-
.hat
-

Diagonal of the hat matrix

- -
.sigma
-

Estimate of residual standard deviation when - corresponding observation is dropped from model

- -
.cooksd
-

Cooks distance, cooks.distance

- -
.fitted
-

Fitted values of model

- -
.resid
-

Residuals

- -
.stdresid
-

Standardised residuals

- -
- -
-

Examples

-
mod <- lm(mpg ~ wt, data = mtcars)
-head(fortify(mod))
-#>                    mpg    wt       .hat   .sigma      .cooksd  .fitted
-#> Mazda RX4         21.0 2.620 0.04326896 3.067494 1.327407e-02 23.28261
-#> Mazda RX4 Wag     21.0 2.875 0.03519677 3.093068 1.723963e-03 21.91977
-#> Datsun 710        22.8 2.320 0.05837573 3.072127 1.543937e-02 24.88595
-#> Hornet 4 Drive    21.4 3.215 0.03125017 3.088268 3.020558e-03 20.10265
-#> Hornet Sportabout 18.7 3.440 0.03292182 3.097722 7.599578e-05 18.90014
-#> Valiant           18.1 3.460 0.03323551 3.095184 9.210650e-04 18.79325
-#>                       .resid   .stdresid
-#> Mazda RX4         -2.2826106 -0.76616765
-#> Mazda RX4 Wag     -0.9197704 -0.30743051
-#> Datsun 710        -2.0859521 -0.70575249
-#> Hornet 4 Drive     1.2973499  0.43275114
-#> Hornet Sportabout -0.2001440 -0.06681879
-#> Valiant           -0.6932545 -0.23148309
-head(fortify(mod, mtcars))
-#>                    mpg cyl disp  hp drat    wt  qsec vs am gear carb       .hat
-#> Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4 0.04326896
-#> Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4 0.03519677
-#> Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1 0.05837573
-#> Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1 0.03125017
-#> Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2 0.03292182
-#> Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1 0.03323551
-#>                     .sigma      .cooksd  .fitted     .resid   .stdresid
-#> Mazda RX4         3.067494 1.327407e-02 23.28261 -2.2826106 -0.76616765
-#> Mazda RX4 Wag     3.093068 1.723963e-03 21.91977 -0.9197704 -0.30743051
-#> Datsun 710        3.072127 1.543937e-02 24.88595 -2.0859521 -0.70575249
-#> Hornet 4 Drive    3.088268 3.020558e-03 20.10265  1.2973499  0.43275114
-#> Hornet Sportabout 3.097722 7.599578e-05 18.90014 -0.2001440 -0.06681879
-#> Valiant           3.095184 9.210650e-04 18.79325 -0.6932545 -0.23148309
-
-plot(mod, which = 1)
-
-
-ggplot(mod, aes(.fitted, .resid)) +
-  geom_point() +
-  geom_hline(yintercept = 0) +
-  geom_smooth(se = FALSE)
-
-
-ggplot(mod, aes(.fitted, .stdresid)) +
-  geom_point() +
-  geom_hline(yintercept = 0) +
-  geom_smooth(se = FALSE)
-
-
-ggplot(fortify(mod, mtcars), aes(.fitted, .stdresid)) +
-  geom_point(aes(colour = factor(cyl)))
-
-
-ggplot(fortify(mod, mtcars), aes(mpg, .stdresid)) +
-  geom_point(aes(colour = factor(cyl)))
-
-
-plot(mod, which = 2)
-
-ggplot(mod) +
-  stat_qq(aes(sample = .stdresid)) +
-  geom_abline()
-
-
-plot(mod, which = 3)
-
-ggplot(mod, aes(.fitted, sqrt(abs(.stdresid)))) +
-  geom_point() +
-  geom_smooth(se = FALSE)
-
-
-plot(mod, which = 4)
-
-ggplot(mod, aes(seq_along(.cooksd), .cooksd)) +
-  geom_bar(stat = "identity")
-
-
-plot(mod, which = 5)
-
-ggplot(mod, aes(.hat, .stdresid)) +
-  geom_vline(size = 2, colour = "white", xintercept = 0) +
-  geom_hline(size = 2, colour = "white", yintercept = 0) +
-  geom_point() + geom_smooth(se = FALSE)
-
-
-ggplot(mod, aes(.hat, .stdresid)) +
-  geom_point(aes(size = .cooksd)) +
-  geom_smooth(se = FALSE, size = 0.5)
-
-
-plot(mod, which = 6)
-
-ggplot(mod, aes(.hat, .cooksd)) +
-  geom_vline(xintercept = 0, colour = NA) +
-  geom_abline(slope = seq(0, 3, by = 0.5), colour = "white") +
-  geom_smooth(se = FALSE) +
-  geom_point()
-
-
-ggplot(mod, aes(.hat, .cooksd)) +
-  geom_point(aes(size = .cooksd / .hat)) +
-  scale_size_area()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/fortify.map-1.png b/docs/reference/fortify.map-1.png deleted file mode 100644 index 35ce131fa..000000000 Binary files a/docs/reference/fortify.map-1.png and /dev/null differ diff --git a/docs/reference/fortify.map.html b/docs/reference/fortify.map.html deleted file mode 100644 index 870c8ea13..000000000 --- a/docs/reference/fortify.map.html +++ /dev/null @@ -1,118 +0,0 @@ - -Fortify method for map objects. — fortify.map • animint2 - Skip to contents - - -
-
-
- -
-

This function turns a map into a data frame that can more easily be -plotted with ggplot2.

-
- -
-

Usage

-
# S3 method for map
-fortify(model, data, ...)
-
- -
-

Arguments

-
model
-

map object

- - -
data
-

not used by this method

- - -
...
-

not used by this method

- -
-
-

See also

- -
- -
-

Examples

-
if (require("maps")) {
-ca <- map("county", "ca", plot = FALSE, fill = TRUE)
-head(fortify(ca))
-ggplot(ca, aes(long, lat)) +
-  geom_polygon(aes(group = group))
-
-tx <- map("county", "texas", plot = FALSE, fill = TRUE)
-head(fortify(tx))
-ggplot(tx, aes(long, lat)) +
-  geom_polygon(aes(group = group), colour = "white")
-}
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/fortify.sp.html b/docs/reference/fortify.sp.html deleted file mode 100644 index 1268c35f2..000000000 --- a/docs/reference/fortify.sp.html +++ /dev/null @@ -1,116 +0,0 @@ - -Fortify method for classes from the sp package. — fortify.sp • animint2 - Skip to contents - - -
-
-
- -
-

To figure out the correct variable name for region, inspect -as.data.frame(model).

-
- -
-

Usage

-
# S3 method for SpatialPolygonsDataFrame
-fortify(model, data, ...)
-
-# S3 method for SpatialPolygons
-fortify(model, data, ...)
-
-# S3 method for Polygons
-fortify(model, data, ...)
-
-# S3 method for Polygon
-fortify(model, data, ...)
-
-# S3 method for SpatialLinesDataFrame
-fortify(model, data, ...)
-
-# S3 method for Lines
-fortify(model, data, ...)
-
-# S3 method for Line
-fortify(model, data, ...)
-
- -
-

Arguments

-
model
-

SpatialPolygonsDataFrame to convert into a dataframe.

- - -
data
-

not used by this method

- - -
...
-

not used by this method

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/g_train_layout.html b/docs/reference/g_train_layout.html deleted file mode 100644 index 842fe4d90..000000000 --- a/docs/reference/g_train_layout.html +++ /dev/null @@ -1,118 +0,0 @@ - -Learn the layout of panels within a plot. — g_train_layout • animint2 - Skip to contents - - -
-
-
- -
-

This is determined by the facet, which returns a data frame, than -when joined to the data to be plotted tells us which panel it should -appear in, where that panel appears in the grid, and what scales it -uses.

-
- -
-

Usage

-
g_train_layout(panel, facet, data, plot_data)
-
- -
-

Arguments

-
panel
-

the panel object to train

- - -
facet
-

the facetting specification

- - -
data
-

a list of data frames (one for each layer), and one for the plot

- - -
plot_data
-

the default data frame

- -
-
-

Value

- - -

an updated panel object

-
-
-

Details

-

As well as the layout info, this function also adds empty lists in which -to house the x and y scales.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/generation.loci.html b/docs/reference/generation.loci.html deleted file mode 100644 index 8638c12af..000000000 --- a/docs/reference/generation.loci.html +++ /dev/null @@ -1,110 +0,0 @@ - -Evolution simulation — generation.loci • animint2 - Skip to contents - - -
-
-
- -
-

Allele frequencies for 100 loci and 12 populations were simulated - over 100 generations.

-
- -
-

Usage

-
data(generation.loci)
-
- -
-

Format

-

A data frame with 120000 observations on the following 4 variables.

locus
-

a numeric vector

- -
population
-

a numeric vector

- -
generation
-

a numeric vector

- -
frequency
-

a numeric vector

- -
color
-

factor: blue, red, or neutral

- -
type
-

factor: balancing, none, or positive

- - -
-
-

Source

-

Data generated using nicholsonppp::sim.drift.selection, see code in -etc/generation.loci.R.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_abline-1.png b/docs/reference/geom_abline-1.png deleted file mode 100644 index 7bab931c8..000000000 Binary files a/docs/reference/geom_abline-1.png and /dev/null differ diff --git a/docs/reference/geom_abline-2.png b/docs/reference/geom_abline-2.png deleted file mode 100644 index d08828be9..000000000 Binary files a/docs/reference/geom_abline-2.png and /dev/null differ diff --git a/docs/reference/geom_abline-3.png b/docs/reference/geom_abline-3.png deleted file mode 100644 index 6b7d0471a..000000000 Binary files a/docs/reference/geom_abline-3.png and /dev/null differ diff --git a/docs/reference/geom_abline-4.png b/docs/reference/geom_abline-4.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/geom_abline-4.png and /dev/null differ diff --git a/docs/reference/geom_abline-5.png b/docs/reference/geom_abline-5.png deleted file mode 100644 index f9ccb9826..000000000 Binary files a/docs/reference/geom_abline-5.png and /dev/null differ diff --git a/docs/reference/geom_abline-6.png b/docs/reference/geom_abline-6.png deleted file mode 100644 index 4edbfb613..000000000 Binary files a/docs/reference/geom_abline-6.png and /dev/null differ diff --git a/docs/reference/geom_abline-7.png b/docs/reference/geom_abline-7.png deleted file mode 100644 index 856795119..000000000 Binary files a/docs/reference/geom_abline-7.png and /dev/null differ diff --git a/docs/reference/geom_abline-8.png b/docs/reference/geom_abline-8.png deleted file mode 100644 index 4dd5cd76d..000000000 Binary files a/docs/reference/geom_abline-8.png and /dev/null differ diff --git a/docs/reference/geom_abline-9.png b/docs/reference/geom_abline-9.png deleted file mode 100644 index 2f6c0c17b..000000000 Binary files a/docs/reference/geom_abline-9.png and /dev/null differ diff --git a/docs/reference/geom_abline.html b/docs/reference/geom_abline.html deleted file mode 100644 index e6e6e6da4..000000000 --- a/docs/reference/geom_abline.html +++ /dev/null @@ -1,231 +0,0 @@ - -Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline • animint2 - Skip to contents - - -
-
-
- -
-

These paired geoms and stats add straight lines to a plot, either -horizontal, vertical or specified by slope and intercept. These are useful -for annotating plots.

-
- -
-

Usage

-
geom_abline(
-  mapping = NULL,
-  data = NULL,
-  ...,
-  slope,
-  intercept,
-  na.rm = FALSE,
-  show.legend = NA
-)
-
-geom_hline(
-  mapping = NULL,
-  data = NULL,
-  ...,
-  yintercept,
-  na.rm = FALSE,
-  show.legend = NA
-)
-
-geom_vline(
-  mapping = NULL,
-  data = NULL,
-  ...,
-  xintercept,
-  na.rm = FALSE,
-  show.legend = NA
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
xintercept, yintercept, slope, intercept
-

Parameters that control the -position of the line. If these are set, data, mapping and -show.legend are overridden

- -
-
-

Details

-

These geoms act slightly different to other geoms. You can supply the -parameters in two ways: either as arguments to the layer function, -or via aesthetics. If you use arguments, e.g. -geom_abline(intercept = 0, slope = 1), then behind the scenes -the geom makes a new data frame containing just the data you've supplied. -That means that the lines will be the same in all facets; if you want them -to vary across facets, construct the data frame yourself and use aesthetics.

-

Unlike most other geoms, these geoms do not inherit aesthetics from the plot -default, because they do not understand x and y aesthetics which are -commonly set in the plot. They also do not affect the x and y scales.

-
-
-

Aesthetics

- - -

These geoms are drawn using with geom_line so support the -same aesthetics: alpha, colour, linetype and size. They also each have -aesthetics that control the position of the line:

-
  • geom_vline: xintercept

  • -
  • geom_hline: yintercept

  • -
  • geom_abline: slope and intercept

  • -
-
-

See also

-

See geom_segment for a more general approach to - adding straight line segments to a plot.

-
- -
-

Examples

-
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
-
-# Fixed values
-p + geom_vline(xintercept = 5)
-
-p + geom_vline(xintercept = 1:5)
-
-p + geom_hline(yintercept = 20)
-
-
-p + geom_abline() # Can't see it - outside the range of the data
-
-p + geom_abline(intercept = 20)
-
-
-# Calculate slope and intercept of line of best fit
-coef(lm(mpg ~ wt, data = mtcars))
-#> (Intercept)          wt 
-#>   37.285126   -5.344472 
-p + geom_abline(intercept = 37, slope = -5)
-
-# But this is easier to do with geom_smooth:
-p + geom_smooth(method = "lm", se = FALSE)
-
-
-# To show different lines in different facets, use aesthetics
-p <- ggplot(mtcars, aes(mpg, wt)) +
-  geom_point() +
-  facet_wrap(~ cyl)
-
-mean_wt <- data.frame(cyl = c(4, 6, 8), wt = c(2.28, 3.11, 4.00))
-p + geom_hline(aes(yintercept = wt), mean_wt)
-
-
-# You can also control other aesthetics
-ggplot(mtcars, aes(mpg, wt, colour = wt)) +
-  geom_point() +
-  geom_hline(aes(yintercept = wt, colour = wt), mean_wt) +
-  facet_wrap(~ cyl)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_bar-1.png b/docs/reference/geom_bar-1.png deleted file mode 100644 index da5887dfc..000000000 Binary files a/docs/reference/geom_bar-1.png and /dev/null differ diff --git a/docs/reference/geom_bar-10.png b/docs/reference/geom_bar-10.png deleted file mode 100644 index d54796f8b..000000000 Binary files a/docs/reference/geom_bar-10.png and /dev/null differ diff --git a/docs/reference/geom_bar-2.png b/docs/reference/geom_bar-2.png deleted file mode 100644 index e705b0864..000000000 Binary files a/docs/reference/geom_bar-2.png and /dev/null differ diff --git a/docs/reference/geom_bar-3.png b/docs/reference/geom_bar-3.png deleted file mode 100644 index af6efd178..000000000 Binary files a/docs/reference/geom_bar-3.png and /dev/null differ diff --git a/docs/reference/geom_bar-4.png b/docs/reference/geom_bar-4.png deleted file mode 100644 index aafd28ac2..000000000 Binary files a/docs/reference/geom_bar-4.png and /dev/null differ diff --git a/docs/reference/geom_bar-5.png b/docs/reference/geom_bar-5.png deleted file mode 100644 index 75257af5f..000000000 Binary files a/docs/reference/geom_bar-5.png and /dev/null differ diff --git a/docs/reference/geom_bar-6.png b/docs/reference/geom_bar-6.png deleted file mode 100644 index 6b5f60032..000000000 Binary files a/docs/reference/geom_bar-6.png and /dev/null differ diff --git a/docs/reference/geom_bar-7.png b/docs/reference/geom_bar-7.png deleted file mode 100644 index c57fb0697..000000000 Binary files a/docs/reference/geom_bar-7.png and /dev/null differ diff --git a/docs/reference/geom_bar-8.png b/docs/reference/geom_bar-8.png deleted file mode 100644 index aac5dc576..000000000 Binary files a/docs/reference/geom_bar-8.png and /dev/null differ diff --git a/docs/reference/geom_bar-9.png b/docs/reference/geom_bar-9.png deleted file mode 100644 index e557ab0dd..000000000 Binary files a/docs/reference/geom_bar-9.png and /dev/null differ diff --git a/docs/reference/geom_bar.html b/docs/reference/geom_bar.html deleted file mode 100644 index f2af6ec2d..000000000 --- a/docs/reference/geom_bar.html +++ /dev/null @@ -1,282 +0,0 @@ - -Bars, rectangles with bases on x-axis — geom_bar • animint2 - Skip to contents - - -
-
-
- -
-

There are two types of bar charts, determined by what is mapped to bar -height. By default, geom_bar uses stat="count" which makes the -height of the bar proportion to the number of cases in each group (or if the -weight aethetic is supplied, the sum of the weights). If you want the -heights of the bars to represent values in the data, use -stat="identity" and map a variable to the y aesthetic.

-
- -
-

Usage

-
geom_bar(
-  mapping = NULL,
-  data = NULL,
-  stat = "count",
-  position = "stack",
-  ...,
-  width = NULL,
-  binwidth = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_count(
-  mapping = NULL,
-  data = NULL,
-  geom = "bar",
-  position = "stack",
-  ...,
-  width = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
width
-

Bar width. By default, set to 90% of the resolution of the data.

- - -
binwidth
-

geom_bar no longer has a binwidth argument - if -you use it you'll get an warning telling to you use -geom_histogram instead.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Override the default connection between geom_bar and -stat_count.

- -
-
-

Details

-

A bar chart maps the height of the bar to a variable, and so the base of the -bar must always be shown to produce a valid visual comparison. This is why it doesn't make sense to use a log-scaled y axis with a -bar chart.

-

By default, multiple x's occurring in the same place will be stacked atop one -another by position_stack. If you want them to be dodged -side-to-side, see position_dodge. Finally, -position_fill shows relative proportions at each x by stacking -the bars and then stretching or squashing to the same height.

-
-
-

Aesthetics

- - -

geom_bar understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
-
-

Computed variables

- - -
count
-

number of points in bin

- -
prop
-

groupwise proportion

- - -
-
-

See also

-

geom_histogram for continuous data, - position_dodge for creating side-by-side barcharts.

-

stat_bin, which bins data in ranges and counts the - cases in each range. It differs from stat_count, which counts the - number of cases at each x position (without binning into ranges). - stat_bin requires continuous x data, whereas - stat_count can be used for both discrete and continuous x data.

-
- -
-

Examples

-
# geom_bar is designed to make it easy to create bar charts that show
-# counts (or sums of weights)
-g <- ggplot(mpg, aes(class))
-# Number of cars in each class:
-g + geom_bar()
-
-# Total engine displacement of each class
-g + geom_bar(aes(weight = displ))
-
-
-# To show (e.g.) means, you need stat = "identity"
-df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
-ggplot(df, aes(trt, outcome)) +
-  geom_bar(stat = "identity")
-
-# But geom_point() display exactly the same information and doesn't
-# require the y-axis to touch zero.
-ggplot(df, aes(trt, outcome)) +
-  geom_point()
-
-
-# You can also use geom_bar() with continuous data, in which case
-# it will show counts at unique locations
-df <- data.frame(x = rep(c(2.9, 3.1, 4.5), c(5, 10, 4)))
-ggplot(df, aes(x)) + geom_bar()
-
-# cf. a histogram of the same data
-ggplot(df, aes(x)) + geom_histogram(binwidth = 0.5)
-
-
-# \donttest{
-# Bar charts are automatically stacked when multiple bars are placed
-# at the same location
-g + geom_bar(aes(fill = drv))
-
-
-# You can instead dodge, or fill them
-g + geom_bar(aes(fill = drv), position = "dodge")
-
-g + geom_bar(aes(fill = drv), position = "fill")
-
-
-# To change plot order of bars, change levels in underlying factor
-reorder_size <- function(x) {
-  factor(x, levels = names(sort(table(x))))
-}
-ggplot(mpg, aes(reorder_size(class))) + geom_bar()
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_bin2d-1.png b/docs/reference/geom_bin2d-1.png deleted file mode 100644 index 5d0876cef..000000000 Binary files a/docs/reference/geom_bin2d-1.png and /dev/null differ diff --git a/docs/reference/geom_bin2d-2.png b/docs/reference/geom_bin2d-2.png deleted file mode 100644 index 9b0bc5883..000000000 Binary files a/docs/reference/geom_bin2d-2.png and /dev/null differ diff --git a/docs/reference/geom_bin2d-3.png b/docs/reference/geom_bin2d-3.png deleted file mode 100644 index 5d0876cef..000000000 Binary files a/docs/reference/geom_bin2d-3.png and /dev/null differ diff --git a/docs/reference/geom_bin2d-4.png b/docs/reference/geom_bin2d-4.png deleted file mode 100644 index affdd9617..000000000 Binary files a/docs/reference/geom_bin2d-4.png and /dev/null differ diff --git a/docs/reference/geom_bin2d.html b/docs/reference/geom_bin2d.html deleted file mode 100644 index 419d59d51..000000000 --- a/docs/reference/geom_bin2d.html +++ /dev/null @@ -1,209 +0,0 @@ - -Add heatmap of 2d bin counts. — geom_bin2d • animint2 - Skip to contents - - -
-
-
- -
-

Add heatmap of 2d bin counts.

-
- -
-

Usage

-
geom_bin2d(
-  mapping = NULL,
-  data = NULL,
-  stat = "bin2d",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_bin_2d(
-  mapping = NULL,
-  data = NULL,
-  geom = "tile",
-  position = "identity",
-  ...,
-  bins = 30,
-  binwidth = NULL,
-  drop = TRUE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Use to override the default connection between -geom_bin2d and stat_bin2d.

- - -
bins
-

numeric vector giving number of bins in both vertical and -horizontal directions. Set to 30 by default.

- - -
binwidth
-

Numeric vector giving bin width in both vertical and -horizontal directions. Overrides bins if both set.

- - -
drop
-

if TRUE removes all cells with 0 counts.

- -
-
-

Aesthetics

- - -

stat_bin2d understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • fill

  • -
-
-

See also

-

stat_binhex for hexagonal binning

-
- -
-

Examples

-
d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
-d + geom_bin2d()
-#> Warning: Removed 478 rows containing non-finite values (stat_bin2d).
-
-
-# You can control the size of the bins by specifying the number of
-# bins in each direction:
-d + geom_bin2d(bins = 10)
-#> Warning: Removed 478 rows containing non-finite values (stat_bin2d).
-#> Warning: Removed 4 rows containing missing values (geom_bin2d).
-
-d + geom_bin2d(bins = 30)
-#> Warning: Removed 478 rows containing non-finite values (stat_bin2d).
-
-
-# Or by specifying the width of the bins
-d + geom_bin2d(binwidth = c(0.1, 0.1))
-#> Warning: Removed 478 rows containing non-finite values (stat_bin2d).
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_blank-1.png b/docs/reference/geom_blank-1.png deleted file mode 100644 index 838d31f24..000000000 Binary files a/docs/reference/geom_blank-1.png and /dev/null differ diff --git a/docs/reference/geom_blank.html b/docs/reference/geom_blank.html deleted file mode 100644 index 75b8e6bab..000000000 --- a/docs/reference/geom_blank.html +++ /dev/null @@ -1,150 +0,0 @@ - -Blank, draws nothing. — geom_blank • animint2 - Skip to contents - - -
-
-
- -
-

The blank geom draws nothing, but can be a useful way of ensuring common -scales between different plots.

-
- -
-

Usage

-
geom_blank(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
- -
-

Examples

-
ggplot(mtcars, aes(wt, mpg))
-
-# Nothing to see here!
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_contour-1.png b/docs/reference/geom_contour-1.png deleted file mode 100644 index 210fcf7d0..000000000 Binary files a/docs/reference/geom_contour-1.png and /dev/null differ diff --git a/docs/reference/geom_contour-2.png b/docs/reference/geom_contour-2.png deleted file mode 100644 index 7d8b6837f..000000000 Binary files a/docs/reference/geom_contour-2.png and /dev/null differ diff --git a/docs/reference/geom_contour-3.png b/docs/reference/geom_contour-3.png deleted file mode 100644 index 4a158902b..000000000 Binary files a/docs/reference/geom_contour-3.png and /dev/null differ diff --git a/docs/reference/geom_contour-4.png b/docs/reference/geom_contour-4.png deleted file mode 100644 index 4e29f7540..000000000 Binary files a/docs/reference/geom_contour-4.png and /dev/null differ diff --git a/docs/reference/geom_contour-5.png b/docs/reference/geom_contour-5.png deleted file mode 100644 index d3049f3e8..000000000 Binary files a/docs/reference/geom_contour-5.png and /dev/null differ diff --git a/docs/reference/geom_contour-6.png b/docs/reference/geom_contour-6.png deleted file mode 100644 index f8c055e6d..000000000 Binary files a/docs/reference/geom_contour-6.png and /dev/null differ diff --git a/docs/reference/geom_contour-7.png b/docs/reference/geom_contour-7.png deleted file mode 100644 index 7f6ee9fe4..000000000 Binary files a/docs/reference/geom_contour-7.png and /dev/null differ diff --git a/docs/reference/geom_contour-8.png b/docs/reference/geom_contour-8.png deleted file mode 100644 index 3cafd7a34..000000000 Binary files a/docs/reference/geom_contour-8.png and /dev/null differ diff --git a/docs/reference/geom_contour-9.png b/docs/reference/geom_contour-9.png deleted file mode 100644 index bd6ef59e7..000000000 Binary files a/docs/reference/geom_contour-9.png and /dev/null differ diff --git a/docs/reference/geom_contour.html b/docs/reference/geom_contour.html deleted file mode 100644 index c357fb395..000000000 --- a/docs/reference/geom_contour.html +++ /dev/null @@ -1,238 +0,0 @@ - -Display contours of a 3d surface in 2d. — geom_contour • animint2 - Skip to contents - - -
-
-
- -
-

Display contours of a 3d surface in 2d.

-
- -
-

Usage

-
geom_contour(
-  mapping = NULL,
-  data = NULL,
-  stat = "contour",
-  position = "identity",
-  ...,
-  lineend = "butt",
-  linejoin = "round",
-  linemitre = 1,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_contour(
-  mapping = NULL,
-  data = NULL,
-  geom = "contour",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
lineend
-

Line end style (round, butt, square)

- - -
linejoin
-

Line join style (round, mitre, bevel)

- - -
linemitre
-

Line mitre limit (number greater than 1)

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom
-

The geometric object to use display the data

- -
-
-

Aesthetics

- - -

geom_contour understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
  • weight

  • -
-
-

Computed variables

- - -
level
-

height of contour

- - -
-
-

See also

-

geom_density_2d: 2d density contours

-
- -
-

Examples

-
#' # Basic plot
-v <- ggplot(faithfuld, aes(waiting, eruptions, z = density))
-v + geom_contour()
-
-
-# Or compute from raw data
-ggplot(faithful, aes(waiting, eruptions)) +
-  geom_density_2d()
-
-
-# \donttest{
-# Setting bins creates evenly spaced contours in the range of the data
-v + geom_contour(bins = 2)
-
-v + geom_contour(bins = 10)
-
-
-# Setting binwidth does the same thing, parameterised by the distance
-# between contours
-v + geom_contour(binwidth = 0.01)
-
-v + geom_contour(binwidth = 0.001)
-
-
-# Other parameters
-v + geom_contour(aes(colour = ..level..))
-
-v + geom_contour(colour = "red")
-
-v + geom_raster(aes(fill = density)) +
-  geom_contour(colour = "white")
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_count-1.png b/docs/reference/geom_count-1.png deleted file mode 100644 index 8b0be8c63..000000000 Binary files a/docs/reference/geom_count-1.png and /dev/null differ diff --git a/docs/reference/geom_count-2.png b/docs/reference/geom_count-2.png deleted file mode 100644 index 7c25af763..000000000 Binary files a/docs/reference/geom_count-2.png and /dev/null differ diff --git a/docs/reference/geom_count-3.png b/docs/reference/geom_count-3.png deleted file mode 100644 index 7c25af763..000000000 Binary files a/docs/reference/geom_count-3.png and /dev/null differ diff --git a/docs/reference/geom_count-4.png b/docs/reference/geom_count-4.png deleted file mode 100644 index c12f93cc9..000000000 Binary files a/docs/reference/geom_count-4.png and /dev/null differ diff --git a/docs/reference/geom_count-5.png b/docs/reference/geom_count-5.png deleted file mode 100644 index 98b47f621..000000000 Binary files a/docs/reference/geom_count-5.png and /dev/null differ diff --git a/docs/reference/geom_count-6.png b/docs/reference/geom_count-6.png deleted file mode 100644 index 064e99118..000000000 Binary files a/docs/reference/geom_count-6.png and /dev/null differ diff --git a/docs/reference/geom_count-7.png b/docs/reference/geom_count-7.png deleted file mode 100644 index c4775b2fd..000000000 Binary files a/docs/reference/geom_count-7.png and /dev/null differ diff --git a/docs/reference/geom_count.html b/docs/reference/geom_count.html deleted file mode 100644 index de20d8eb7..000000000 --- a/docs/reference/geom_count.html +++ /dev/null @@ -1,231 +0,0 @@ - -Count the number of observations at each location. — geom_count • animint2 - Skip to contents - - -
-
-
- -
-

This is a variant geom_point that counts the number of -observations at each location, then maps the count to point size. It -useful when you have discrete data.

-
- -
-

Usage

-
geom_count(
-  mapping = NULL,
-  data = NULL,
-  stat = "sum",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_sum(
-  mapping = NULL,
-  data = NULL,
-  geom = "point",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Use to override the default connection between -geom_count and stat_sum.

- -
-
-

Aesthetics

- - -

geom_point understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • shape

  • -
  • size

  • -
  • stroke

  • -
-
-

Computed variables

- - -
n
-

number of observations at position

- -
prop
-

percent of points in that panel at that position

- - -
- -
-

Examples

-
ggplot(mpg, aes(cty, hwy)) +
- geom_point()
-
-
-ggplot(mpg, aes(cty, hwy)) +
- geom_count()
-
-
-# Best used in conjunction with scale_size_area which ensures that
-# counts of zero would be given size 0. Doesn't make much different
-# here because the smallest count is already close to 0.
-ggplot(mpg, aes(cty, hwy)) +
- geom_count()
-
- scale_size_area()
-#> <ScaleContinuous>
-#>  Range:  
-#>  Limits:    0 --    1
-
-# Display proportions instead of counts -------------------------------------
-# By default, all categorical variables in the plot form the groups.
-# Specifying geom_count without a group identifier leads to a plot which is
-# not useful:
-d <- ggplot(diamonds, aes(x = cut, y = clarity))
-d + geom_count(aes(size = ..prop..))
-
-# To correct this problem and achieve a more desirable plot, we need
-# to specify which group the proportion is to be calculated over.
-d + geom_count(aes(size = ..prop.., group = 1)) +
-  scale_size_area(max_size = 10)
-
-
-# Or group by x/y variables to have rows/columns sum to 1.
-d + geom_count(aes(size = ..prop.., group = cut)) +
-  scale_size_area(max_size = 10)
-
-d + geom_count(aes(size = ..prop.., group = clarity)) +
-  scale_size_area(max_size = 10)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_density-1.png b/docs/reference/geom_density-1.png deleted file mode 100644 index 521ff957d..000000000 Binary files a/docs/reference/geom_density-1.png and /dev/null differ diff --git a/docs/reference/geom_density-2.png b/docs/reference/geom_density-2.png deleted file mode 100644 index 711459851..000000000 Binary files a/docs/reference/geom_density-2.png and /dev/null differ diff --git a/docs/reference/geom_density-3.png b/docs/reference/geom_density-3.png deleted file mode 100644 index c7d948d2a..000000000 Binary files a/docs/reference/geom_density-3.png and /dev/null differ diff --git a/docs/reference/geom_density-4.png b/docs/reference/geom_density-4.png deleted file mode 100644 index e3340f36a..000000000 Binary files a/docs/reference/geom_density-4.png and /dev/null differ diff --git a/docs/reference/geom_density-5.png b/docs/reference/geom_density-5.png deleted file mode 100644 index d4847e4e1..000000000 Binary files a/docs/reference/geom_density-5.png and /dev/null differ diff --git a/docs/reference/geom_density-6.png b/docs/reference/geom_density-6.png deleted file mode 100644 index d97841a7b..000000000 Binary files a/docs/reference/geom_density-6.png and /dev/null differ diff --git a/docs/reference/geom_density-7.png b/docs/reference/geom_density-7.png deleted file mode 100644 index a68ae5f0a..000000000 Binary files a/docs/reference/geom_density-7.png and /dev/null differ diff --git a/docs/reference/geom_density-8.png b/docs/reference/geom_density-8.png deleted file mode 100644 index 44667206b..000000000 Binary files a/docs/reference/geom_density-8.png and /dev/null differ diff --git a/docs/reference/geom_density.html b/docs/reference/geom_density.html deleted file mode 100644 index 0c48c78ce..000000000 --- a/docs/reference/geom_density.html +++ /dev/null @@ -1,268 +0,0 @@ - -Display a smooth density estimate. — geom_density • animint2 - Skip to contents - - -
-
-
- -
-

A kernel density estimate, useful for display the distribution of variables -with underlying smoothness.

-
- -
-

Usage

-
geom_density(
-  mapping = NULL,
-  data = NULL,
-  stat = "density",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_density(
-  mapping = NULL,
-  data = NULL,
-  geom = "area",
-  position = "stack",
-  ...,
-  bw = "nrd0",
-  adjust = 1,
-  kernel = "gaussian",
-  trim = FALSE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Use to override the default connection between -geom_density and stat_density.

- - -
bw
-

the smoothing bandwidth to be used, see -density for details

- - -
adjust
-

adjustment of the bandwidth, see -density for details

- - -
kernel
-

kernel used for density estimation, see -density for details

- - -
trim
-

This parameter only matters if you are displaying multiple -densities in one plot. If FALSE, the default, each density is -computed on the full range of the data. If TRUE, each density -is computed over the range of that group: this typically means the -estimated x values will not line-up, and hence you won't be able to -stack density values.

- -
-
-

Aesthetics

- - -

geom_density understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
  • weight

  • -
-
-

Computed variables

- - -
density
-

density estimate

- -
count
-

density * number of points - useful for stacked density - plots

- -
scaled
-

density estimate, scaled to maximum of 1

- - -
-
-

See also

-

See geom_histogram, geom_freqpoly for - other methods of displaying continuous distribution. - See geom_violin for a compact density display.

-
- -
-

Examples

-
ggplot(diamonds, aes(carat)) +
-  geom_density()
-
-
-ggplot(diamonds, aes(carat)) +
-  geom_density(adjust = 1/5)
-
-ggplot(diamonds, aes(carat)) +
-  geom_density(adjust = 5)
-
-
-ggplot(diamonds, aes(depth, colour = cut)) +
-  geom_density() +
-  xlim(55, 70)
-#> Warning: Removed 45 rows containing non-finite values (stat_density).
-
-ggplot(diamonds, aes(depth, fill = cut, colour = cut)) +
-  geom_density(alpha = 0.1) +
-  xlim(55, 70)
-#> Warning: Removed 45 rows containing non-finite values (stat_density).
-
-
-# \donttest{
-# Stacked density plots: if you want to create a stacked density plot, you
-# probably want to 'count' (density * n) variable instead of the default
-# density
-
-# Loses marginal densities
-ggplot(diamonds, aes(carat, fill = cut)) +
-  geom_density(position = "stack")
-
-# Preserves marginal densities
-ggplot(diamonds, aes(carat, ..count.., fill = cut)) +
-  geom_density(position = "stack")
-
-
-# You can use position="fill" to produce a conditional density estimate
-ggplot(diamonds, aes(carat, ..count.., fill = cut)) +
-  geom_density(position = "fill")
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_density_2d-1.png b/docs/reference/geom_density_2d-1.png deleted file mode 100644 index 06954e79c..000000000 Binary files a/docs/reference/geom_density_2d-1.png and /dev/null differ diff --git a/docs/reference/geom_density_2d-2.png b/docs/reference/geom_density_2d-2.png deleted file mode 100644 index a94c79a48..000000000 Binary files a/docs/reference/geom_density_2d-2.png and /dev/null differ diff --git a/docs/reference/geom_density_2d-3.png b/docs/reference/geom_density_2d-3.png deleted file mode 100644 index 014684215..000000000 Binary files a/docs/reference/geom_density_2d-3.png and /dev/null differ diff --git a/docs/reference/geom_density_2d-4.png b/docs/reference/geom_density_2d-4.png deleted file mode 100644 index 844df77d4..000000000 Binary files a/docs/reference/geom_density_2d-4.png and /dev/null differ diff --git a/docs/reference/geom_density_2d-5.png b/docs/reference/geom_density_2d-5.png deleted file mode 100644 index 4d9a09f0b..000000000 Binary files a/docs/reference/geom_density_2d-5.png and /dev/null differ diff --git a/docs/reference/geom_density_2d.html b/docs/reference/geom_density_2d.html deleted file mode 100644 index 8d0207dbd..000000000 --- a/docs/reference/geom_density_2d.html +++ /dev/null @@ -1,244 +0,0 @@ - -Contours from a 2d density estimate. — geom_density_2d • animint2 - Skip to contents - - -
-
-
- -
-

Perform a 2D kernel density estimation using kde2d and display the -results with contours. This can be useful for dealing with overplotting.

-
- -
-

Usage

-
geom_density_2d(
-  mapping = NULL,
-  data = NULL,
-  stat = "density2d",
-  position = "identity",
-  ...,
-  lineend = "butt",
-  linejoin = "round",
-  linemitre = 1,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_density_2d(
-  mapping = NULL,
-  data = NULL,
-  geom = "density_2d",
-  position = "identity",
-  ...,
-  contour = TRUE,
-  n = 100,
-  h = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
lineend
-

Line end style (round, butt, square)

- - -
linejoin
-

Line join style (round, mitre, bevel)

- - -
linemitre
-

Line mitre limit (number greater than 1)

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Use to override the default connection between -geom_density_2d and stat_density_2d.

- - -
contour
-

If TRUE, contour the results of the 2d density -estimation

- - -
n
-

number of grid points in each direction

- - -
h
-

Bandwidth (vector of length two). If NULL, estimated -using bandwidth.nrd.

- -
-
-

Aesthetics

- - -

geom_density_2d understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
-
-

Computed variables

- - -

Same as stat_contour

-
-
-

See also

-

geom_contour for contour drawing geom, - stat_sum for another way of dealing with overplotting

-
- -
-

Examples

-
m <- ggplot(faithful, aes(x = eruptions, y = waiting)) +
- geom_point() +
- xlim(0.5, 6) +
- ylim(40, 110)
-m + geom_density_2d()
-
-# \donttest{
-m + stat_density_2d(aes(fill = ..level..), geom = "polygon")
-#> Warning: NAs introduced by coercion
-
-
-set.seed(4393)
-dsmall <- diamonds[sample(nrow(diamonds), 1000), ]
-d <- ggplot(dsmall, aes(x, y))
-# If you map an aesthetic to a categorical variable, you will get a
-# set of contours for each value of that variable
-d + geom_density_2d(aes(colour = cut))
-
-
-# If we turn contouring off, we can use use geoms like tiles:
-d + stat_density_2d(geom = "raster", aes(fill = ..density..), contour = FALSE)
-
-# Or points:
-d + stat_density_2d(geom = "point", aes(size = ..density..), n = 20, contour = FALSE)
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_dotplot-1.png b/docs/reference/geom_dotplot-1.png deleted file mode 100644 index 60aaf7c17..000000000 Binary files a/docs/reference/geom_dotplot-1.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-10.png b/docs/reference/geom_dotplot-10.png deleted file mode 100644 index 723fa69ca..000000000 Binary files a/docs/reference/geom_dotplot-10.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-11.png b/docs/reference/geom_dotplot-11.png deleted file mode 100644 index 69394a2ce..000000000 Binary files a/docs/reference/geom_dotplot-11.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-12.png b/docs/reference/geom_dotplot-12.png deleted file mode 100644 index b5b3a1c67..000000000 Binary files a/docs/reference/geom_dotplot-12.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-13.png b/docs/reference/geom_dotplot-13.png deleted file mode 100644 index 872830d64..000000000 Binary files a/docs/reference/geom_dotplot-13.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-14.png b/docs/reference/geom_dotplot-14.png deleted file mode 100644 index 73f81637e..000000000 Binary files a/docs/reference/geom_dotplot-14.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-15.png b/docs/reference/geom_dotplot-15.png deleted file mode 100644 index 645d25582..000000000 Binary files a/docs/reference/geom_dotplot-15.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-16.png b/docs/reference/geom_dotplot-16.png deleted file mode 100644 index 3afc9e81e..000000000 Binary files a/docs/reference/geom_dotplot-16.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-2.png b/docs/reference/geom_dotplot-2.png deleted file mode 100644 index 1b0f5f005..000000000 Binary files a/docs/reference/geom_dotplot-2.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-3.png b/docs/reference/geom_dotplot-3.png deleted file mode 100644 index 4af2a3647..000000000 Binary files a/docs/reference/geom_dotplot-3.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-4.png b/docs/reference/geom_dotplot-4.png deleted file mode 100644 index 721a556ea..000000000 Binary files a/docs/reference/geom_dotplot-4.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-5.png b/docs/reference/geom_dotplot-5.png deleted file mode 100644 index 7db21711f..000000000 Binary files a/docs/reference/geom_dotplot-5.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-6.png b/docs/reference/geom_dotplot-6.png deleted file mode 100644 index e817b008c..000000000 Binary files a/docs/reference/geom_dotplot-6.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-7.png b/docs/reference/geom_dotplot-7.png deleted file mode 100644 index 5150808d4..000000000 Binary files a/docs/reference/geom_dotplot-7.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-8.png b/docs/reference/geom_dotplot-8.png deleted file mode 100644 index 6b36b7c1c..000000000 Binary files a/docs/reference/geom_dotplot-8.png and /dev/null differ diff --git a/docs/reference/geom_dotplot-9.png b/docs/reference/geom_dotplot-9.png deleted file mode 100644 index 6777fd53a..000000000 Binary files a/docs/reference/geom_dotplot-9.png and /dev/null differ diff --git a/docs/reference/geom_dotplot.html b/docs/reference/geom_dotplot.html deleted file mode 100644 index 104959711..000000000 --- a/docs/reference/geom_dotplot.html +++ /dev/null @@ -1,382 +0,0 @@ - -Dot plot — geom_dotplot • animint2 - Skip to contents - - -
-
-
- -
-

In a dot plot, the width of a dot corresponds to the bin width -(or maximum width, depending on the binning algorithm), and dots are -stacked, with each dot representing one observation.

-
- -
-

Usage

-
geom_dotplot(
-  mapping = NULL,
-  data = NULL,
-  position = "identity",
-  ...,
-  binwidth = NULL,
-  binaxis = "x",
-  method = "dotdensity",
-  binpositions = "bygroup",
-  stackdir = "up",
-  stackratio = 1,
-  dotsize = 1,
-  stackgroups = FALSE,
-  origin = NULL,
-  right = TRUE,
-  width = 0.9,
-  drop = FALSE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
binwidth
-

When method is "dotdensity", this specifies maximum bin -width. When method is "histodot", this specifies bin width. -Defaults to 1/30 of the range of the data

- - -
binaxis
-

The axis to bin along, "x" (default) or "y"

- - -
method
-

"dotdensity" (default) for dot-density binning, or -"histodot" for fixed bin widths (like stat_bin)

- - -
binpositions
-

When method is "dotdensity", "bygroup" (default) -determines positions of the bins for each group separately. "all" determines -positions of the bins with all the data taken together; this is used for -aligning dot stacks across multiple groups.

- - -
stackdir
-

which direction to stack the dots. "up" (default), -"down", "center", "centerwhole" (centered, but with dots aligned)

- - -
stackratio
-

how close to stack the dots. Default is 1, where dots just -just touch. Use smaller values for closer, overlapping dots.

- - -
dotsize
-

The diameter of the dots relative to binwidth, default 1.

- - -
stackgroups
-

should dots be stacked across groups? This has the effect -that position = "stack" should have, but can't (because this geom has -some odd properties).

- - -
origin
-

When method is "histodot", origin of first bin

- - -
right
-

When method is "histodot", should intervals be closed -on the right (a, b], or not [a, b)

- - -
width
-

When binaxis is "y", the spacing of the dot stacks -for dodging.

- - -
drop
-

If TRUE, remove all bins with zero counts

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Details

-

With dot-density binning, the bin positions are determined by the data and -binwidth, which is the maximum width of each bin. See Wilkinson -(1999) for details on the dot-density binning algorithm.

-

With histodot binning, the bins have fixed positions and fixed widths, much -like a histogram.

-

When binning along the x axis and stacking along the y axis, the numbers on -y axis are not meaningful, due to technical limitations of ggplot2. You can -hide the y axis, as in one of the examples, or manually scale it -to match the number of dots.

-
-
-

Aesthetics

- - -

geom_dotplot understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
-
-

Computed variables

- - -
x
-

center of each bin, if binaxis is "x"

- -
y
-

center of each bin, if binaxis is "x"

- -
binwidth
-

max width of each bin if method is "dotdensity"; - width of each bin if method is "histodot"

- -
count
-

number of points in bin

- -
ncount
-

count, scaled to maximum of 1

- -
density
-

density of points in bin, scaled to integrate to 1, - if method is "histodot"

- -
ndensity
-

density, scaled to maximum of 1, if method is "histodot"

- - -
-
-

References

-

Wilkinson, L. (1999) Dot plots. The American Statistician, - 53(3), 276-281.

-
- -
-

Examples

-
ggplot(mtcars, aes(x = mpg)) + geom_dotplot()
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-
-ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5)
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# Use fixed-width bins
-ggplot(mtcars, aes(x = mpg)) +
-  geom_dotplot(method="histodot", binwidth = 1.5)
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# Some other stacking methods
-ggplot(mtcars, aes(x = mpg)) +
-  geom_dotplot(binwidth = 1.5, stackdir = "center")
-#> Warning: Unit type of dotdia should be 'npc'
-
-ggplot(mtcars, aes(x = mpg)) +
-  geom_dotplot(binwidth = 1.5, stackdir = "centerwhole")
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# y axis isn't really meaningful, so hide it
-ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5) +
-  scale_y_continuous(NULL, breaks = NULL)
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# Overlap dots vertically
-ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5, stackratio = .7)
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# Expand dot diameter
-ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5, dotsize = 1.25)
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# \donttest{
-# Examples with stacking along y axis instead of x
-ggplot(mtcars, aes(x = 1, y = mpg)) +
-  geom_dotplot(binaxis = "y", stackdir = "center")
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
-  geom_dotplot(binaxis = "y", stackdir = "center")
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-ggplot(mtcars, aes(x = factor(cyl), y = mpg)) +
-  geom_dotplot(binaxis = "y", stackdir = "centerwhole")
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-ggplot(mtcars, aes(x = factor(vs), fill = factor(cyl), y = mpg)) +
-  geom_dotplot(binaxis = "y", stackdir = "center", position = "dodge")
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# binpositions="all" ensures that the bins are aligned between groups
-ggplot(mtcars, aes(x = factor(am), y = mpg)) +
-  geom_dotplot(binaxis = "y", stackdir = "center", binpositions="all")
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-# Stacking multiple groups, with different fill
-ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) +
-  geom_dotplot(stackgroups = TRUE, binwidth = 1, binpositions = "all")
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) +
-  geom_dotplot(stackgroups = TRUE, binwidth = 1, method = "histodot")
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-
-ggplot(mtcars, aes(x = 1, y = mpg, fill = factor(cyl))) +
-  geom_dotplot(binaxis = "y", stackgroups = TRUE, binwidth = 1, method = "histodot")
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-#> Warning: Unit type of dotdia should be 'npc'
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_errorbarh-1.png b/docs/reference/geom_errorbarh-1.png deleted file mode 100644 index 261672060..000000000 Binary files a/docs/reference/geom_errorbarh-1.png and /dev/null differ diff --git a/docs/reference/geom_errorbarh-2.png b/docs/reference/geom_errorbarh-2.png deleted file mode 100644 index 2164569db..000000000 Binary files a/docs/reference/geom_errorbarh-2.png and /dev/null differ diff --git a/docs/reference/geom_errorbarh.html b/docs/reference/geom_errorbarh.html deleted file mode 100644 index 18bb58a4a..000000000 --- a/docs/reference/geom_errorbarh.html +++ /dev/null @@ -1,184 +0,0 @@ - -Horizontal error bars — geom_errorbarh • animint2 - Skip to contents - - -
-
-
- -
-

Horizontal error bars

-
- -
-

Usage

-
geom_errorbarh(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_errorbarh understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • xmax

  • -
  • xmin

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • height

  • -
  • linetype

  • -
  • size

  • -
-
-

See also

-

geom_errorbar: vertical error bars

-
- -
-

Examples

-
df <- data.frame(
-  trt = factor(c(1, 1, 2, 2)),
-  resp = c(1, 5, 3, 4),
-  group = factor(c(1, 2, 1, 2)),
-  se = c(0.1, 0.3, 0.3, 0.2)
-)
-
-# Define the top and bottom of the errorbars
-
-p <- ggplot(df, aes(resp, trt, colour = group))
-p + geom_point() +
-  geom_errorbarh(aes(xmax = resp + se, xmin = resp - se))
-
-p + geom_point() +
-  geom_errorbarh(aes(xmax = resp + se, xmin = resp - se, height = .2))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_hex-1.png b/docs/reference/geom_hex-1.png deleted file mode 100644 index fe8ef0172..000000000 Binary files a/docs/reference/geom_hex-1.png and /dev/null differ diff --git a/docs/reference/geom_hex-2.png b/docs/reference/geom_hex-2.png deleted file mode 100644 index d7af73237..000000000 Binary files a/docs/reference/geom_hex-2.png and /dev/null differ diff --git a/docs/reference/geom_hex-3.png b/docs/reference/geom_hex-3.png deleted file mode 100644 index fe8ef0172..000000000 Binary files a/docs/reference/geom_hex-3.png and /dev/null differ diff --git a/docs/reference/geom_hex-4.png b/docs/reference/geom_hex-4.png deleted file mode 100644 index caeb209af..000000000 Binary files a/docs/reference/geom_hex-4.png and /dev/null differ diff --git a/docs/reference/geom_hex-5.png b/docs/reference/geom_hex-5.png deleted file mode 100644 index 3c2990d84..000000000 Binary files a/docs/reference/geom_hex-5.png and /dev/null differ diff --git a/docs/reference/geom_hex.html b/docs/reference/geom_hex.html deleted file mode 100644 index d4f36dd40..000000000 --- a/docs/reference/geom_hex.html +++ /dev/null @@ -1,206 +0,0 @@ - -Hexagon binning. — geom_hex • animint2 - Skip to contents - - -
-
-
- -
-

Hexagon binning.

-
- -
-

Usage

-
geom_hex(
-  mapping = NULL,
-  data = NULL,
-  stat = "binhex",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_bin_hex(
-  mapping = NULL,
-  data = NULL,
-  geom = "hex",
-  position = "identity",
-  ...,
-  bins = 30,
-  binwidth = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Override the default connection between geom_hex and -stat_binhex.

- - -
bins
-

numeric vector giving number of bins in both vertical and -horizontal directions. Set to 30 by default.

- - -
binwidth
-

Numeric vector giving bin width in both vertical and -horizontal directions. Overrides bins if both set.

- -
-
-

Aesthetics

- - -

geom_hex understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • size

  • -
-
-

See also

-

stat_bin2d for rectangular binning

-
- -
-

Examples

-
d <- ggplot(diamonds, aes(carat, price))
-d + geom_hex()
-
-
-# \donttest{
-# You can control the size of the bins by specifying the number of
-# bins in each direction:
-d + geom_hex(bins = 10)
-
-d + geom_hex(bins = 30)
-
-
-# Or by specifying the width of the bins
-d + geom_hex(binwidth = c(1, 1000))
-
-d + geom_hex(binwidth = c(.1, 500))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_histogram-1.png b/docs/reference/geom_histogram-1.png deleted file mode 100644 index 84f2f0f0a..000000000 Binary files a/docs/reference/geom_histogram-1.png and /dev/null differ diff --git a/docs/reference/geom_histogram-2.png b/docs/reference/geom_histogram-2.png deleted file mode 100644 index 0680cf9c6..000000000 Binary files a/docs/reference/geom_histogram-2.png and /dev/null differ diff --git a/docs/reference/geom_histogram-3.png b/docs/reference/geom_histogram-3.png deleted file mode 100644 index 55002f4f6..000000000 Binary files a/docs/reference/geom_histogram-3.png and /dev/null differ diff --git a/docs/reference/geom_histogram-4.png b/docs/reference/geom_histogram-4.png deleted file mode 100644 index 8d40f7ab8..000000000 Binary files a/docs/reference/geom_histogram-4.png and /dev/null differ diff --git a/docs/reference/geom_histogram-5.png b/docs/reference/geom_histogram-5.png deleted file mode 100644 index c1e80eacf..000000000 Binary files a/docs/reference/geom_histogram-5.png and /dev/null differ diff --git a/docs/reference/geom_histogram-6.png b/docs/reference/geom_histogram-6.png deleted file mode 100644 index 251623c42..000000000 Binary files a/docs/reference/geom_histogram-6.png and /dev/null differ diff --git a/docs/reference/geom_histogram-7.png b/docs/reference/geom_histogram-7.png deleted file mode 100644 index fcafafd11..000000000 Binary files a/docs/reference/geom_histogram-7.png and /dev/null differ diff --git a/docs/reference/geom_histogram.html b/docs/reference/geom_histogram.html deleted file mode 100644 index dadf71de6..000000000 --- a/docs/reference/geom_histogram.html +++ /dev/null @@ -1,325 +0,0 @@ - -Histograms and frequency polygons. — geom_freqpoly • animint2 - Skip to contents - - -
-
-
- -
-

Display a 1d distribution by dividing into bins and counting the number -of observations in each bin. Histograms use bars; frequency polygons use -lines.

-
- -
-

Usage

-
geom_freqpoly(
-  mapping = NULL,
-  data = NULL,
-  stat = "bin",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_histogram(
-  mapping = NULL,
-  data = NULL,
-  stat = "bin",
-  position = "stack",
-  ...,
-  binwidth = NULL,
-  bins = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_bin(
-  mapping = NULL,
-  data = NULL,
-  geom = "bar",
-  position = "stack",
-  ...,
-  binwidth = NULL,
-  bins = NULL,
-  center = NULL,
-  boundary = NULL,
-  closed = c("right", "left"),
-  pad = FALSE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
binwidth
-

The width of the bins. The default is to use bins - bins that cover the range of the data. You should always override - this value, exploring multiple widths to find the best to illustrate the - stories in your data.

-

The bin width of a date variable is the number of days in each time; the - bin width of a time variable is the number of seconds.

- - -
bins
-

Number of bins. Overridden by binwidth. Defaults to 30

- - -
geom, stat
-

Use to override the default connection between -geom_histogram/geom_freqpoly and stat_bin.

- - -
center
-

The center of one of the bins. Note that if center is above or -below the range of the data, things will be shifted by an appropriate -number of widths. To center on integers, for example, use -width=1 and center=0, even if 0 is outside the range -of the data. At most one of center and boundary may be -specified.

- - -
boundary
-

A boundary between two bins. As with center, things -are shifted when boundary is outside the range of the data. For -example, to center on integers, use width = 1 and boundary = -0.5, even if 1 is outside the range of the data. At most one of -center and boundary may be specified.

- - -
closed
-

One of "right" or "left" indicating whether right -or left edges of bins are included in the bin.

- - -
pad
-

If TRUE, adds empty bins at either end of x. This ensures -frequency polygons touch 0. Defaults to FALSE.

- -
-
-

Details

-

By default, stat_bin uses 30 bins - this is not a good default, -but the idea is to get you experimenting with different binwidths. You -may need to look at a few to uncover the full story behind your data.

-
-
-

Aesthetics

- - -

geom_histogram uses the same aesthetics as geom_bar; -geom_freqpoly uses the same aesthetics as geom_line.

-
-
-

Computed variables

- - -
count
-

number of points in bin

- -
density
-

density of points in bin, scaled to integrate to 1

- -
ncount
-

count, scaled to maximum of 1

- -
ndensity
-

density, scaled to maximum of 1

- - -
-
-

See also

-

stat_count, which counts the number of cases at each x - posotion, without binning. It is suitable for both discrete and continuous - x data, whereas stat_bin is suitable only for continuous x data.

-
- -
-

Examples

-
ggplot(diamonds, aes(carat)) +
-  geom_histogram()
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-ggplot(diamonds, aes(carat)) +
-  geom_histogram(binwidth = 0.01)
-
-ggplot(diamonds, aes(carat)) +
-  geom_histogram(bins = 200)
-
-
-# Rather than stacking histograms, it's easier to compare frequency
-# polygons
-ggplot(diamonds, aes(price, fill = cut)) +
-  geom_histogram(binwidth = 500)
-
-ggplot(diamonds, aes(price, colour = cut)) +
-  geom_freqpoly(binwidth = 500)
-
-
-# To make it easier to compare distributions with very different counts,
-# put density on the y axis instead of the default count
-ggplot(diamonds, aes(price, ..density.., colour = cut)) +
-  geom_freqpoly(binwidth = 500)
-
-
-if (require("ggplot2movies")) {
-# Often we don't want the height of the bar to represent the
-# count of observations, but the sum of some other variable.
-# For example, the following plot shows the number of movies
-# in each rating.
-m <- ggplot(movies, aes(rating))
-m + geom_histogram(binwidth = 0.1)
-
-# If, however, we want to see the number of votes cast in each
-# category, we need to weight by the votes variable
-m + geom_histogram(aes(weight = votes), binwidth = 0.1) + ylab("votes")
-
-# For transformed scales, binwidth applies to the transformed data.
-# The bins have constant width on the transformed scale.
-m + geom_histogram() + scale_x_log10()
-m + geom_histogram(binwidth = 0.05) + scale_x_log10()
-
-# For transformed coordinate systems, the binwidth applies to the
-# raw data. The bins have constant width on the original scale.
-
-# Using log scales does not work here, because the first
-# bar is anchored at zero, and so when transformed becomes negative
-# infinity. This is not a problem when transforming the scales, because
-# no observations have 0 ratings.
-m + geom_histogram(origin = 0) + coord_trans(x = "log10")
-# Use origin = 0, to make sure we don't take sqrt of negative values
-m + geom_histogram(origin = 0) + coord_trans(x = "sqrt")
-
-# You can also transform the y axis.  Remember that the base of the bars
-# has value 0, so log transformations are not appropriate
-m <- ggplot(movies, aes(x = rating))
-m + geom_histogram(binwidth = 0.5) + scale_y_sqrt()
-}
-
-rm(movies)
-#> Warning: object 'movies' not found
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_jitter-1.png b/docs/reference/geom_jitter-1.png deleted file mode 100644 index 2fa820386..000000000 Binary files a/docs/reference/geom_jitter-1.png and /dev/null differ diff --git a/docs/reference/geom_jitter-2.png b/docs/reference/geom_jitter-2.png deleted file mode 100644 index 460a740df..000000000 Binary files a/docs/reference/geom_jitter-2.png and /dev/null differ diff --git a/docs/reference/geom_jitter-3.png b/docs/reference/geom_jitter-3.png deleted file mode 100644 index b8e56f06e..000000000 Binary files a/docs/reference/geom_jitter-3.png and /dev/null differ diff --git a/docs/reference/geom_jitter-4.png b/docs/reference/geom_jitter-4.png deleted file mode 100644 index 7b5c52077..000000000 Binary files a/docs/reference/geom_jitter-4.png and /dev/null differ diff --git a/docs/reference/geom_jitter-5.png b/docs/reference/geom_jitter-5.png deleted file mode 100644 index 2169fa25a..000000000 Binary files a/docs/reference/geom_jitter-5.png and /dev/null differ diff --git a/docs/reference/geom_jitter-6.png b/docs/reference/geom_jitter-6.png deleted file mode 100644 index 2c039ca2d..000000000 Binary files a/docs/reference/geom_jitter-6.png and /dev/null differ diff --git a/docs/reference/geom_jitter-7.png b/docs/reference/geom_jitter-7.png deleted file mode 100644 index 283365375..000000000 Binary files a/docs/reference/geom_jitter-7.png and /dev/null differ diff --git a/docs/reference/geom_jitter.html b/docs/reference/geom_jitter.html deleted file mode 100644 index d6ba221dd..000000000 --- a/docs/reference/geom_jitter.html +++ /dev/null @@ -1,206 +0,0 @@ - -Points, jittered to reduce overplotting. — geom_jitter • animint2 - Skip to contents - - -
-
-
- -
-

The jitter geom is a convenient default for geom_point with position = -'jitter'. It's a useful way of handling overplotting caused by discreteness -in smaller datasets.

-
- -
-

Usage

-
geom_jitter(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "jitter",
-  ...,
-  width = NULL,
-  height = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
width, height
-

Amount of vertical and horizontal jitter. The jitter - is added in both positive and negative directions, so the total spread - is twice the value specified here.

-

If omitted, defaults to 40% of the resolution of the data: this means the - jitter values will occupy 80% of the implied bins. Categorical data - is aligned on the integers, so a width or height of 0.5 will spread the - data so it's not possible to see the distinction between the categories.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_point understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • shape

  • -
  • size

  • -
  • stroke

  • -
-
-

See also

-

geom_point for regular, unjittered points.

-
- -
-

Examples

-
p <- ggplot(mpg, aes(cyl, hwy))
-p + geom_point()
-
-p + geom_jitter()
-
-
-# Add aesthetic mappings
-p + geom_jitter(aes(colour = class))
-
-
-# Use smaller width/height to emphasise categories
-ggplot(mpg, aes(cyl, hwy)) + geom_jitter()
-
-ggplot(mpg, aes(cyl, hwy)) + geom_jitter(width = 0.25)
-
-
-# Use larger width/height to completely smooth away discreteness
-ggplot(mpg, aes(cty, hwy)) + geom_jitter()
-
-ggplot(mpg, aes(cty, hwy)) + geom_jitter(width = 0.5, height = 0.5)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_linerange-1.png b/docs/reference/geom_linerange-1.png deleted file mode 100644 index 801452f7d..000000000 Binary files a/docs/reference/geom_linerange-1.png and /dev/null differ diff --git a/docs/reference/geom_linerange-2.png b/docs/reference/geom_linerange-2.png deleted file mode 100644 index e752b6f38..000000000 Binary files a/docs/reference/geom_linerange-2.png and /dev/null differ diff --git a/docs/reference/geom_linerange-3.png b/docs/reference/geom_linerange-3.png deleted file mode 100644 index 052238df5..000000000 Binary files a/docs/reference/geom_linerange-3.png and /dev/null differ diff --git a/docs/reference/geom_linerange-4.png b/docs/reference/geom_linerange-4.png deleted file mode 100644 index b15e4da43..000000000 Binary files a/docs/reference/geom_linerange-4.png and /dev/null differ diff --git a/docs/reference/geom_linerange-5.png b/docs/reference/geom_linerange-5.png deleted file mode 100644 index 801903bb5..000000000 Binary files a/docs/reference/geom_linerange-5.png and /dev/null differ diff --git a/docs/reference/geom_linerange-6.png b/docs/reference/geom_linerange-6.png deleted file mode 100644 index 9aacfc626..000000000 Binary files a/docs/reference/geom_linerange-6.png and /dev/null differ diff --git a/docs/reference/geom_linerange-7.png b/docs/reference/geom_linerange-7.png deleted file mode 100644 index d7ef91da6..000000000 Binary files a/docs/reference/geom_linerange-7.png and /dev/null differ diff --git a/docs/reference/geom_linerange.html b/docs/reference/geom_linerange.html deleted file mode 100644 index 3eb5f7a74..000000000 --- a/docs/reference/geom_linerange.html +++ /dev/null @@ -1,251 +0,0 @@ - -Vertical intervals: lines, crossbars & errorbars. — geom_crossbar • animint2 - Skip to contents - - -
-
-
- -
-

Various ways of representing a vertical interval defined by x, -ymin and ymax.

-
- -
-

Usage

-
geom_crossbar(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  fatten = 2.5,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_errorbar(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_linerange(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_pointrange(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  fatten = 4,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
fatten
-

A multiplicative factor used to increase the size of the -middle bar in geom_crossbar() and the middle point in -geom_pointrange().

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_linerange understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • ymax

  • -
  • ymin

  • -
  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
-
-

See also

-

stat_summary for examples of these guys in use, - geom_smooth for continuous analog

-
- -
-

Examples

-
#' # Create a simple example dataset
-df <- data.frame(
-  trt = factor(c(1, 1, 2, 2)),
-  resp = c(1, 5, 3, 4),
-  group = factor(c(1, 2, 1, 2)),
-  upper = c(1.1, 5.3, 3.3, 4.2),
-  lower = c(0.8, 4.6, 2.4, 3.6)
-)
-
-p <- ggplot(df, aes(trt, resp, colour = group))
-p + geom_linerange(aes(ymin = lower, ymax = upper))
-
-p + geom_pointrange(aes(ymin = lower, ymax = upper))
-
-p + geom_crossbar(aes(ymin = lower, ymax = upper), width = 0.2)
-
-p + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.2)
-
-
-# Draw lines connecting group means
-p +
-  geom_line(aes(group = group)) +
-  geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.2)
-
-
-# If you want to dodge bars and errorbars, you need to manually
-# specify the dodge width
-p <- ggplot(df, aes(trt, resp, fill = group))
-p +
- geom_bar(position = "dodge", stat = "identity") +
- geom_errorbar(aes(ymin = lower, ymax = upper), position = "dodge", width = 0.25)
-
-
-# Because the bars and errorbars have different widths
-# we need to specify how wide the objects we are dodging are
-dodge <- position_dodge(width=0.9)
-p +
-  geom_bar(position = dodge, stat = "identity") +
-  geom_errorbar(aes(ymin = lower, ymax = upper), position = dodge, width = 0.25)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_map-1.png b/docs/reference/geom_map-1.png deleted file mode 100644 index e1493dc71..000000000 Binary files a/docs/reference/geom_map-1.png and /dev/null differ diff --git a/docs/reference/geom_map-2.png b/docs/reference/geom_map-2.png deleted file mode 100644 index 9a6ae889b..000000000 Binary files a/docs/reference/geom_map-2.png and /dev/null differ diff --git a/docs/reference/geom_map-3.png b/docs/reference/geom_map-3.png deleted file mode 100644 index 00dc451d5..000000000 Binary files a/docs/reference/geom_map-3.png and /dev/null differ diff --git a/docs/reference/geom_map-4.png b/docs/reference/geom_map-4.png deleted file mode 100644 index cbacd1e20..000000000 Binary files a/docs/reference/geom_map-4.png and /dev/null differ diff --git a/docs/reference/geom_map.html b/docs/reference/geom_map.html deleted file mode 100644 index dfc8f1b89..000000000 --- a/docs/reference/geom_map.html +++ /dev/null @@ -1,211 +0,0 @@ - -Polygons from a reference map. — geom_map • animint2 - Skip to contents - - -
-
-
- -
-

Does not affect position scales.

-
- -
-

Usage

-
geom_map(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  ...,
-  map,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
map
-

Data frame that contains the map coordinates. This will -typically be created using fortify on a spatial object. -It must contain columns x or long, y or -lat, and region or id.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_map understands the following aesthetics (required aesthetics are in bold):

  • map_id

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
- -
-

Examples

-
# When using geom_polygon, you will typically need two data frames:
-# one contains the coordinates of each polygon (positions),  and the
-# other the values associated with each polygon (values).  An id
-# variable links the two together
-
-ids <- factor(c("1.1", "2.1", "1.2", "2.2", "1.3", "2.3"))
-
-values <- data.frame(
-  id = ids,
-  value = c(3, 3.1, 3.1, 3.2, 3.15, 3.5)
-)
-
-positions <- data.frame(
-  id = rep(ids, each = 4),
-  x = c(2, 1, 1.1, 2.2, 1, 0, 0.3, 1.1, 2.2, 1.1, 1.2, 2.5, 1.1, 0.3,
-  0.5, 1.2, 2.5, 1.2, 1.3, 2.7, 1.2, 0.5, 0.6, 1.3),
-  y = c(-0.5, 0, 1, 0.5, 0, 0.5, 1.5, 1, 0.5, 1, 2.1, 1.7, 1, 1.5,
-  2.2, 2.1, 1.7, 2.1, 3.2, 2.8, 2.1, 2.2, 3.3, 3.2)
-)
-
-ggplot(values) + geom_map(aes(map_id = id), map = positions) +
-  expand_limits(positions)
-
-ggplot(values, aes(fill = value)) +
-  geom_map(aes(map_id = id), map = positions) +
-  expand_limits(positions)
-
-ggplot(values, aes(fill = value)) +
-  geom_map(aes(map_id = id), map = positions) +
-  expand_limits(positions) + ylim(0, 3)
-
-
-# Better example
-crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
-crimesm <- reshape2::melt(crimes, id = 1)
-if (require(maps)) {
-  states_map <- map_data("state")
-  ggplot(crimes, aes(map_id = state)) +
-    geom_map(aes(fill = Murder), map = states_map) +
-    expand_limits(x = states_map$long, y = states_map$lat)
-
-  last_plot() + coord_map()
-  ggplot(crimesm, aes(map_id = state)) +
-    geom_map(aes(fill = value), map = states_map) +
-    expand_limits(x = states_map$long, y = states_map$lat) +
-    facet_wrap( ~ variable)
-}
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_path-1.png b/docs/reference/geom_path-1.png deleted file mode 100644 index 77bb12fc7..000000000 Binary files a/docs/reference/geom_path-1.png and /dev/null differ diff --git a/docs/reference/geom_path-10.png b/docs/reference/geom_path-10.png deleted file mode 100644 index 74b4a29ac..000000000 Binary files a/docs/reference/geom_path-10.png and /dev/null differ diff --git a/docs/reference/geom_path-11.png b/docs/reference/geom_path-11.png deleted file mode 100644 index fcecbf156..000000000 Binary files a/docs/reference/geom_path-11.png and /dev/null differ diff --git a/docs/reference/geom_path-12.png b/docs/reference/geom_path-12.png deleted file mode 100644 index fce8e83f3..000000000 Binary files a/docs/reference/geom_path-12.png and /dev/null differ diff --git a/docs/reference/geom_path-13.png b/docs/reference/geom_path-13.png deleted file mode 100644 index d06bbbe21..000000000 Binary files a/docs/reference/geom_path-13.png and /dev/null differ diff --git a/docs/reference/geom_path-14.png b/docs/reference/geom_path-14.png deleted file mode 100644 index 9eadd312e..000000000 Binary files a/docs/reference/geom_path-14.png and /dev/null differ diff --git a/docs/reference/geom_path-15.png b/docs/reference/geom_path-15.png deleted file mode 100644 index 748afce33..000000000 Binary files a/docs/reference/geom_path-15.png and /dev/null differ diff --git a/docs/reference/geom_path-16.png b/docs/reference/geom_path-16.png deleted file mode 100644 index 1d6f06450..000000000 Binary files a/docs/reference/geom_path-16.png and /dev/null differ diff --git a/docs/reference/geom_path-17.png b/docs/reference/geom_path-17.png deleted file mode 100644 index 9e2f4a0e3..000000000 Binary files a/docs/reference/geom_path-17.png and /dev/null differ diff --git a/docs/reference/geom_path-18.png b/docs/reference/geom_path-18.png deleted file mode 100644 index 0eba9820b..000000000 Binary files a/docs/reference/geom_path-18.png and /dev/null differ diff --git a/docs/reference/geom_path-2.png b/docs/reference/geom_path-2.png deleted file mode 100644 index a2ac29ce3..000000000 Binary files a/docs/reference/geom_path-2.png and /dev/null differ diff --git a/docs/reference/geom_path-3.png b/docs/reference/geom_path-3.png deleted file mode 100644 index cd480a29f..000000000 Binary files a/docs/reference/geom_path-3.png and /dev/null differ diff --git a/docs/reference/geom_path-4.png b/docs/reference/geom_path-4.png deleted file mode 100644 index 5b8081927..000000000 Binary files a/docs/reference/geom_path-4.png and /dev/null differ diff --git a/docs/reference/geom_path-5.png b/docs/reference/geom_path-5.png deleted file mode 100644 index 04522b2fa..000000000 Binary files a/docs/reference/geom_path-5.png and /dev/null differ diff --git a/docs/reference/geom_path-6.png b/docs/reference/geom_path-6.png deleted file mode 100644 index 573fc83e5..000000000 Binary files a/docs/reference/geom_path-6.png and /dev/null differ diff --git a/docs/reference/geom_path-7.png b/docs/reference/geom_path-7.png deleted file mode 100644 index 5e6ec57b6..000000000 Binary files a/docs/reference/geom_path-7.png and /dev/null differ diff --git a/docs/reference/geom_path-8.png b/docs/reference/geom_path-8.png deleted file mode 100644 index d76a1ade3..000000000 Binary files a/docs/reference/geom_path-8.png and /dev/null differ diff --git a/docs/reference/geom_path-9.png b/docs/reference/geom_path-9.png deleted file mode 100644 index 8ce81f3da..000000000 Binary files a/docs/reference/geom_path-9.png and /dev/null differ diff --git a/docs/reference/geom_path.html b/docs/reference/geom_path.html deleted file mode 100644 index 5e3233828..000000000 --- a/docs/reference/geom_path.html +++ /dev/null @@ -1,312 +0,0 @@ - -Connect observations. — geom_path • animint2 - Skip to contents - - -
-
-
- -
-

geom_path() connects the observations in the order in which they appear -in the data. geom_line() connects them in order of the variable on the -x axis. geom_step() creates a stairstep plot, highlighting exactly -when changes occur.

-
- -
-

Usage

-
geom_path(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  lineend = "butt",
-  linejoin = "round",
-  linemitre = 1,
-  arrow = NULL,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_line(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE,
-  ...
-)
-
-geom_step(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  direction = "hv",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE,
-  ...
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
lineend
-

Line end style (round, butt, square)

- - -
linejoin
-

Line join style (round, mitre, bevel)

- - -
linemitre
-

Line mitre limit (number greater than 1)

- - -
arrow
-

Arrow specification, as created by arrow

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
direction
-

direction of stairs: 'vh' for vertical then horizontal, or -'hv' for horizontal then vertical

- -
-
-

Aesthetics

- - -

geom_path understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
-
-

See also

-

geom_polygon: Filled paths (polygons); - geom_segment: Line segments

-
- -
-

Examples

-
# geom_line() is suitable for time series
-ggplot(economics, aes(date, unemploy)) + geom_line()
-
-ggplot(economics_long, aes(date, value01, colour = variable)) +
-  geom_line()
-
-
-# geom_step() is useful when you want to highlight exactly when
-# the y value chanes
-recent <- economics[economics$date > as.Date("2013-01-01"), ]
-ggplot(recent, aes(date, unemploy)) + geom_line()
-
-ggplot(recent, aes(date, unemploy)) + geom_step()
-
-
-# geom_path lets you explore how two variables are related over time,
-# e.g. unemployment and personal savings rate
-m <- ggplot(economics, aes(unemploy/pop, psavert))
-m + geom_path()
-
-m + geom_path(aes(colour = as.numeric(date)))
-
-
-# Changing parameters ----------------------------------------------
-ggplot(economics, aes(date, unemploy)) +
-  geom_line(colour = "red")
-
-
-# Use the arrow parameter to add an arrow to the line
-# See ?arrow for more details
-c <- ggplot(economics, aes(x = date, y = pop))
-c + geom_line(arrow = arrow())
-
-c + geom_line(
-  arrow = arrow(angle = 15, ends = "both", type = "closed")
-)
-
-
-# Control line join parameters
-df <- data.frame(x = 1:3, y = c(4, 1, 9))
-base <- ggplot(df, aes(x, y))
-base + geom_path(size = 10)
-
-base + geom_path(size = 10, lineend = "round")
-
-base + geom_path(size = 10, linejoin = "mitre", lineend = "butt")
-
-
-# NAs break the line. Use na.rm = T to suppress the warning message
-df <- data.frame(
-  x = 1:5,
-  y1 = c(1, 2, 3, 4, NA),
-  y2 = c(NA, 2, 3, 4, 5),
-  y3 = c(1, 2, NA, 4, 5)
-)
-ggplot(df, aes(x, y1)) + geom_point() + geom_line()
-#> Warning: Removed 1 rows containing missing values (geom_point).
-#> Warning: Removed 1 rows containing missing values (geom_path).
-
-ggplot(df, aes(x, y2)) + geom_point() + geom_line()
-#> Warning: Removed 1 rows containing missing values (geom_point).
-#> Warning: Removed 1 rows containing missing values (geom_path).
-
-ggplot(df, aes(x, y3)) + geom_point() + geom_line()
-#> Warning: Removed 1 rows containing missing values (geom_point).
-
-
-# \donttest{
-# Setting line type vs colour/size
-# Line type needs to be applied to a line as a whole, so it can
-# not be used with colour or size that vary across a line
-x <- seq(0.01, .99, length.out = 100)
-df <- data.frame(
-  x = rep(x, 2),
-  y = c(qlogis(x), 2 * qlogis(x)),
-  group = rep(c("a","b"),
-  each = 100)
-)
-p <- ggplot(df, aes(x=x, y=y, group=group))
-# These work
-p + geom_line(linetype = 2)
-
-p + geom_line(aes(colour = group), linetype = 2)
-
-p + geom_line(aes(colour = x))
-
-# But this doesn't
-should_stop(p + geom_line(aes(colour = x), linetype=2))
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_point-1.png b/docs/reference/geom_point-1.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/geom_point-1.png and /dev/null differ diff --git a/docs/reference/geom_point-10.png b/docs/reference/geom_point-10.png deleted file mode 100644 index 92d8c5af1..000000000 Binary files a/docs/reference/geom_point-10.png and /dev/null differ diff --git a/docs/reference/geom_point-11.png b/docs/reference/geom_point-11.png deleted file mode 100644 index d05b30840..000000000 Binary files a/docs/reference/geom_point-11.png and /dev/null differ diff --git a/docs/reference/geom_point-12.png b/docs/reference/geom_point-12.png deleted file mode 100644 index 1d0ee9bbe..000000000 Binary files a/docs/reference/geom_point-12.png and /dev/null differ diff --git a/docs/reference/geom_point-13.png b/docs/reference/geom_point-13.png deleted file mode 100644 index 75aa7dfa9..000000000 Binary files a/docs/reference/geom_point-13.png and /dev/null differ diff --git a/docs/reference/geom_point-14.png b/docs/reference/geom_point-14.png deleted file mode 100644 index 75aa7dfa9..000000000 Binary files a/docs/reference/geom_point-14.png and /dev/null differ diff --git a/docs/reference/geom_point-15.png b/docs/reference/geom_point-15.png deleted file mode 100644 index d10d5a8b3..000000000 Binary files a/docs/reference/geom_point-15.png and /dev/null differ diff --git a/docs/reference/geom_point-16.png b/docs/reference/geom_point-16.png deleted file mode 100644 index d10d5a8b3..000000000 Binary files a/docs/reference/geom_point-16.png and /dev/null differ diff --git a/docs/reference/geom_point-2.png b/docs/reference/geom_point-2.png deleted file mode 100644 index 1ec47d4db..000000000 Binary files a/docs/reference/geom_point-2.png and /dev/null differ diff --git a/docs/reference/geom_point-3.png b/docs/reference/geom_point-3.png deleted file mode 100644 index 054dcba47..000000000 Binary files a/docs/reference/geom_point-3.png and /dev/null differ diff --git a/docs/reference/geom_point-4.png b/docs/reference/geom_point-4.png deleted file mode 100644 index 622873bf5..000000000 Binary files a/docs/reference/geom_point-4.png and /dev/null differ diff --git a/docs/reference/geom_point-5.png b/docs/reference/geom_point-5.png deleted file mode 100644 index a23198f21..000000000 Binary files a/docs/reference/geom_point-5.png and /dev/null differ diff --git a/docs/reference/geom_point-6.png b/docs/reference/geom_point-6.png deleted file mode 100644 index ecea8fab0..000000000 Binary files a/docs/reference/geom_point-6.png and /dev/null differ diff --git a/docs/reference/geom_point-7.png b/docs/reference/geom_point-7.png deleted file mode 100644 index 01af0123b..000000000 Binary files a/docs/reference/geom_point-7.png and /dev/null differ diff --git a/docs/reference/geom_point-8.png b/docs/reference/geom_point-8.png deleted file mode 100644 index c58ff1cb7..000000000 Binary files a/docs/reference/geom_point-8.png and /dev/null differ diff --git a/docs/reference/geom_point-9.png b/docs/reference/geom_point-9.png deleted file mode 100644 index 8f0c30a7f..000000000 Binary files a/docs/reference/geom_point-9.png and /dev/null differ diff --git a/docs/reference/geom_point.html b/docs/reference/geom_point.html deleted file mode 100644 index 463f63f0e..000000000 --- a/docs/reference/geom_point.html +++ /dev/null @@ -1,257 +0,0 @@ - -Points, as for a scatterplot — geom_point • animint2 - Skip to contents - - -
-
-
- -
-

The point geom is used to create scatterplots.

-
- -
-

Usage

-
geom_point(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Details

-

The scatterplot is useful for displaying the relationship between two -continuous variables, although it can also be used with one continuous -and one categorical variable, or two categorical variables. See -geom_jitter for possibilities.

-

The bubblechart is a scatterplot with a third variable mapped to -the size of points. There are no special names for scatterplots where -another variable is mapped to point shape or colour, however.

-

The biggest potential problem with a scatterplot is overplotting: whenever -you have more than a few points, points may be plotted on top of one -another. This can severely distort the visual appearance of the plot. -There is no one solution to this problem, but there are some techniques -that can help. You can add additional information with -geom_smooth or -geom_density_2d. Alternatively, you can -summarise the number of points at each location and display that in some -way, using stat_sum. Another technique is to use transparent -points, e.g. geom_point(alpha = 0.05).

-
-
-

Aesthetics

- - -

geom_point understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • shape

  • -
  • size

  • -
  • stroke

  • -
-
-

See also

-

scale_size to see scale area of points, instead of - radius, geom_jitter to jitter points to reduce (mild) - overplotting

-
- -
-

Examples

-
p <- ggplot(mtcars, aes(wt, mpg))
-p + geom_point()
-
-
-# Add aesthetic mappings
-p + geom_point(aes(colour = factor(cyl)))
-
-p + geom_point(aes(shape = factor(cyl)))
-
-p + geom_point(aes(size = qsec))
-
-
-# Change scales
-p + geom_point(aes(colour = cyl)) + scale_colour_gradient(low = "blue")
-
-p + geom_point(aes(shape = factor(cyl))) + scale_shape(solid = FALSE)
-
-
-# Set aesthetics to fixed value
-ggplot(mtcars, aes(wt, mpg)) + geom_point(colour = "red", size = 3)
-
-
-# \donttest{
-# Varying alpha is useful for large datasets
-d <- ggplot(diamonds, aes(carat, price))
-d + geom_point(alpha = 1/10)
-
-d + geom_point(alpha = 1/20)
-
-d + geom_point(alpha = 1/100)
-
-# }
-
-# For shapes that have a border (like 21), you can colour the inside and
-# outside separately. Use the stroke aesthetic to modify the width of the
-# border
-ggplot(mtcars, aes(wt, mpg)) +
-  geom_point(shape = 21, colour = "black", fill = "white", size = 5, stroke = 5)
-
-
-# \donttest{
-# You can create interesting shapes by layering multiple points of
-# different sizes
-p <- ggplot(mtcars, aes(mpg, wt, shape = factor(cyl)))
-p + geom_point(aes(colour = factor(cyl)), size = 4) +
-  geom_point(colour = "grey90", size = 1.5)
-
-p + geom_point(colour = "black", size = 4.5) +
-  geom_point(colour = "pink", size = 4) +
-  geom_point(aes(shape = factor(cyl)))
-
-
-# These extra layers don't usually appear in the legend, but we can
-# force their inclusion
-p + geom_point(colour = "black", size = 4.5, show.legend = TRUE) +
-  geom_point(colour = "pink", size = 4, show.legend = TRUE) +
-  geom_point(aes(shape = factor(cyl)))
-
-
-# geom_point warns when missing values have been dropped from the data set
-# and not plotted, you can turn this off by setting na.rm = TRUE
-mtcars2 <- transform(mtcars, mpg = ifelse(runif(32) < 0.2, NA, mpg))
-ggplot(mtcars2, aes(wt, mpg)) + geom_point()
-#> Warning: Removed 2 rows containing missing values (geom_point).
-
-ggplot(mtcars2, aes(wt, mpg)) + geom_point(na.rm = TRUE)
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_polygon-1.png b/docs/reference/geom_polygon-1.png deleted file mode 100644 index 916beebd0..000000000 Binary files a/docs/reference/geom_polygon-1.png and /dev/null differ diff --git a/docs/reference/geom_polygon-2.png b/docs/reference/geom_polygon-2.png deleted file mode 100644 index e458b1320..000000000 Binary files a/docs/reference/geom_polygon-2.png and /dev/null differ diff --git a/docs/reference/geom_polygon.html b/docs/reference/geom_polygon.html deleted file mode 100644 index 76a56ea3f..000000000 --- a/docs/reference/geom_polygon.html +++ /dev/null @@ -1,206 +0,0 @@ - -Polygon, a filled path. — geom_polygon • animint2 - Skip to contents - - -
-
-
- -
-

Polygon, a filled path.

-
- -
-

Usage

-
geom_polygon(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_polygon understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
-
-

See also

-

geom_path for an unfilled polygon, - geom_ribbon for a polygon anchored on the x-axis

-
- -
-

Examples

-
# When using geom_polygon, you will typically need two data frames:
-# one contains the coordinates of each polygon (positions),  and the
-# other the values associated with each polygon (values).  An id
-# variable links the two together
-
-ids <- factor(c("1.1", "2.1", "1.2", "2.2", "1.3", "2.3"))
-
-values <- data.frame(
-  id = ids,
-  value = c(3, 3.1, 3.1, 3.2, 3.15, 3.5)
-)
-
-positions <- data.frame(
-  id = rep(ids, each = 4),
-  x = c(2, 1, 1.1, 2.2, 1, 0, 0.3, 1.1, 2.2, 1.1, 1.2, 2.5, 1.1, 0.3,
-  0.5, 1.2, 2.5, 1.2, 1.3, 2.7, 1.2, 0.5, 0.6, 1.3),
-  y = c(-0.5, 0, 1, 0.5, 0, 0.5, 1.5, 1, 0.5, 1, 2.1, 1.7, 1, 1.5,
-  2.2, 2.1, 1.7, 2.1, 3.2, 2.8, 2.1, 2.2, 3.3, 3.2)
-)
-
-# Currently we need to manually merge the two together
-datapoly <- merge(values, positions, by = c("id"))
-
-(p <- ggplot(datapoly, aes(x = x, y = y)) + geom_polygon(aes(fill = value, group = id)))
-
-
-# Which seems like a lot of work, but then it's easy to add on
-# other features in this coordinate system, e.g.:
-
-stream <- data.frame(
-  x = cumsum(runif(50, max = 0.1)),
-  y = cumsum(runif(50,max = 0.1))
-)
-
-p + geom_line(data = stream, colour = "grey30", size = 5)
-
-
-# And if the positions are in longitude and latitude, you can use
-# coord_map to produce different map projections.
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_ribbon-1.png b/docs/reference/geom_ribbon-1.png deleted file mode 100644 index 926c60e5c..000000000 Binary files a/docs/reference/geom_ribbon-1.png and /dev/null differ diff --git a/docs/reference/geom_ribbon-2.png b/docs/reference/geom_ribbon-2.png deleted file mode 100644 index 2271a3fef..000000000 Binary files a/docs/reference/geom_ribbon-2.png and /dev/null differ diff --git a/docs/reference/geom_ribbon-3.png b/docs/reference/geom_ribbon-3.png deleted file mode 100644 index 29680976a..000000000 Binary files a/docs/reference/geom_ribbon-3.png and /dev/null differ diff --git a/docs/reference/geom_ribbon.html b/docs/reference/geom_ribbon.html deleted file mode 100644 index ec1e0c39d..000000000 --- a/docs/reference/geom_ribbon.html +++ /dev/null @@ -1,208 +0,0 @@ - -Ribbons and area plots. — geom_ribbon • animint2 - Skip to contents - - -
-
-
- -
-

For each continuous x value, geom_interval displays a y interval. -geom_area is a special case of geom_ribbon, where the -minimum of the range is fixed to 0.

-
- -
-

Usage

-
geom_ribbon(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_area(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "stack",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE,
-  ...
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Details

-

An area plot is the continuous analog of a stacked bar chart (see -geom_bar), and can be used to show how composition of the -whole varies over the range of x. Choosing the order in which different -components is stacked is very important, as it becomes increasing hard to -see the individual pattern as you move up the stack.

-
-
-

Aesthetics

- - -

geom_ribbon understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • ymax

  • -
  • ymin

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
-
-

See also

-

geom_bar for discrete intervals (bars), - geom_linerange for discrete intervals (lines), - geom_polygon for general polygons

-
- -
-

Examples

-
# Generate data
-huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron))
-h <- ggplot(huron, aes(year))
-
-h + geom_ribbon(aes(ymin=0, ymax=level))
-
-h + geom_area(aes(y = level))
-
-
-# Add aesthetic mappings
-h +
-  geom_ribbon(aes(ymin = level - 1, ymax = level + 1), fill = "grey70") +
-  geom_line(aes(y = level))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_rug-1.png b/docs/reference/geom_rug-1.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/geom_rug-1.png and /dev/null differ diff --git a/docs/reference/geom_rug-2.png b/docs/reference/geom_rug-2.png deleted file mode 100644 index 006bdd600..000000000 Binary files a/docs/reference/geom_rug-2.png and /dev/null differ diff --git a/docs/reference/geom_rug-3.png b/docs/reference/geom_rug-3.png deleted file mode 100644 index 1771b6d75..000000000 Binary files a/docs/reference/geom_rug-3.png and /dev/null differ diff --git a/docs/reference/geom_rug-4.png b/docs/reference/geom_rug-4.png deleted file mode 100644 index 6194b818d..000000000 Binary files a/docs/reference/geom_rug-4.png and /dev/null differ diff --git a/docs/reference/geom_rug-5.png b/docs/reference/geom_rug-5.png deleted file mode 100644 index e8d073e70..000000000 Binary files a/docs/reference/geom_rug-5.png and /dev/null differ diff --git a/docs/reference/geom_rug.html b/docs/reference/geom_rug.html deleted file mode 100644 index 00a4ed578..000000000 --- a/docs/reference/geom_rug.html +++ /dev/null @@ -1,177 +0,0 @@ - -Marginal rug plots. — geom_rug • animint2 - Skip to contents - - -
-
-
- -
-

Marginal rug plots.

-
- -
-

Usage

-
geom_rug(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  sides = "bl",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
sides
-

A string that controls which sides of the plot the rugs appear on. -It can be set to a string containing any of "trbl", for top, right, -bottom, and left.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_rug understands the following aesthetics (required aesthetics are in bold):

  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
- -
-

Examples

-
p <- ggplot(mtcars, aes(wt, mpg))
-p + geom_point()
-
-p + geom_point() + geom_rug()
-
-p + geom_point() + geom_rug(sides="b")    # Rug on bottom only
-
-p + geom_point() + geom_rug(sides="trbl") # All four sides
-
-p + geom_point() + geom_rug(position='jitter')
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_segment-1.png b/docs/reference/geom_segment-1.png deleted file mode 100644 index 53b1f754f..000000000 Binary files a/docs/reference/geom_segment-1.png and /dev/null differ diff --git a/docs/reference/geom_segment-2.png b/docs/reference/geom_segment-2.png deleted file mode 100644 index 8162a1fa1..000000000 Binary files a/docs/reference/geom_segment-2.png and /dev/null differ diff --git a/docs/reference/geom_segment-3.png b/docs/reference/geom_segment-3.png deleted file mode 100644 index 75b3db6c7..000000000 Binary files a/docs/reference/geom_segment-3.png and /dev/null differ diff --git a/docs/reference/geom_segment-4.png b/docs/reference/geom_segment-4.png deleted file mode 100644 index 8814a5896..000000000 Binary files a/docs/reference/geom_segment-4.png and /dev/null differ diff --git a/docs/reference/geom_segment-5.png b/docs/reference/geom_segment-5.png deleted file mode 100644 index 9f6c14adb..000000000 Binary files a/docs/reference/geom_segment-5.png and /dev/null differ diff --git a/docs/reference/geom_segment-6.png b/docs/reference/geom_segment-6.png deleted file mode 100644 index 093c5bc0d..000000000 Binary files a/docs/reference/geom_segment-6.png and /dev/null differ diff --git a/docs/reference/geom_segment-7.png b/docs/reference/geom_segment-7.png deleted file mode 100644 index 9df227678..000000000 Binary files a/docs/reference/geom_segment-7.png and /dev/null differ diff --git a/docs/reference/geom_segment.html b/docs/reference/geom_segment.html deleted file mode 100644 index 69016a870..000000000 --- a/docs/reference/geom_segment.html +++ /dev/null @@ -1,253 +0,0 @@ - -Line segments and curves. — geom_segment • animint2 - Skip to contents - - -
-
-
- -
-

geom_segment draws a straight line between points (x1, y1) and -(x2, y2). geom_curve draws a curved line.

-
- -
-

Usage

-
geom_segment(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  arrow = NULL,
-  lineend = "butt",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_curve(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  curvature = 0.5,
-  angle = 90,
-  ncp = 5,
-  arrow = NULL,
-  lineend = "butt",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
arrow
-

specification for arrow heads, as created by arrow()

- - -
lineend
-

Line end style (round, butt, square)

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
curvature
-

A numeric value giving the amount of curvature. - Negative values produce left-hand curves, positive values - produce right-hand curves, and zero produces a straight line.

- - -
angle
-

A numeric value between 0 and 180, - giving an amount to skew the control - points of the curve. Values less than 90 skew the curve towards - the start point and values greater than 90 skew the curve - towards the end point.

- - -
ncp
-

The number of control points used to draw the curve. - More control points creates a smoother curve.

- -
-
-

Aesthetics

- - -

geom_segment understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • xend

  • -
  • y

  • -
  • yend

  • -
  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
-
-

See also

-

geom_path and geom_line for multi- - segment lines and paths.

-

geom_spoke for a segment parameterised by a location - (x, y), and an angle and radius.

-
- -
-

Examples

-
b <- ggplot(mtcars, aes(wt, mpg)) +
-  geom_point()
-
-df <- data.frame(x1 = 2.62, x2 = 3.57, y1 = 21.0, y2 = 15.0)
-b +
- geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2, colour = "curve"), data = df) +
- geom_segment(aes(x = x1, y = y1, xend = x2, yend = y2, colour = "segment"), data = df)
-
-
-b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), data = df, curvature = -0.2)
-
-b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), data = df, curvature = 1)
-
-b + geom_curve(
-  aes(x = x1, y = y1, xend = x2, yend = y2),
-  data = df,
-  arrow = arrow(length = unit(0.03, "npc"))
-)
-
-
-ggplot(seals, aes(long, lat)) +
-  geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat),
-    arrow = arrow(length = unit(0.1,"cm"))) +
-  borders("state")
-
-
-# You can also use geom_segment to recreate plot(type = "h") :
-counts <- as.data.frame(table(x = rpois(100,5)))
-counts$x <- as.numeric(as.character(counts$x))
-with(counts, plot(x, Freq, type = "h", lwd = 10))
-
-
-ggplot(counts, aes(x, Freq)) +
-  geom_segment(aes(xend = x, yend = 0), size = 10, lineend = "butt")
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_smooth-1.png b/docs/reference/geom_smooth-1.png deleted file mode 100644 index a097e9a1b..000000000 Binary files a/docs/reference/geom_smooth-1.png and /dev/null differ diff --git a/docs/reference/geom_smooth-2.png b/docs/reference/geom_smooth-2.png deleted file mode 100644 index a1b239370..000000000 Binary files a/docs/reference/geom_smooth-2.png and /dev/null differ diff --git a/docs/reference/geom_smooth-3.png b/docs/reference/geom_smooth-3.png deleted file mode 100644 index 99ed05ea4..000000000 Binary files a/docs/reference/geom_smooth-3.png and /dev/null differ diff --git a/docs/reference/geom_smooth-4.png b/docs/reference/geom_smooth-4.png deleted file mode 100644 index 74ee66c90..000000000 Binary files a/docs/reference/geom_smooth-4.png and /dev/null differ diff --git a/docs/reference/geom_smooth-5.png b/docs/reference/geom_smooth-5.png deleted file mode 100644 index 400e6c1a7..000000000 Binary files a/docs/reference/geom_smooth-5.png and /dev/null differ diff --git a/docs/reference/geom_smooth-6.png b/docs/reference/geom_smooth-6.png deleted file mode 100644 index dc476b183..000000000 Binary files a/docs/reference/geom_smooth-6.png and /dev/null differ diff --git a/docs/reference/geom_smooth-7.png b/docs/reference/geom_smooth-7.png deleted file mode 100644 index bd31e1b88..000000000 Binary files a/docs/reference/geom_smooth-7.png and /dev/null differ diff --git a/docs/reference/geom_smooth-8.png b/docs/reference/geom_smooth-8.png deleted file mode 100644 index ff426c68c..000000000 Binary files a/docs/reference/geom_smooth-8.png and /dev/null differ diff --git a/docs/reference/geom_smooth-9.png b/docs/reference/geom_smooth-9.png deleted file mode 100644 index 22ab00cca..000000000 Binary files a/docs/reference/geom_smooth-9.png and /dev/null differ diff --git a/docs/reference/geom_smooth.html b/docs/reference/geom_smooth.html deleted file mode 100644 index 077c333df..000000000 --- a/docs/reference/geom_smooth.html +++ /dev/null @@ -1,332 +0,0 @@ - -Add a smoothed conditional mean. — geom_smooth • animint2 - Skip to contents - - -
-
-
- -
-

Aids the eye in seeing patterns in the presence of overplotting. -geom_smooth and stat_smooth are effectively aliases: they -both use the same arguments. Use geom_smooth unless you want to -display the results with a non-standard geom.

-
- -
-

Usage

-
geom_smooth(
-  mapping = NULL,
-  data = NULL,
-  stat = "smooth",
-  position = "identity",
-  ...,
-  method = "auto",
-  formula = y ~ x,
-  se = TRUE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_smooth(
-  mapping = NULL,
-  data = NULL,
-  geom = "smooth",
-  position = "identity",
-  ...,
-  method = "auto",
-  formula = y ~ x,
-  se = TRUE,
-  n = 80,
-  span = 0.75,
-  fullrange = FALSE,
-  level = 0.95,
-  method.args = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
method
-

smoothing method (function) to use, eg. lm, glm, gam, loess, -rlm. For datasets with n < 1000 default is loess. For datasets -with 1000 or more observations defaults to gam, see gam -for more details.

- - -
formula
-

formula to use in smoothing function, eg. y ~ x, -y ~ poly(x, 2), y ~ log(x)

- - -
se
-

display confidence interval around smooth? (TRUE by default, see -level to control

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Use to override the default connection between -geom_smooth and stat_smooth.

- - -
n
-

number of points to evaluate smoother at

- - -
span
-

Controls the amount of smoothing for the default loess smoother. -Smaller numbers produce wigglier lines, larger numbers produce smoother -lines.

- - -
fullrange
-

should the fit span the full range of the plot, or just -the data

- - -
level
-

level of confidence interval to use (0.95 by default)

- - -
method.args
-

List of additional arguments passed on to the modelling -function defined by method.

- -
-
-

Details

-

Calculation is performed by the (currently undocumented) -predictdf generic and its methods. For most methods the standard -error bounds are computed using the predict method - the -exceptions are loess which uses a t-based approximation, and -glm where the normal confidence interval is constructed on the link -scale, and then back-transformed to the response scale.

-
-
-

Aesthetics

- - -

geom_smooth understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
  • weight

  • -
-
-

Computed variables

- - -
y
-

predicted value

- -
ymin
-

lower pointwise confidence interval around the mean

- -
ymax
-

upper pointwise confidence interval around the mean

- -
se
-

standard error

- - -
-
-

See also

-

See individual modelling functions for more details: - lm for linear smooths, - glm for generalised linear smooths, - loess for local smooths

-
- -
-

Examples

-
ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  geom_smooth()
-
-
-# Use span to control the "wiggliness" of the default loess smoother
-# The span is the fraction of points used to fit each local regression:
-# small numbers make a wigglier curve, larger numbers make a smoother curve.
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  geom_smooth(span = 0.3)
-
-
-# Instead of a loess smooth, you can use any other modelling function:
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  geom_smooth(method = "lm", se = FALSE)
-
-
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  geom_smooth(method = "lm", formula = y ~ splines::bs(x, 3), se = FALSE)
-
-
-# Smoothes are automatically fit to each group (defined by categorical
-# aesthetics or the group aesthetic) and for each facet
-
-ggplot(mpg, aes(displ, hwy, colour = class)) +
-  geom_point() +
-  geom_smooth(se = FALSE, method = "lm")
-
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point() +
-  geom_smooth(span = 0.8) +
-  facet_wrap(~drv)
-
-
-# \donttest{
-binomial_smooth <- function(...) {
-  geom_smooth(method = "glm", method.args = list(family = "binomial"), ...)
-}
-# To fit a logistic regression, you need to coerce the values to
-# a numeric vector lying between 0 and 1.
-ggplot(rpart::kyphosis, aes(Age, Kyphosis)) +
-  geom_jitter(height = 0.05) +
-  binomial_smooth()
-#> Warning: Computation failed in `stat_smooth()`:
-#> y values must be 0 <= y <= 1
-
-
-ggplot(rpart::kyphosis, aes(Age, as.numeric(Kyphosis) - 1)) +
-  geom_jitter(height = 0.05) +
-  binomial_smooth()
-
-
-ggplot(rpart::kyphosis, aes(Age, as.numeric(Kyphosis) - 1)) +
-  geom_jitter(height = 0.05) +
-  binomial_smooth(formula = y ~ splines::ns(x, 2))
-
-
-# But in this case, it's probably better to fit the model yourself
-# so you can exercise more control and see whether or not it's a good model
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_spoke-1.png b/docs/reference/geom_spoke-1.png deleted file mode 100644 index 172271711..000000000 Binary files a/docs/reference/geom_spoke-1.png and /dev/null differ diff --git a/docs/reference/geom_spoke-2.png b/docs/reference/geom_spoke-2.png deleted file mode 100644 index 877b0584c..000000000 Binary files a/docs/reference/geom_spoke-2.png and /dev/null differ diff --git a/docs/reference/geom_spoke.html b/docs/reference/geom_spoke.html deleted file mode 100644 index 47c358be2..000000000 --- a/docs/reference/geom_spoke.html +++ /dev/null @@ -1,176 +0,0 @@ - -A line segment parameterised by location, direction and distance. — geom_spoke • animint2 - Skip to contents - - -
-
-
- -
-

A line segment parameterised by location, direction and distance.

-
- -
-

Usage

-
geom_spoke(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_spoke understands the following aesthetics (required aesthetics are in bold):

  • angle

  • -
  • radius

  • -
  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • linetype

  • -
  • size

  • -
- -
-

Examples

-
df <- expand.grid(x = 1:10, y=1:10)
-df$angle <- runif(100, 0, 2*pi)
-df$speed <- runif(100, 0, sqrt(0.1 * df$x))
-
-ggplot(df, aes(x, y)) +
-  geom_point() +
-  geom_spoke(aes(angle = angle), radius = 0.5)
-
-
-ggplot(df, aes(x, y)) +
-  geom_point() +
-  geom_spoke(aes(angle = angle, radius = speed))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_tallrect.html b/docs/reference/geom_tallrect.html deleted file mode 100644 index 2a92521f1..000000000 --- a/docs/reference/geom_tallrect.html +++ /dev/null @@ -1,173 +0,0 @@ - -ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect • animint2 - Skip to contents - - -
-
-
- -
-

ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements.

-
- -
-

Usage

-
geom_tallrect(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

aesthetic mapping

- - -
data
-

data set

- - -
stat
-

statistic mapping, defaults to identity

- - -
position
-

position mapping, defaults to identity

- - -
...
-

other arguments

- - -
na.rm
-

remove missing values?

- - -
show.legend
-

TRUE or FALSE

- - -
inherit.aes
-

TRUE or FALSE

- -
-
-

Value

- - -

ggplot2 layer

-
- -
-

Examples

-
if(require('data.table'))setDTthreads(1)#for CRAN.
-
-library(animint2)
-
-## Example: 2 plots, 2 selectors, but only interacting with 1 plot.
-data(breakpoints)
-only.error <- subset(breakpoints$error,type=="E")
-only.segments <- subset(only.error,bases.per.probe==bases.per.probe[1])
-signal.colors <- c(estimate="#0adb0a", latent="#0098ef")
-breakpointError <- list(
-  signal=ggplot()+
-    geom_point(aes(
-      position, signal),
-      showSelected="bases.per.probe",
-      data=breakpoints$signals)+
-    geom_line(aes(
-      position, signal), 
-      colour=signal.colors[["latent"]],
-      data=breakpoints$imprecision)+
-    geom_segment(aes(
-      first.base, mean, xend=last.base, yend=mean),
-      showSelected=c("segments", "bases.per.probe"),
-      colour=signal.colors[["estimate"]],
-      data=breakpoints$segments)+
-    geom_vline(aes(
-      xintercept=base),
-      showSelected=c("segments", "bases.per.probe"),
-      colour=signal.colors[["estimate"]],
-      linetype="dashed",
-      data=breakpoints$breaks),
-  error=ggplot()+
-    geom_vline(aes(
-      xintercept=segments), 
-      clickSelects="segments",
-      data=only.segments, lwd=17, alpha=1/2)+
-    geom_line(aes(
-      segments, error, group=bases.per.probe),
-      clickSelects="bases.per.probe",
-      data=only.error, lwd=4))
-animint2dir(breakpointError)
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_text-1.png b/docs/reference/geom_text-1.png deleted file mode 100644 index e0fc33cf9..000000000 Binary files a/docs/reference/geom_text-1.png and /dev/null differ diff --git a/docs/reference/geom_text-10.png b/docs/reference/geom_text-10.png deleted file mode 100644 index e0307bd97..000000000 Binary files a/docs/reference/geom_text-10.png and /dev/null differ diff --git a/docs/reference/geom_text-11.png b/docs/reference/geom_text-11.png deleted file mode 100644 index d49e37b9d..000000000 Binary files a/docs/reference/geom_text-11.png and /dev/null differ diff --git a/docs/reference/geom_text-12.png b/docs/reference/geom_text-12.png deleted file mode 100644 index bb2a573c8..000000000 Binary files a/docs/reference/geom_text-12.png and /dev/null differ diff --git a/docs/reference/geom_text-13.png b/docs/reference/geom_text-13.png deleted file mode 100644 index 8c49b4854..000000000 Binary files a/docs/reference/geom_text-13.png and /dev/null differ diff --git a/docs/reference/geom_text-14.png b/docs/reference/geom_text-14.png deleted file mode 100644 index de9b92456..000000000 Binary files a/docs/reference/geom_text-14.png and /dev/null differ diff --git a/docs/reference/geom_text-15.png b/docs/reference/geom_text-15.png deleted file mode 100644 index 0637b5bd0..000000000 Binary files a/docs/reference/geom_text-15.png and /dev/null differ diff --git a/docs/reference/geom_text-16.png b/docs/reference/geom_text-16.png deleted file mode 100644 index 5294a69ac..000000000 Binary files a/docs/reference/geom_text-16.png and /dev/null differ diff --git a/docs/reference/geom_text-17.png b/docs/reference/geom_text-17.png deleted file mode 100644 index b8803001e..000000000 Binary files a/docs/reference/geom_text-17.png and /dev/null differ diff --git a/docs/reference/geom_text-18.png b/docs/reference/geom_text-18.png deleted file mode 100644 index a3e0f03b4..000000000 Binary files a/docs/reference/geom_text-18.png and /dev/null differ diff --git a/docs/reference/geom_text-19.png b/docs/reference/geom_text-19.png deleted file mode 100644 index d3358bdb5..000000000 Binary files a/docs/reference/geom_text-19.png and /dev/null differ diff --git a/docs/reference/geom_text-2.png b/docs/reference/geom_text-2.png deleted file mode 100644 index 2c58e33c6..000000000 Binary files a/docs/reference/geom_text-2.png and /dev/null differ diff --git a/docs/reference/geom_text-20.png b/docs/reference/geom_text-20.png deleted file mode 100644 index e28d9c5d3..000000000 Binary files a/docs/reference/geom_text-20.png and /dev/null differ diff --git a/docs/reference/geom_text-3.png b/docs/reference/geom_text-3.png deleted file mode 100644 index dd55ac7fa..000000000 Binary files a/docs/reference/geom_text-3.png and /dev/null differ diff --git a/docs/reference/geom_text-4.png b/docs/reference/geom_text-4.png deleted file mode 100644 index 25cf3e066..000000000 Binary files a/docs/reference/geom_text-4.png and /dev/null differ diff --git a/docs/reference/geom_text-5.png b/docs/reference/geom_text-5.png deleted file mode 100644 index dac62a492..000000000 Binary files a/docs/reference/geom_text-5.png and /dev/null differ diff --git a/docs/reference/geom_text-6.png b/docs/reference/geom_text-6.png deleted file mode 100644 index 44237036e..000000000 Binary files a/docs/reference/geom_text-6.png and /dev/null differ diff --git a/docs/reference/geom_text-7.png b/docs/reference/geom_text-7.png deleted file mode 100644 index 3f7ae57a8..000000000 Binary files a/docs/reference/geom_text-7.png and /dev/null differ diff --git a/docs/reference/geom_text-8.png b/docs/reference/geom_text-8.png deleted file mode 100644 index baf874648..000000000 Binary files a/docs/reference/geom_text-8.png and /dev/null differ diff --git a/docs/reference/geom_text-9.png b/docs/reference/geom_text-9.png deleted file mode 100644 index 0a2187cf7..000000000 Binary files a/docs/reference/geom_text-9.png and /dev/null differ diff --git a/docs/reference/geom_text.html b/docs/reference/geom_text.html deleted file mode 100644 index 308bfce47..000000000 --- a/docs/reference/geom_text.html +++ /dev/null @@ -1,348 +0,0 @@ - -Textual annotations. — geom_label • animint2 - Skip to contents - - -
-
-
- -
-

geom_text adds text directly to the plot. geom_label draws -a rectangle underneath the text, making it easier to read.

-
- -
-

Usage

-
geom_label(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  parse = FALSE,
-  nudge_x = 0,
-  nudge_y = 0,
-  label.padding = unit(0.25, "lines"),
-  label.r = unit(0.15, "lines"),
-  label.size = 0.25,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_text(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  parse = FALSE,
-  nudge_x = 0,
-  nudge_y = 0,
-  check_overlap = FALSE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
parse
-

If TRUE, the labels will be parsed into expressions and -displayed as described in ?plotmath

- - -
nudge_x, nudge_y
-

Horizontal and vertical adjustment to nudge labels by. -Useful for offsetting text from points, particularly on discrete scales.

- - -
label.padding
-

Amount of padding around label. Defaults to 0.25 lines.

- - -
label.r
-

Radius of rounded corners. Defaults to 0.15 lines.

- - -
label.size
-

Size of label border, in mm.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
check_overlap
-

If TRUE, text that overlaps previous text in the -same layer will not be plotted. A quick and dirty way

- -
-
-

Details

-

Note the the "width" and "height" of a text element are 0, so stacking -and dodging text will not work by default, and axis limits are not -automatically expanded to include all text. Obviously, labels do have -height and width, but they are physical units, not data units. The amount of -space they occupy on that plot is not constant in data units: when you -resize a plot, labels stay the same size, but the size of the axes changes.

-
-
-

Aesthetics

- - -

geom_text understands the following aesthetics (required aesthetics are in bold):

  • label

  • -
  • x

  • -
  • y

  • -
  • alpha

  • -
  • angle

  • -
  • colour

  • -
  • family

  • -
  • fontface

  • -
  • hjust

  • -
  • lineheight

  • -
  • size

  • -
  • vjust

  • -
-
-

geom_label

- - -

Currently geom_label does not support the rot parameter and -is considerably slower than geom_text. The fill aesthetic -controls the background colour of the label.

-
-
-

Alignment

- - -

You can modify text alignment with the vjust and hjust -aesthetics. These can either be a number between 0 (right/bottom) and -1 (top/left) or a character ("left", "middle", "right", "bottom", "center", -"top"). There are two special alignments: "inward" and "outward". -Inward always aligns text towards the center, and outward aligns -it away from the center

-
- -
-

Examples

-
p <- ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars)))
-
-p + geom_text()
-
-# Avoid overlaps
-p + geom_text(check_overlap = TRUE)
-
-# Labels with background
-p + geom_label()
-
-# Change size of the label
-p + geom_text(size = 10)
-
-
-# Set aesthetics to fixed value
-p + geom_point() + geom_text(hjust = 0, nudge_x = 0.05)
-
-p + geom_point() + geom_text(vjust = 0, nudge_y = 0.5)
-
-p + geom_point() + geom_text(angle = 45)
-
-if (FALSE) {
-# Doesn't work on all systems
-p + geom_text(family = "Times New Roman")
-}
-
-# Add aesthetic mappings
-p + geom_text(aes(colour = factor(cyl)))
-
-p + geom_text(aes(colour = factor(cyl))) +
-  scale_colour_discrete(l = 40)
-
-p + geom_label(aes(fill = factor(cyl)), colour = "white", fontface = "bold")
-
-
-p + geom_text(aes(size = wt))
-
-# Scale height of text, rather than sqrt(height)
-p + geom_text(aes(size = wt)) + scale_radius(range = c(3,6))
-
-
-# You can display expressions by setting parse = TRUE.  The
-# details of the display are described in ?plotmath, but note that
-# geom_text uses strings, not expressions.
-p + geom_text(aes(label = paste(wt, "^(", cyl, ")", sep = "")),
-  parse = TRUE)
-
-
-# Add a text annotation
-p +
-  geom_text() +
-  annotate("text", label = "plot mpg vs. wt", x = 2, y = 15, size = 8, colour = "red")
-
-
-# \donttest{
-# Aligning labels and bars --------------------------------------------------
-df <- data.frame(
-  x = factor(c(1, 1, 2, 2)),
-  y = c(1, 3, 2, 1),
-  grp = c("a", "b", "a", "b")
-)
-
-# ggplot2 doesn't know you want to give the labels the same virtual width
-# as the bars:
-ggplot(data = df, aes(x, y, fill = grp, label = y)) +
-  geom_bar(stat = "identity", position = "dodge") +
-  geom_text(position = "dodge")
-#> Warning: Width not defined. Set with `position_dodge(width = ?)`
-
-# So tell it:
-ggplot(data = df, aes(x, y, fill = grp, label = y)) +
-  geom_bar(stat = "identity", position = "dodge") +
-  geom_text(position = position_dodge(0.9))
-
-# Use you can't nudge and dodge text, so instead adjust the y postion
-ggplot(data = df, aes(x, y, fill = grp, label = y)) +
-  geom_bar(stat = "identity", position = "dodge") +
-  geom_text(aes(y = y + 0.05), position = position_dodge(0.9), vjust = 0)
-
-
-# To place text in the middle of each bar in a stacked barplot, you
-# need to do the computation yourself
-df <- transform(df, mid_y = ave(df$y, df$x, FUN = function(val) cumsum(val) - (0.5 * val)))
-
-ggplot(data = df, aes(x, y, fill = grp, label = y)) +
- geom_bar(stat = "identity") +
- geom_text(aes(y = mid_y))
-
-
-# Justification -------------------------------------------------------------
-df <- data.frame(
-  x = c(1, 1, 2, 2, 1.5),
-  y = c(1, 2, 1, 2, 1.5),
-  text = c("bottom-left", "bottom-right", "top-left", "top-right", "center")
-)
-ggplot(df, aes(x, y)) +
-  geom_text(aes(label = text))
-
-ggplot(df, aes(x, y)) +
-  geom_text(aes(label = text), vjust = "inward", hjust = "inward")
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_tile-1.png b/docs/reference/geom_tile-1.png deleted file mode 100644 index 4c5372a84..000000000 Binary files a/docs/reference/geom_tile-1.png and /dev/null differ diff --git a/docs/reference/geom_tile-10.png b/docs/reference/geom_tile-10.png deleted file mode 100644 index de84b092e..000000000 Binary files a/docs/reference/geom_tile-10.png and /dev/null differ diff --git a/docs/reference/geom_tile-11.png b/docs/reference/geom_tile-11.png deleted file mode 100644 index 94ddda8ae..000000000 Binary files a/docs/reference/geom_tile-11.png and /dev/null differ diff --git a/docs/reference/geom_tile-12.png b/docs/reference/geom_tile-12.png deleted file mode 100644 index b994be1b9..000000000 Binary files a/docs/reference/geom_tile-12.png and /dev/null differ diff --git a/docs/reference/geom_tile-2.png b/docs/reference/geom_tile-2.png deleted file mode 100644 index e9db6d725..000000000 Binary files a/docs/reference/geom_tile-2.png and /dev/null differ diff --git a/docs/reference/geom_tile-3.png b/docs/reference/geom_tile-3.png deleted file mode 100644 index b43e1c51a..000000000 Binary files a/docs/reference/geom_tile-3.png and /dev/null differ diff --git a/docs/reference/geom_tile-4.png b/docs/reference/geom_tile-4.png deleted file mode 100644 index f23c03ac5..000000000 Binary files a/docs/reference/geom_tile-4.png and /dev/null differ diff --git a/docs/reference/geom_tile-5.png b/docs/reference/geom_tile-5.png deleted file mode 100644 index 881e69345..000000000 Binary files a/docs/reference/geom_tile-5.png and /dev/null differ diff --git a/docs/reference/geom_tile-6.png b/docs/reference/geom_tile-6.png deleted file mode 100644 index e66381bc2..000000000 Binary files a/docs/reference/geom_tile-6.png and /dev/null differ diff --git a/docs/reference/geom_tile-7.png b/docs/reference/geom_tile-7.png deleted file mode 100644 index 733d4eac4..000000000 Binary files a/docs/reference/geom_tile-7.png and /dev/null differ diff --git a/docs/reference/geom_tile-8.png b/docs/reference/geom_tile-8.png deleted file mode 100644 index ef4e015c6..000000000 Binary files a/docs/reference/geom_tile-8.png and /dev/null differ diff --git a/docs/reference/geom_tile-9.png b/docs/reference/geom_tile-9.png deleted file mode 100644 index 6e33decca..000000000 Binary files a/docs/reference/geom_tile-9.png and /dev/null differ diff --git a/docs/reference/geom_tile.html b/docs/reference/geom_tile.html deleted file mode 100644 index 83d5354d9..000000000 --- a/docs/reference/geom_tile.html +++ /dev/null @@ -1,267 +0,0 @@ - -Draw rectangles. — geom_raster • animint2 - Skip to contents - - -
-
-
- -
-

geom_rect and geom_tile do the same thing, but are -parameterised differently. geom_rect uses the locations of the four -corners (xmin, xmax, ymin and ymax). -geom_tile uses the center of the tile and its size (x, -y, width, height). geom_raster is a high -performance special case for when all the tiles are the same size.

-
- -
-

Usage

-
geom_raster(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  hjust = 0.5,
-  vjust = 0.5,
-  interpolate = FALSE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_rect(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_tile(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
hjust, vjust
-

horizontal and vertical justification of the grob. Each -justification value should be a number between 0 and 1. Defaults to 0.5 -for both, centering each pixel over its data location.

- - -
interpolate
-

If TRUE interpolate linearly, if FALSE -(the default) don't interpolate.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

geom_tile understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
- -
-

Examples

-
# The most common use for rectangles is to draw a surface. You always want
-# to use geom_raster here because it's so much faster, and produces
-# smaller output when saving to PDF
-ggplot(faithfuld, aes(waiting, eruptions)) +
- geom_raster(aes(fill = density))
-
-
-# Interpolation smooths the surface & is most helpful when rendering images.
-ggplot(faithfuld, aes(waiting, eruptions)) +
- geom_raster(aes(fill = density), interpolate = TRUE)
-
-
-# If you want to draw arbitrary rectangles, use geom_tile() or geom_rect()
-df <- data.frame(
-  x = rep(c(2, 5, 7, 9, 12), 2),
-  y = rep(c(1, 2), each = 5),
-  z = factor(rep(1:5, each = 2)),
-  w = rep(diff(c(0, 4, 6, 8, 10, 14)), 2)
-)
-ggplot(df, aes(x, y)) +
-  geom_tile(aes(fill = z))
-
-ggplot(df, aes(x, y)) +
-  geom_tile(aes(fill = z, width = w), colour = "grey50")
-
-ggplot(df, aes(xmin = x - w / 2, xmax = x + w / 2, ymin = y, ymax = y + 1)) +
-  geom_rect(aes(fill = z, width = w), colour = "grey50")
-
-
-# \donttest{
-# Justification controls where the cells are anchored
-df <- expand.grid(x = 0:5, y = 0:5)
-df$z <- runif(nrow(df))
-# default is compatible with geom_tile()
-ggplot(df, aes(x, y, fill = z)) + geom_raster()
-
-# zero padding
-ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0)
-
-
-# Inspired by the image-density plots of Ken Knoblauch
-cars <- ggplot(mtcars, aes(mpg, factor(cyl)))
-cars + geom_point()
-
-cars + stat_bin2d(aes(fill = ..count..), binwidth = c(3,1))
-
-cars + stat_bin2d(aes(fill = ..density..), binwidth = c(3,1))
-
-
-cars + stat_density(aes(fill = ..density..), geom = "raster", position = "identity")
-
-cars + stat_density(aes(fill = ..count..), geom = "raster", position = "identity")
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_violin-1.png b/docs/reference/geom_violin-1.png deleted file mode 100644 index 3288d3faa..000000000 Binary files a/docs/reference/geom_violin-1.png and /dev/null differ diff --git a/docs/reference/geom_violin-10.png b/docs/reference/geom_violin-10.png deleted file mode 100644 index f8eca4de9..000000000 Binary files a/docs/reference/geom_violin-10.png and /dev/null differ diff --git a/docs/reference/geom_violin-11.png b/docs/reference/geom_violin-11.png deleted file mode 100644 index 4ae51267d..000000000 Binary files a/docs/reference/geom_violin-11.png and /dev/null differ diff --git a/docs/reference/geom_violin-12.png b/docs/reference/geom_violin-12.png deleted file mode 100644 index c31e833f2..000000000 Binary files a/docs/reference/geom_violin-12.png and /dev/null differ diff --git a/docs/reference/geom_violin-13.png b/docs/reference/geom_violin-13.png deleted file mode 100644 index 9f2bcb022..000000000 Binary files a/docs/reference/geom_violin-13.png and /dev/null differ diff --git a/docs/reference/geom_violin-14.png b/docs/reference/geom_violin-14.png deleted file mode 100644 index 74782d931..000000000 Binary files a/docs/reference/geom_violin-14.png and /dev/null differ diff --git a/docs/reference/geom_violin-2.png b/docs/reference/geom_violin-2.png deleted file mode 100644 index 6b2703d25..000000000 Binary files a/docs/reference/geom_violin-2.png and /dev/null differ diff --git a/docs/reference/geom_violin-3.png b/docs/reference/geom_violin-3.png deleted file mode 100644 index bdee73b3c..000000000 Binary files a/docs/reference/geom_violin-3.png and /dev/null differ diff --git a/docs/reference/geom_violin-4.png b/docs/reference/geom_violin-4.png deleted file mode 100644 index 734d5e6da..000000000 Binary files a/docs/reference/geom_violin-4.png and /dev/null differ diff --git a/docs/reference/geom_violin-5.png b/docs/reference/geom_violin-5.png deleted file mode 100644 index deb174d0d..000000000 Binary files a/docs/reference/geom_violin-5.png and /dev/null differ diff --git a/docs/reference/geom_violin-6.png b/docs/reference/geom_violin-6.png deleted file mode 100644 index d1140fe1e..000000000 Binary files a/docs/reference/geom_violin-6.png and /dev/null differ diff --git a/docs/reference/geom_violin-7.png b/docs/reference/geom_violin-7.png deleted file mode 100644 index aebecde41..000000000 Binary files a/docs/reference/geom_violin-7.png and /dev/null differ diff --git a/docs/reference/geom_violin-8.png b/docs/reference/geom_violin-8.png deleted file mode 100644 index 1989baa37..000000000 Binary files a/docs/reference/geom_violin-8.png and /dev/null differ diff --git a/docs/reference/geom_violin-9.png b/docs/reference/geom_violin-9.png deleted file mode 100644 index d8cda2844..000000000 Binary files a/docs/reference/geom_violin-9.png and /dev/null differ diff --git a/docs/reference/geom_violin.html b/docs/reference/geom_violin.html deleted file mode 100644 index adf6de47a..000000000 --- a/docs/reference/geom_violin.html +++ /dev/null @@ -1,314 +0,0 @@ - -Violin plot. — geom_violin • animint2 - Skip to contents - - -
-
-
- -
-

Violin plot.

-
- -
-

Usage

-
geom_violin(
-  mapping = NULL,
-  data = NULL,
-  stat = "ydensity",
-  position = "dodge",
-  ...,
-  draw_quantiles = NULL,
-  trim = TRUE,
-  scale = "area",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_ydensity(
-  mapping = NULL,
-  data = NULL,
-  geom = "violin",
-  position = "dodge",
-  ...,
-  bw = "nrd0",
-  adjust = 1,
-  kernel = "gaussian",
-  trim = TRUE,
-  scale = "area",
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
draw_quantiles
-

If not(NULL) (default), draw horizontal lines -at the given quantiles of the density estimate.

- - -
trim
-

If TRUE (default), trim the tails of the violins -to the range of the data. If FALSE, don't trim the tails.

- - -
scale
-

if "area" (default), all violins have the same area (before trimming -the tails). If "count", areas are scaled proportionally to the number of -observations. If "width", all violins have the same maximum width.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
geom, stat
-

Use to override the default connection between -geom_violin and stat_ydensity.

- - -
bw
-

the smoothing bandwidth to be used, see -density for details

- - -
adjust
-

adjustment of the bandwidth, see -density for details

- - -
kernel
-

kernel used for density estimation, see -density for details

- -
-
-

Aesthetics

- - -

geom_violin understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
  • alpha

  • -
  • colour

  • -
  • fill

  • -
  • linetype

  • -
  • size

  • -
  • weight

  • -
-
-

Computed variables

- - -
density
-

density estimate

- -
scaled
-

density estimate, scaled to maximum of 1

- -
count
-

density * number of points - probably useless for violin plots

- -
violinwidth
-

density scaled for the violin plot, according to area, counts - or to a constant maximum width

- -
n
-

number of points

- -
width
-

width of violin bounding box

- - -
-
-

References

-

Hintze, J. L., Nelson, R. D. (1998) Violin Plots: A Box -Plot-Density Trace Synergism. The American Statistician 52, 181-184.

-
-
-

See also

-

geom_violin for examples, and stat_density - for examples with data along the x axis.

-
- -
-

Examples

-
p <- ggplot(mtcars, aes(factor(cyl), mpg))
-p + geom_violin()
-
-
-# \donttest{
-p + geom_violin() + geom_jitter(height = 0)
-
-p + geom_violin() + coord_flip()
-
-
-# Scale maximum width proportional to sample size:
-p + geom_violin(scale = "count")
-
-
-# Scale maximum width to 1 for all violins:
-p + geom_violin(scale = "width")
-
-
-# Default is to trim violins to the range of the data. To disable:
-p + geom_violin(trim = FALSE)
-
-
-# Use a smaller bandwidth for closer density fit (default is 1).
-p + geom_violin(adjust = .5)
-
-
-# Add aesthetic mappings
-# Note that violins are automatically dodged when any aesthetic is
-# a factor
-p + geom_violin(aes(fill = cyl))
-
-p + geom_violin(aes(fill = factor(cyl)))
-
-p + geom_violin(aes(fill = factor(vs)))
-
-p + geom_violin(aes(fill = factor(am)))
-
-
-# Set aesthetics to fixed value
-p + geom_violin(fill = "grey80", colour = "#3366FF")
-
-
-# Show quartiles
-p + geom_violin(draw_quantiles = c(0.25, 0.5, 0.75))
-
-
-# Scales vs. coordinate transforms -------
-if (require("ggplot2movies")) {
-# Scale transformations occur before the density statistics are computed.
-# Coordinate transformations occur afterwards.  Observe the effect on the
-# number of outliers.
-m <- ggplot(movies, aes(y = votes, x = rating, group = cut_width(rating, 0.5)))
-m + geom_violin()
-m + geom_violin() + scale_y_log10()
-m + geom_violin() + coord_trans(y = "log10")
-m + geom_violin() + scale_y_log10() + coord_trans(y = "log10")
-
-# Violin plots with continuous x:
-# Use the group aesthetic to group observations in violins
-ggplot(movies, aes(year, budget)) + geom_violin()
-ggplot(movies, aes(year, budget)) +
-  geom_violin(aes(group = cut_width(year, 10)), scale = "width")
-}
-#> Warning: Removed 53573 rows containing non-finite values (stat_ydensity).
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/geom_widerect.html b/docs/reference/geom_widerect.html deleted file mode 100644 index e92852896..000000000 --- a/docs/reference/geom_widerect.html +++ /dev/null @@ -1,136 +0,0 @@ - -ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect • animint2 - Skip to contents - - -
-
-
- -
-

ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements.

-
- -
-

Usage

-
geom_widerect(
-  mapping = NULL,
-  data = NULL,
-  stat = "identity",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

aesthetic mapping

- - -
data
-

data set

- - -
stat
-

statistic mapping, defaults to identity

- - -
position
-

position mapping, defaults to identity

- - -
...
-

other arguments

- - -
na.rm
-

remove missing values?

- - -
show.legend
-

TRUE OR FALSE

- - -
inherit.aes
-

TRUE OR FALSE

- -
-
-

Value

- - -

ggplot2 layer

-
- -
-

Examples

-
 if (FALSE) { 
-   source(system.file("examples/WorldBank.R", package = "animint"))
- }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getCommonChunk.html b/docs/reference/getCommonChunk.html deleted file mode 100644 index 683a7181b..000000000 --- a/docs/reference/getCommonChunk.html +++ /dev/null @@ -1,105 +0,0 @@ - -Save the common columns for each tsv to one chunk — getCommonChunk • animint2 - Skip to contents - - -
-
-
- -
-

Save the common columns for each tsv to one chunk

-
- -
-

Usage

-
getCommonChunk(built, chunk.vars, aes.list)
-
- -
-

Arguments

-
built
-

data.frame of built data.

- - -
chunk.vars
-

which variables to chunk on.

- - -
aes.list
-

a character vector of aesthetics.

- - -
vars
-

character vector of chunk variable names to split on.

- -
-
-

Value

- - -

a list of common and varied data to save, or NULL if there is -no common data.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getLayerName.html b/docs/reference/getLayerName.html deleted file mode 100644 index 45330abec..000000000 --- a/docs/reference/getLayerName.html +++ /dev/null @@ -1,100 +0,0 @@ - -Gives a unique name to each layer in saveLayer — getLayerName • animint2 - Skip to contents - - -
-
-
- -
-

Gives a unique name to each layer in saveLayer

-
- -
-

Usage

-
getLayerName(L, geom_num, p.name)
-
- -
-

Arguments

-
L
-

layer in saveLayer to be named

- - -
geom_num
-

the number of the layer to be saved

- - -
p.name
-

the name of the plot to which the layer belongs

- -
-
-

Value

- - -

a unique name for the layer

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getLayerParams.html b/docs/reference/getLayerParams.html deleted file mode 100644 index 6f3f08f03..000000000 --- a/docs/reference/getLayerParams.html +++ /dev/null @@ -1,92 +0,0 @@ - -Get all parameters for a layer — getLayerParams • animint2 - Skip to contents - - -
-
-
- -
-

Get all parameters for a layer

-
- -
-

Usage

-
getLayerParams(l)
-
- -
-

Arguments

-
l
-

A single layer of the plot

- -
-
-

Value

- - -

All parameters in the layer

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getLegend.html b/docs/reference/getLegend.html deleted file mode 100644 index 0ff9461a1..000000000 --- a/docs/reference/getLegend.html +++ /dev/null @@ -1,92 +0,0 @@ - -Function to get legend information for each scale — getLegend • animint2 - Skip to contents - - -
-
-
- -
-

Function to get legend information for each scale

-
- -
-

Usage

-
getLegend(mb)
-
- -
-

Arguments

-
mb
-

single entry from guides_merge() list of legend data

- -
-
-

Value

- - -

list of legend information, NULL if guide=FALSE.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getLegendList.html b/docs/reference/getLegendList.html deleted file mode 100644 index 269d28556..000000000 --- a/docs/reference/getLegendList.html +++ /dev/null @@ -1,92 +0,0 @@ - -Function to get legend information from ggplot — getLegendList • animint2 - Skip to contents - - -
-
-
- -
-

Function to get legend information from ggplot

-
- -
-

Usage

-
getLegendList(plistextra)
-
- -
-

Arguments

-
plistextra
-

output from ggplot_build(p)

- -
-
-

Value

- - -

list containing information for each legend

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getTextSize.html b/docs/reference/getTextSize.html deleted file mode 100644 index c03f9ee29..000000000 --- a/docs/reference/getTextSize.html +++ /dev/null @@ -1,96 +0,0 @@ - -Function to process text size with different types of unit — getTextSize • animint2 - Skip to contents - - -
-
-
- -
-

Function to process text size with different types of unit

-
- -
-

Usage

-
getTextSize(element.name, theme)
-
- -
-

Arguments

-
element.name
-

The name of the theme element

- - -
theme
-

combined theme from plot_theme()

- -
-
-

Value

- - -

character of text size, with unit pt/px

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/getUniqueAxisLabels.html b/docs/reference/getUniqueAxisLabels.html deleted file mode 100644 index b1772f24f..000000000 --- a/docs/reference/getUniqueAxisLabels.html +++ /dev/null @@ -1,92 +0,0 @@ - -Get unique axis labels for the plot — getUniqueAxisLabels • animint2 - Skip to contents - - -
-
-
- -
-

Get unique axis labels for the plot

-
- -
-

Usage

-
getUniqueAxisLabels(plot.meta)
-
- -
-

Arguments

-
plot.meta
-

contains axis labels

- -
-
-

Value

- - -

modified plot.meta with unique axis labels

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/gg-add-1.png b/docs/reference/gg-add-1.png deleted file mode 100644 index ae88ca539..000000000 Binary files a/docs/reference/gg-add-1.png and /dev/null differ diff --git a/docs/reference/gg-add-2.png b/docs/reference/gg-add-2.png deleted file mode 100644 index 4f5184e9b..000000000 Binary files a/docs/reference/gg-add-2.png and /dev/null differ diff --git a/docs/reference/gg-add-3.png b/docs/reference/gg-add-3.png deleted file mode 100644 index eef81891c..000000000 Binary files a/docs/reference/gg-add-3.png and /dev/null differ diff --git a/docs/reference/gg-add-4.png b/docs/reference/gg-add-4.png deleted file mode 100644 index 49f97c956..000000000 Binary files a/docs/reference/gg-add-4.png and /dev/null differ diff --git a/docs/reference/gg-add-5.png b/docs/reference/gg-add-5.png deleted file mode 100644 index 0be1a02e6..000000000 Binary files a/docs/reference/gg-add-5.png and /dev/null differ diff --git a/docs/reference/gg-add.html b/docs/reference/gg-add.html deleted file mode 100644 index be046d3bd..000000000 --- a/docs/reference/gg-add.html +++ /dev/null @@ -1,180 +0,0 @@ - -Add a new component to a ggplot or theme object. — +.gganimint • animint2 - Skip to contents - - -
-
-
- -
-

This operator allows you to add objects to a ggplot or theme object.

-
- -
-

Usage

-
# S3 method for gganimint
-+(e1, e2)
-
-e1 %+% e2
-
-e1 %+replace% e2
-
- -
-

Arguments

-
e1
-

An object of class ggplot or theme

- - -
e2
-

A component to add to e1

- -
-
-

Details

-

If the first object is an object of class ggplot, you can add -the following types of objects, and it will return a modified ggplot -object.

-
  • data.frame: replace current data.frame - (must use %+%)

  • -
  • uneval: replace current aesthetics

  • -
  • layer: add new layer

  • -
  • theme: update plot theme

  • -
  • scale: replace current scale

  • -
  • coord: override current coordinate system

  • -
  • facet: override current coordinate faceting

  • -

If the first object is an object of class theme, you can add -another theme object. This will return a modified theme object.

-

For theme objects, the + operator and the %+replace% -can be used to modify elements in themes.

-

The + operator updates the elements of e1 that differ from -elements specified (not NULL) in e2. -Thus this operator can be used to incrementally add or modify attributes -of a ggplot theme.

-

In contrast, the %+replace% operator replaces the -entire element; any element of a theme not specified in e2 will not be -present in the resulting theme (i.e. NULL). -Thus this operator can be used to overwrite an entire theme.

-
-
-

See also

- -
- -
-

Examples

-
### Adding objects to a ggplot object
-p <- ggplot(mtcars, aes(wt, mpg, colour = disp)) +
-  geom_point()
-
-p
-
-p + coord_cartesian(ylim = c(0, 40))
-
-p + scale_colour_continuous(breaks = c(100, 300))
-
-p + guides(colour = "colourbar")
-
-
-# Use a different data frame
-m <- mtcars[1:10, ]
-p %+% m
-
-
-### Adding objects to a theme object
-# Compare these results of adding theme objects to other theme objects
-add_el <- theme_grey() + theme(text = element_text(family = "Times"))
-rep_el <- theme_grey() %+replace% theme(text = element_text(family = "Times"))
-
-add_el$text
-#> List of 10
-#>  $ family    : chr "Times"
-#>  $ face      : chr "plain"
-#>  $ colour    : chr "black"
-#>  $ size      : num 11
-#>  $ hjust     : num 0.5
-#>  $ vjust     : num 0.5
-#>  $ angle     : num 0
-#>  $ lineheight: num 0.9
-#>  $ margin    : 'margin' num [1:4] 0points 0points 0points 0points
-#>   ..- attr(*, "unit")= int 8
-#>  $ debug     : logi FALSE
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-rep_el$text
-#> List of 10
-#>  $ family    : chr "Times"
-#>  $ face      : NULL
-#>  $ colour    : NULL
-#>  $ size      : NULL
-#>  $ hjust     : NULL
-#>  $ vjust     : NULL
-#>  $ angle     : NULL
-#>  $ lineheight: NULL
-#>  $ margin    : NULL
-#>  $ debug     : NULL
-#>  - attr(*, "class")= chr [1:2] "element_text" "element"
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/gg_dep.html b/docs/reference/gg_dep.html deleted file mode 100644 index df3e8b442..000000000 --- a/docs/reference/gg_dep.html +++ /dev/null @@ -1,113 +0,0 @@ - -Give a deprecation error, warning, or message, depending on version number. — gg_dep • animint2 - Skip to contents - - -
-
-
- -
-

Version numbers have the format <major>.<minor>.<subminor>, like 0.9.2. -This function compares the current version number of ggplot2 against the -specified version, which is the most recent version before the -function (or other object) was deprecated.

-
- -
-

Usage

-
gg_dep(version, msg)
-
- -
-

Arguments

-
version
-

The last version of ggplot2 where this function was good -(in other words, the last version where it was not deprecated).

- - -
msg
-

The message to print.

- -
-
-

Details

-

gg_dep will give an error, warning, or message, depending on the -difference between the current ggplot2 version and the specified -version.

-

If the current major number is greater than version's major number, -or if the current minor number is more than 1 greater than version's -minor number, give an error.

-

If the current minor number differs from version's minor number by -one, give a warning.

-

If the current subminor number differs from version's subminor -number, print a message.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/gganimintproto.html b/docs/reference/gganimintproto.html deleted file mode 100644 index 509babacc..000000000 --- a/docs/reference/gganimintproto.html +++ /dev/null @@ -1,131 +0,0 @@ - -Create a new gganimintproto object — gganimintproto • animint2 - Skip to contents - - -
-
-
- -
-

gganimintproto is inspired by the proto package, but it has some important -differences. Notably, it cleanly supports cross-package inheritance, and has -faster performance.

-
- -
-

Usage

-
gganimintproto(`_class` = NULL, `_inherit` = NULL, ...)
-
-gganimintproto_parent(parent, self)
-
- -
-

Arguments

-
_class
-

Class name to assign to the object. This is stored as the class -attribute of the object. If NULL (the default), no class name will -be added to the object.

- - -
_inherit
-

gganimintproto object to inherit from. If NULL, don't inherit -from any object.

- - -
...
-

A list of members in the gganimintproto object.

- - -
parent, self
-

Access parent class parent of object self.

- -
-
-

Calling gganimintproto methods

- - - -

gganimintproto methods can take an optional self argument: if it is present, -it is a regular method; if it's absent, it's a "static" method (i.e. it -doesn't use any fields).

-

Imagine you have a gganimintproto object Adder, which has a -method addx = function(self, n) n + self$x. Then, to call this -function, you would use Adder$addx(10) -- the self is passed -in automatically by the wrapper function. self be located anywhere -in the function signature, although customarily it comes first.

-
-
-

Calling methods in a parent

- - - -

To explicitly call a methods in a parent, use -gganimintproto_parent(Parent, self).

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ggplot-1.png b/docs/reference/ggplot-1.png deleted file mode 100644 index e0b7fc54e..000000000 Binary files a/docs/reference/ggplot-1.png and /dev/null differ diff --git a/docs/reference/ggplot-2.png b/docs/reference/ggplot-2.png deleted file mode 100644 index e0b7fc54e..000000000 Binary files a/docs/reference/ggplot-2.png and /dev/null differ diff --git a/docs/reference/ggplot-3.png b/docs/reference/ggplot-3.png deleted file mode 100644 index e561c87f5..000000000 Binary files a/docs/reference/ggplot-3.png and /dev/null differ diff --git a/docs/reference/ggplot.html b/docs/reference/ggplot.html deleted file mode 100644 index 145e07341..000000000 --- a/docs/reference/ggplot.html +++ /dev/null @@ -1,172 +0,0 @@ - -Create a new ggplot plot. — ggplot • animint2 - Skip to contents - - -
-
-
- -
-

ggplot() initializes a ggplot object. It can be used to -declare the input data frame for a graphic and to specify the -set of plot aesthetics intended to be common throughout all -subsequent layers unless specifically overridden.

-
- -
-

Usage

-
ggplot(data = NULL, mapping = aes(), ..., environment = parent.frame())
-
- -
-

Arguments

-
data
-

Default dataset to use for plot. If not already a data.frame, -will be converted to one by fortify. If not specified, -must be suppled in each layer added to the plot.

- - -
mapping
-

Default list of aesthetic mappings to use for plot. -If not specified, must be suppled in each layer added to the plot.

- - -
...
-

Other arguments passed on to methods. Not currently used.

- - -
environment
-

If an variable defined in the aesthetic mapping is not -found in the data, ggplot will look for it in this environment. It defaults -to using the environment in which ggplot() is called.

- -
-
-

Details

-

ggplot() is typically used to construct a plot -incrementally, using the + operator to add layers to the -existing ggplot object. This is advantageous in that the -code is explicit about which layers are added and the order -in which they are added. For complex graphics with multiple -layers, initialization with ggplot is recommended.

-

There are three common ways to invoke ggplot:

  • ggplot(df, aes(x, y, <other aesthetics>))

  • -
  • ggplot(df)

  • -
  • ggplot()

  • -

The first method is recommended if all layers use the same -data and the same set of aesthetics, although this method -can also be used to add a layer using data from another -data frame. See the first example below. The second -method specifies the default data frame to use for the plot, -but no aesthetics are defined up front. This is useful when -one data frame is used predominantly as layers are added, -but the aesthetics may vary from one layer to another. The -third method initializes a skeleton ggplot object which -is fleshed out as layers are added. This method is useful when -multiple data frames are used to produce different layers, as -is often the case in complex graphics.

-
- -
-

Examples

-
df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),
-                 y = rnorm(30))
-# Compute sample mean and standard deviation in each group
-ds <- plyr::ddply(df, "gp", plyr::summarise, mean = mean(y), sd = sd(y))
-
-# Declare the data frame and common aesthetics.
-# The summary data frame ds is used to plot
-# larger red points in a second geom_point() layer.
-# If the data = argument is not specified, it uses the
-# declared data frame from ggplot(); ditto for the aesthetics.
-ggplot(df, aes(x = gp, y = y)) +
-   geom_point() +
-   geom_point(data = ds, aes(y = mean),
-              colour = 'red', size = 3)
-
-# Same plot as above, declaring only the data frame in ggplot().
-# Note how the x and y aesthetics must now be declared in
-# each geom_point() layer.
-ggplot(df) +
-   geom_point(aes(x = gp, y = y)) +
-   geom_point(data = ds, aes(x = gp, y = mean),
-                 colour = 'red', size = 3)
-
-# Set up a skeleton ggplot object and add layers:
-ggplot() +
-  geom_point(data = df, aes(x = gp, y = y)) +
-  geom_point(data = ds, aes(x = gp, y = mean),
-                        colour = 'red', size = 3) +
-  geom_errorbar(data = ds, aes(x = gp, y = mean,
-                    ymin = mean - sd, ymax = mean + sd),
-                    colour = 'red', width = 0.4)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ggplotGrob.html b/docs/reference/ggplotGrob.html deleted file mode 100644 index 676302fd9..000000000 --- a/docs/reference/ggplotGrob.html +++ /dev/null @@ -1,86 +0,0 @@ - -Generate a ggplot2 plot grob. — ggplotGrob • animint2 - Skip to contents - - -
-
-
- -
-

Generate a ggplot2 plot grob.

-
- -
-

Usage

-
ggplotGrob(x)
-
- -
-

Arguments

-
x
-

ggplot2 object

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ggplot_build.html b/docs/reference/ggplot_build.html deleted file mode 100644 index 792f8b7e7..000000000 --- a/docs/reference/ggplot_build.html +++ /dev/null @@ -1,113 +0,0 @@ - -Build ggplot for rendering. — ggplot_build • animint2 - Skip to contents - - -
-
-
- -
-

ggplot_build takes the plot object, and performs all steps necessary -to produce an object that can be rendered. This function outputs two pieces: -a list of data frames (one for each layer), and a panel object, which -contain all information about axis limits, breaks etc.

-
- -
-

Usage

-
ggplot_build(plot)
-
-layer_data(plot, i = 1L)
-
-layer_scales(plot, i = 1L, j = 1L)
-
-layer_grob(plot, i = 1L)
-
- -
-

Arguments

-
plot
-

ggplot object

- -
-
-

Details

-

layer_data, layer_grob, and layer_scales are helper -functions that returns the data, grob, or scales associated with a given -layer. These are useful for tests.

-
-
-

See also

-

print.gganimintplot and benchplot for - functions that contain the complete set of steps for generating - a ggplot2 plot.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ggplot_gtable.html b/docs/reference/ggplot_gtable.html deleted file mode 100644 index 82b5da970..000000000 --- a/docs/reference/ggplot_gtable.html +++ /dev/null @@ -1,114 +0,0 @@ - -Build a plot with all the usual bits and pieces. — ggplot_gtable • animint2 - Skip to contents - - -
-
-
- -
-

This function builds all grobs necessary for displaying the plot, and -stores them in a special data structure called a gtable. -This object is amenable to programmatic manipulation, should you want -to (e.g.) make the legend box 2 cm wide, or combine multiple plots into -a single display, preserving aspect ratios across the plots.

-
- -
-

Usage

-
ggplot_gtable(data)
-
- -
-

Arguments

-
data
-

plot data generated by ggplot_build

- - -
plot
-

plot object

- -
-
-

Value

- - -

a gtable object

-
-
-

See also

-

print.gganimintplot and link{benchplot} for - for functions that contain the complete set of steps for generating - a ggplot2 plot.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ggsave.html b/docs/reference/ggsave.html deleted file mode 100644 index 0730fe890..000000000 --- a/docs/reference/ggsave.html +++ /dev/null @@ -1,172 +0,0 @@ - -Save a ggplot (or other grid object) with sensible defaults — ggsave • animint2 - Skip to contents - - -
-
-
- -
-

ggsave() is a convenient function for saving a plot. It defaults to -saving the last plot that you displayed, using the size of the current -graphics device. It also guesses the type of graphics device from the -extension.

-
- -
-

Usage

-
ggsave(
-  filename,
-  plot = last_plot(),
-  device = NULL,
-  path = NULL,
-  scale = 1,
-  width = NA,
-  height = NA,
-  units = c("in", "cm", "mm"),
-  dpi = 300,
-  limitsize = TRUE,
-  ...
-)
-
- -
-

Arguments

-
filename
-

File name to create on disk.

- - -
plot
-

Plot to save, defaults to last plot displayed.

- - -
device
-

Device to use (function or any of the recognized extensions, -e.g. "pdf"). By default, extracted from filename extension. -ggsave currently recognises eps/ps, tex (pictex), pdf, jpeg, tiff, -png, bmp, svg and wmf (windows only).

- - -
path
-

Path to save plot to (combined with filename).

- - -
scale
-

Multiplicative scaling factor.

- - -
width, height
-

Plot dimensions, defaults to size of current graphics -device.

- - -
units
-

Units for width and height when specified explicitly (in, cm, -or mm)

- - -
dpi
-

Resolution used for raster outputs.

- - -
limitsize
-

When TRUE (the default), ggsave will not -save images larger than 50x50 inches, to prevent the common error of -specifying dimensions in pixels.

- - -
...
-

Other arguments passed on to graphics device

- -
- -
-

Examples

-
if (FALSE) {
-ggplot(mtcars, aes(mpg, wt)) + geom_point()
-
-ggsave(file.path(tempdir(), "mtcars.pdf"))
-ggsave(file.path(tempdir(), "mtcars.png"))
-
-ggsave(file.path(tempdir(), "mtcars.pdf"), width = 4, height = 4)
-ggsave(file.path(tempdir(), "mtcars.pdf"), width = 20, height = 20, units = "cm")
-
-unlink(file.path(tempdir(), "mtcars.pdf"))
-unlink(file.path(tempdir(), "mtcars.png"))
-
-# specify device when saving to a file with unknown extension
-# (for example a server supplied temporary file)
-file <- tempfile()
-ggsave(file, device = "pdf")
-unlink(file)
-}
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/ggtheme-1.png b/docs/reference/ggtheme-1.png deleted file mode 100644 index d4802c637..000000000 Binary files a/docs/reference/ggtheme-1.png and /dev/null differ diff --git a/docs/reference/ggtheme-2.png b/docs/reference/ggtheme-2.png deleted file mode 100644 index d4802c637..000000000 Binary files a/docs/reference/ggtheme-2.png and /dev/null differ diff --git a/docs/reference/ggtheme-3.png b/docs/reference/ggtheme-3.png deleted file mode 100644 index b47aca23d..000000000 Binary files a/docs/reference/ggtheme-3.png and /dev/null differ diff --git a/docs/reference/ggtheme-4.png b/docs/reference/ggtheme-4.png deleted file mode 100644 index 6e04b2be7..000000000 Binary files a/docs/reference/ggtheme-4.png and /dev/null differ diff --git a/docs/reference/ggtheme-5.png b/docs/reference/ggtheme-5.png deleted file mode 100644 index 5df568ebf..000000000 Binary files a/docs/reference/ggtheme-5.png and /dev/null differ diff --git a/docs/reference/ggtheme-6.png b/docs/reference/ggtheme-6.png deleted file mode 100644 index 212b9cb18..000000000 Binary files a/docs/reference/ggtheme-6.png and /dev/null differ diff --git a/docs/reference/ggtheme-7.png b/docs/reference/ggtheme-7.png deleted file mode 100644 index 3dd0ea5e1..000000000 Binary files a/docs/reference/ggtheme-7.png and /dev/null differ diff --git a/docs/reference/ggtheme-8.png b/docs/reference/ggtheme-8.png deleted file mode 100644 index 95b703478..000000000 Binary files a/docs/reference/ggtheme-8.png and /dev/null differ diff --git a/docs/reference/ggtheme-9.png b/docs/reference/ggtheme-9.png deleted file mode 100644 index 467eb3fe7..000000000 Binary files a/docs/reference/ggtheme-9.png and /dev/null differ diff --git a/docs/reference/ggtheme.html b/docs/reference/ggtheme.html deleted file mode 100644 index a05743570..000000000 --- a/docs/reference/ggtheme.html +++ /dev/null @@ -1,178 +0,0 @@ - -ggplot2 themes — ggtheme • animint2 - Skip to contents - - -
-
-
- -
-

Themes set the general aspect of the plot such as the colour of the -background, gridlines, the size and colour of fonts.

-
- -
-

Usage

-
theme_grey(base_size = 11, base_family = "")
-
-theme_gray(base_size = 11, base_family = "")
-
-theme_bw(base_size = 12, base_family = "")
-
-theme_linedraw(base_size = 12, base_family = "")
-
-theme_light(base_size = 12, base_family = "")
-
-theme_minimal(base_size = 12, base_family = "")
-
-theme_classic(base_size = 12, base_family = "")
-
-theme_dark(base_size = 12, base_family = "")
-
-theme_void(base_size = 12, base_family = "")
-
- -
-

Arguments

-
base_size
-

base font size

- - -
base_family
-

base font family

- -
-
-

Details

- -
theme_gray
-

The signature ggplot2 theme with a grey background and white gridlines, -designed to put the data forward yet make comparisons easy.

- - -
theme_bw
-

The classic dark-on-light ggplot2 theme. May work better for presentations -displayed with a projector.

- - -
theme_linedraw
-

A theme with only black lines of various widths on white backgrounds, -reminiscent of a line drawings. Serves a purpose similar to theme_bw. -Note that this theme has some very thin lines (<< 1 pt) which some journals -may refuse.

- - -
theme_light
-

A theme similar to theme_linedraw but with light grey lines and axes, -to direct more attention towards the data.

- - -
theme_dark
-

The dark cousin of theme_light, with similar line sizes but a dark background. Useful to make thin coloured lines pop out.

- - -
theme_minimal
-

A minimalistic theme with no background annotations.

- - -
theme_classic
-

A classic-looking theme, with x and y axis lines and no gridlines.

- - -
theme_void
-

A completely empty theme.

- - - -
- -
-

Examples

-
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg,
-     colour = factor(gear))) + facet_wrap(~am)
-
-p
-
-p + theme_gray()
-
-p + theme_bw()
-
-p + theme_linedraw()
-
-p + theme_light()
-
-p + theme_dark()
-
-p + theme_minimal()
-
-p + theme_classic()
-
-p + theme_void()
-
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/graphical-units.html b/docs/reference/graphical-units.html deleted file mode 100644 index 8543c4d39..000000000 --- a/docs/reference/graphical-units.html +++ /dev/null @@ -1,90 +0,0 @@ - -Graphical units — graphical-units • animint2 - Skip to contents - - -
-
-
- -
-

Multiply size in mm by these constants in order to convert to the units -that grid uses internally for lwd and fontsize.

-
- -
-

Usage

-
.pt
-
-.stroke
-
- -
-

Format

-

An object of class numeric of length 1.

-

An object of class numeric of length 1.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/guide_colourbar-1.png b/docs/reference/guide_colourbar-1.png deleted file mode 100644 index c7af923ff..000000000 Binary files a/docs/reference/guide_colourbar-1.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-10.png b/docs/reference/guide_colourbar-10.png deleted file mode 100644 index ce16d07c1..000000000 Binary files a/docs/reference/guide_colourbar-10.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-11.png b/docs/reference/guide_colourbar-11.png deleted file mode 100644 index d3c269e4c..000000000 Binary files a/docs/reference/guide_colourbar-11.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-12.png b/docs/reference/guide_colourbar-12.png deleted file mode 100644 index d6139055f..000000000 Binary files a/docs/reference/guide_colourbar-12.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-13.png b/docs/reference/guide_colourbar-13.png deleted file mode 100644 index d6139055f..000000000 Binary files a/docs/reference/guide_colourbar-13.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-14.png b/docs/reference/guide_colourbar-14.png deleted file mode 100644 index ba45d064e..000000000 Binary files a/docs/reference/guide_colourbar-14.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-2.png b/docs/reference/guide_colourbar-2.png deleted file mode 100644 index c7af923ff..000000000 Binary files a/docs/reference/guide_colourbar-2.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-3.png b/docs/reference/guide_colourbar-3.png deleted file mode 100644 index c7af923ff..000000000 Binary files a/docs/reference/guide_colourbar-3.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-4.png b/docs/reference/guide_colourbar-4.png deleted file mode 100644 index a2f90a61e..000000000 Binary files a/docs/reference/guide_colourbar-4.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-5.png b/docs/reference/guide_colourbar-5.png deleted file mode 100644 index a83d59581..000000000 Binary files a/docs/reference/guide_colourbar-5.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-6.png b/docs/reference/guide_colourbar-6.png deleted file mode 100644 index fd43fd5dc..000000000 Binary files a/docs/reference/guide_colourbar-6.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-7.png b/docs/reference/guide_colourbar-7.png deleted file mode 100644 index cd2cd8359..000000000 Binary files a/docs/reference/guide_colourbar-7.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-8.png b/docs/reference/guide_colourbar-8.png deleted file mode 100644 index ee591fbae..000000000 Binary files a/docs/reference/guide_colourbar-8.png and /dev/null differ diff --git a/docs/reference/guide_colourbar-9.png b/docs/reference/guide_colourbar-9.png deleted file mode 100644 index 9d4fd43d5..000000000 Binary files a/docs/reference/guide_colourbar-9.png and /dev/null differ diff --git a/docs/reference/guide_colourbar.html b/docs/reference/guide_colourbar.html deleted file mode 100644 index 79e536881..000000000 --- a/docs/reference/guide_colourbar.html +++ /dev/null @@ -1,344 +0,0 @@ - -Continuous colour bar guide. — guide_colourbar • animint2 - Skip to contents - - -
-
-
- -
-

Colour bar guide shows continuous color scales mapped onto values. -Colour bar is available with scale_fill and scale_colour. -For more information, see the inspiration for this function: -Matlab's colorbar function.

-
- -
-

Usage

-
guide_colourbar(
-  title = waiver(),
-  title.position = NULL,
-  title.theme = NULL,
-  title.hjust = NULL,
-  title.vjust = NULL,
-  label = TRUE,
-  label.position = NULL,
-  label.theme = NULL,
-  label.hjust = NULL,
-  label.vjust = NULL,
-  barwidth = NULL,
-  barheight = NULL,
-  nbin = 20,
-  raster = TRUE,
-  ticks = TRUE,
-  draw.ulim = TRUE,
-  draw.llim = TRUE,
-  direction = NULL,
-  default.unit = "line",
-  reverse = FALSE,
-  order = 0,
-  ...
-)
-
-guide_colorbar(
-  title = waiver(),
-  title.position = NULL,
-  title.theme = NULL,
-  title.hjust = NULL,
-  title.vjust = NULL,
-  label = TRUE,
-  label.position = NULL,
-  label.theme = NULL,
-  label.hjust = NULL,
-  label.vjust = NULL,
-  barwidth = NULL,
-  barheight = NULL,
-  nbin = 20,
-  raster = TRUE,
-  ticks = TRUE,
-  draw.ulim = TRUE,
-  draw.llim = TRUE,
-  direction = NULL,
-  default.unit = "line",
-  reverse = FALSE,
-  order = 0,
-  ...
-)
-
- -
-

Arguments

-
title
-

A character string or expression indicating a title of guide. -If NULL, the title is not shown. By default -(waiver), the name of the scale object or the name -specified in labs is used for the title.

- - -
title.position
-

A character string indicating the position of a - title. One of "top" (default for a vertical guide), "bottom", "left" -(default for a horizontal guide), or "right."

- - -
title.theme
-

A theme object for rendering the title text. Usually the -object of element_text is expected. By default, the theme is -specified by legend.title in theme or theme.

- - -
title.hjust
-

A number specifying horizontal justification of the -title text.

- - -
title.vjust
-

A number specifying vertical justification of the title -text.

- - -
label
-

logical. If TRUE then the labels are drawn. If -FALSE then the labels are invisible.

- - -
label.position
-

A character string indicating the position of a -label. One of "top", "bottom" (default for horizontal guide), "left", or -"right" (default for vertical guide).

- - -
label.theme
-

A theme object for rendering the label text. Usually the -object of element_text is expected. By default, the theme is -specified by legend.text in theme or theme.

- - -
label.hjust
-

A numeric specifying horizontal justification of the -label text.

- - -
label.vjust
-

A numeric specifying vertical justification of the label -text.

- - -
barwidth
-

A numeric or a unit object specifying -the width of the colorbar. Default value is legend.key.width or -legend.key.size in theme or theme.

- - -
barheight
-

A numeric or a unit object specifying -the height of the colorbar. Default value is legend.key.height or -legend.key.size in theme or theme.

- - -
nbin
-

A numeric specifying the number of bins for drawing colorbar. A -smoother colorbar for a larger value.

- - -
raster
-

A logical. If TRUE then the colorbar is rendered as a -raster object. If FALSE then the colorbar is rendered as a set of -rectangles. Note that not all graphics devices are capable of rendering -raster image.

- - -
ticks
-

A logical specifying if tick marks on colorbar should be -visible.

- - -
draw.ulim
-

A logical specifying if the upper limit tick marks should -be visible.

- - -
draw.llim
-

A logical specifying if the lower limit tick marks should -be visible.

- - -
direction
-

A character string indicating the direction of the guide. -One of "horizontal" or "vertical."

- - -
default.unit
-

A character string indicating unit -for barwidth and barheight.

- - -
reverse
-

logical. If TRUE the colorbar is reversed. By default, -the highest value is on the top and the lowest value is on the bottom

- - -
order
-

positive integer less that 99 that specifies the order of -this guide among multiple guides. This controls the order in which -multiple guides are displayed, not the contents of the guide itself. -If 0 (default), the order is determined by a secret algorithm.

- - -
...
-

ignored.

- -
-
-

Value

- - -

A guide object

-
-
-

Details

-

Guides can be specified in each scale_* or in guides. -guide="legend" in scale_* is syntactic sugar for -guide=guide_legend() (e.g. scale_color_manual(guide = "legend")). -As for how to specify the guide for each scale in more detail, -see guides.

-
-
-

See also

-

Other guides: -guide_legend(), -guides()

-
- -
-

Examples

-
df <- reshape2::melt(outer(1:4, 1:4), varnames = c("X1", "X2"))
-
-p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value))
-p2 <- p1 + geom_point(aes(size = value))
-
-# Basic form
-p1 + scale_fill_continuous(guide = "colorbar")
-
-p1 + scale_fill_continuous(guide = guide_colorbar())
-
-p1 + guides(fill = guide_colorbar())
-
-
-# Control styles
-
-# bar size
-p1 + guides(fill = guide_colorbar(barwidth = 0.5, barheight = 10))
-
-
-# no label
-p1 + guides(fill = guide_colorbar(label = FALSE))
-
-
-# no tick marks
-p1 + guides(fill = guide_colorbar(ticks = FALSE))
-
-
-# label position
-p1 + guides(fill = guide_colorbar(label.position = "left"))
-
-
-# label theme
-p1 + guides(fill = guide_colorbar(label.theme = element_text(colour = "blue", angle = 0)))
-
-
-# small number of bins
-p1 + guides(fill = guide_colorbar(nbin = 3))
-
-
-# large number of bins
-p1 + guides(fill = guide_colorbar(nbin = 100))
-
-
-# make top- and bottom-most ticks invisible
-p1 + scale_fill_continuous(limits = c(0,20), breaks = c(0, 5, 10, 15, 20),
- guide = guide_colorbar(nbin=100, draw.ulim = FALSE, draw.llim = FALSE))
-
-
-# guides can be controlled independently
-p2 +
-  scale_fill_continuous(guide = "colorbar") +
-  scale_size(guide = "legend")
-
-p2 + guides(fill = "colorbar", size = "legend")
-
-
-p2 +
-  scale_fill_continuous(guide = guide_colorbar(direction = "horizontal")) +
-  scale_size(guide = guide_legend(direction = "vertical"))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/guide_legend-1.png b/docs/reference/guide_legend-1.png deleted file mode 100644 index 4b0e75ea8..000000000 Binary files a/docs/reference/guide_legend-1.png and /dev/null differ diff --git a/docs/reference/guide_legend-10.png b/docs/reference/guide_legend-10.png deleted file mode 100644 index 21deecd47..000000000 Binary files a/docs/reference/guide_legend-10.png and /dev/null differ diff --git a/docs/reference/guide_legend-11.png b/docs/reference/guide_legend-11.png deleted file mode 100644 index 9ceadcaeb..000000000 Binary files a/docs/reference/guide_legend-11.png and /dev/null differ diff --git a/docs/reference/guide_legend-12.png b/docs/reference/guide_legend-12.png deleted file mode 100644 index 5a1ded3b7..000000000 Binary files a/docs/reference/guide_legend-12.png and /dev/null differ diff --git a/docs/reference/guide_legend-13.png b/docs/reference/guide_legend-13.png deleted file mode 100644 index ae5bf50e3..000000000 Binary files a/docs/reference/guide_legend-13.png and /dev/null differ diff --git a/docs/reference/guide_legend-14.png b/docs/reference/guide_legend-14.png deleted file mode 100644 index e0e3e3d75..000000000 Binary files a/docs/reference/guide_legend-14.png and /dev/null differ diff --git a/docs/reference/guide_legend-15.png b/docs/reference/guide_legend-15.png deleted file mode 100644 index d95767670..000000000 Binary files a/docs/reference/guide_legend-15.png and /dev/null differ diff --git a/docs/reference/guide_legend-16.png b/docs/reference/guide_legend-16.png deleted file mode 100644 index ce4857261..000000000 Binary files a/docs/reference/guide_legend-16.png and /dev/null differ diff --git a/docs/reference/guide_legend-2.png b/docs/reference/guide_legend-2.png deleted file mode 100644 index 4b0e75ea8..000000000 Binary files a/docs/reference/guide_legend-2.png and /dev/null differ diff --git a/docs/reference/guide_legend-3.png b/docs/reference/guide_legend-3.png deleted file mode 100644 index 3eb70f33a..000000000 Binary files a/docs/reference/guide_legend-3.png and /dev/null differ diff --git a/docs/reference/guide_legend-4.png b/docs/reference/guide_legend-4.png deleted file mode 100644 index 79fa2cb82..000000000 Binary files a/docs/reference/guide_legend-4.png and /dev/null differ diff --git a/docs/reference/guide_legend-5.png b/docs/reference/guide_legend-5.png deleted file mode 100644 index 3b535c670..000000000 Binary files a/docs/reference/guide_legend-5.png and /dev/null differ diff --git a/docs/reference/guide_legend-6.png b/docs/reference/guide_legend-6.png deleted file mode 100644 index f6f24f4c3..000000000 Binary files a/docs/reference/guide_legend-6.png and /dev/null differ diff --git a/docs/reference/guide_legend-7.png b/docs/reference/guide_legend-7.png deleted file mode 100644 index eb3624296..000000000 Binary files a/docs/reference/guide_legend-7.png and /dev/null differ diff --git a/docs/reference/guide_legend-8.png b/docs/reference/guide_legend-8.png deleted file mode 100644 index c0deb92fe..000000000 Binary files a/docs/reference/guide_legend-8.png and /dev/null differ diff --git a/docs/reference/guide_legend-9.png b/docs/reference/guide_legend-9.png deleted file mode 100644 index 65eafaa3f..000000000 Binary files a/docs/reference/guide_legend-9.png and /dev/null differ diff --git a/docs/reference/guide_legend.html b/docs/reference/guide_legend.html deleted file mode 100644 index b3e8d7908..000000000 --- a/docs/reference/guide_legend.html +++ /dev/null @@ -1,330 +0,0 @@ - -Legend guide. — guide_legend • animint2 - Skip to contents - - -
-
-
- -
-

Legend type guide shows key (i.e., geoms) mapped onto values. -Legend guides for various scales are integrated if possible.

-
- -
-

Usage

-
guide_legend(
-  title = waiver(),
-  title.position = NULL,
-  title.theme = NULL,
-  title.hjust = NULL,
-  title.vjust = NULL,
-  label = TRUE,
-  label.position = NULL,
-  label.theme = NULL,
-  label.hjust = NULL,
-  label.vjust = NULL,
-  keywidth = NULL,
-  keyheight = NULL,
-  direction = NULL,
-  default.unit = "line",
-  override.aes = list(),
-  nrow = NULL,
-  ncol = NULL,
-  byrow = FALSE,
-  reverse = FALSE,
-  order = 0,
-  ...
-)
-
- -
-

Arguments

-
title
-

A character string or expression indicating a title of guide. -If NULL, the title is not shown. By default -(waiver), the name of the scale object or the name -specified in labs is used for the title.

- - -
title.position
-

A character string indicating the position of a - title. One of "top" (default for a vertical guide), "bottom", "left" -(default for a horizontal guide), or "right."

- - -
title.theme
-

A theme object for rendering the title text. Usually the -object of element_text is expected. By default, the theme is -specified by legend.title in theme or theme.

- - -
title.hjust
-

A number specifying horizontal justification of the -title text.

- - -
title.vjust
-

A number specifying vertical justification of the title -text.

- - -
label
-

logical. If TRUE then the labels are drawn. If -FALSE then the labels are invisible.

- - -
label.position
-

A character string indicating the position of a -label. One of "top", "bottom" (default for horizontal guide), "left", or -"right" (default for vertical guide).

- - -
label.theme
-

A theme object for rendering the label text. Usually the -object of element_text is expected. By default, the theme is -specified by legend.text in theme or theme.

- - -
label.hjust
-

A numeric specifying horizontal justification of the -label text.

- - -
label.vjust
-

A numeric specifying vertical justification of the label -text.

- - -
keywidth
-

A numeric or a unit object specifying -the width of the legend key. Default value is legend.key.width or -legend.key.size in theme or theme.

- - -
keyheight
-

A numeric or a unit object specifying -the height of the legend key. Default value is legend.key.height or -legend.key.size in theme or theme.

- - -
direction
-

A character string indicating the direction of the guide. -One of "horizontal" or "vertical."

- - -
default.unit
-

A character string indicating unit -for keywidth and keyheight.

- - -
override.aes
-

A list specifying aesthetic parameters of legend key. -See details and examples.

- - -
nrow
-

The desired number of rows of legends.

- - -
ncol
-

The desired number of column of legends.

- - -
byrow
-

logical. If FALSE (the default) the legend-matrix is -filled by columns, otherwise the legend-matrix is filled by rows.

- - -
reverse
-

logical. If TRUE the order of legends is reversed.

- - -
order
-

positive integer less that 99 that specifies the order of -this guide among multiple guides. This controls the order in which -multiple guides are displayed, not the contents of the guide itself. -If 0 (default), the order is determined by a secret algorithm.

- - -
...
-

ignored.

- -
-
-

Value

- - -

A guide object

-
-
-

Details

-

Guides can be specified in each scale_* or in guides. -guide="legend" in scale_* is syntactic sugar for -guide=guide_legend() (e.g. scale_color_manual(guide = "legend")). -As for how to specify the guide for each scale in more detail, -see guides.

-
-
-

See also

-

Other guides: -guide_colourbar(), -guides()

-
- -
-

Examples

-
# \donttest{
-df <- reshape2::melt(outer(1:4, 1:4), varnames = c("X1", "X2"))
-
-p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value))
-p2 <- p1 + geom_point(aes(size = value))
-
-# Basic form
-p1 + scale_fill_continuous(guide = "legend")
-
-p1 + scale_fill_continuous(guide = guide_legend())
-
-
-# Guide title
-p1 + scale_fill_continuous(guide = guide_legend(title = "V")) # title text
-
-p1 + scale_fill_continuous(guide = guide_legend(title = NULL)) # no title
-
-
-# Control styles
-
-# key size
-p1 + guides(fill = guide_legend(keywidth = 3, keyheight = 1))
-
-
-# title position
-p1 + guides(fill = guide_legend(title = "LEFT", title.position = "left"))
-
-
-# title text styles via element_text
-p1 + guides(fill =
-  guide_legend(
-    title.theme = element_text(
-      size = 15,
-      face = "italic",
-      colour = "red",
-      angle = 0
-    )
-  )
-)
-
-
-# label position
-p1 + guides(fill = guide_legend(label.position = "left", label.hjust = 1))
-
-
-# label styles
-p1 + scale_fill_continuous(breaks = c(5, 10, 15),
-  labels = paste("long", c(5, 10, 15)),
-  guide = guide_legend(
-    direction = "horizontal",
-    title.position = "top",
-    label.position = "bottom",
-    label.hjust = 0.5,
-    label.vjust = 1,
-    label.theme = element_text(angle = 90)
-  )
-)
-
-
-# Set aesthetic of legend key
-
-# very low alpha value make it difficult to see legend key
-p3 <- ggplot(diamonds, aes(carat, price)) +
-  geom_point(aes(colour = color), alpha = 1/100)
-p3
-
-
-# override.aes overwrites the alpha
-p3 + guides(colour = guide_legend(override.aes = list(alpha = 1)))
-
-
-# multiple row/col legends
-df <- data.frame(x = 1:20, y = 1:20, color = letters[1:20])
-p <- ggplot(df, aes(x, y)) +
-  geom_point(aes(colour = color))
-p + guides(col = guide_legend(nrow = 8))
-
-p + guides(col = guide_legend(ncol = 8))
-
-p + guides(col = guide_legend(nrow = 8, byrow = TRUE))
-
-p + guides(col = guide_legend(ncol = 8, byrow = TRUE))
-
-
-# reversed order legend
-p + guides(col = guide_legend(reverse = TRUE))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/guides-1.png b/docs/reference/guides-1.png deleted file mode 100644 index 992e6573d..000000000 Binary files a/docs/reference/guides-1.png and /dev/null differ diff --git a/docs/reference/guides-10.png b/docs/reference/guides-10.png deleted file mode 100644 index 813467572..000000000 Binary files a/docs/reference/guides-10.png and /dev/null differ diff --git a/docs/reference/guides-11.png b/docs/reference/guides-11.png deleted file mode 100644 index 5e2b22344..000000000 Binary files a/docs/reference/guides-11.png and /dev/null differ diff --git a/docs/reference/guides-2.png b/docs/reference/guides-2.png deleted file mode 100644 index 992e6573d..000000000 Binary files a/docs/reference/guides-2.png and /dev/null differ diff --git a/docs/reference/guides-3.png b/docs/reference/guides-3.png deleted file mode 100644 index 992e6573d..000000000 Binary files a/docs/reference/guides-3.png and /dev/null differ diff --git a/docs/reference/guides-4.png b/docs/reference/guides-4.png deleted file mode 100644 index 992e6573d..000000000 Binary files a/docs/reference/guides-4.png and /dev/null differ diff --git a/docs/reference/guides-5.png b/docs/reference/guides-5.png deleted file mode 100644 index 763655384..000000000 Binary files a/docs/reference/guides-5.png and /dev/null differ diff --git a/docs/reference/guides-6.png b/docs/reference/guides-6.png deleted file mode 100644 index 4bcbb8dec..000000000 Binary files a/docs/reference/guides-6.png and /dev/null differ diff --git a/docs/reference/guides-7.png b/docs/reference/guides-7.png deleted file mode 100644 index 641acec0b..000000000 Binary files a/docs/reference/guides-7.png and /dev/null differ diff --git a/docs/reference/guides-8.png b/docs/reference/guides-8.png deleted file mode 100644 index 641acec0b..000000000 Binary files a/docs/reference/guides-8.png and /dev/null differ diff --git a/docs/reference/guides-9.png b/docs/reference/guides-9.png deleted file mode 100644 index ac9e50607..000000000 Binary files a/docs/reference/guides-9.png and /dev/null differ diff --git a/docs/reference/guides.html b/docs/reference/guides.html deleted file mode 100644 index 499e8162b..000000000 --- a/docs/reference/guides.html +++ /dev/null @@ -1,174 +0,0 @@ - -Set guides for each scale. — guides • animint2 - Skip to contents - - -
-
-
- -
-

Guides for each scale can be set in call of scale_* with argument -guide, or in guides.

-
- -
-

Usage

-
guides(...)
-
- -
-

Arguments

-
...
-

List of scale guide pairs

- -
-
-

Value

- - -

A list containing the mapping between scale and guide.

-
-
-

See also

-

Other guides: -guide_colourbar(), -guide_legend()

-
- -
-

Examples

-
# \donttest{
-# ggplot object
-
-dat <- data.frame(x = 1:5, y = 1:5, p = 1:5, q = factor(1:5),
- r = factor(1:5))
-p <- ggplot(dat, aes(x, y, colour = p, size = q, shape = r)) + geom_point()
-
-# without guide specification
-p
-#> Warning: Using size for a discrete variable is not advised.
-
-
-# Show colorbar guide for colour.
-# All these examples below have a same effect.
-
-p + guides(colour = "colorbar", size = "legend", shape = "legend")
-#> Warning: Using size for a discrete variable is not advised.
-
-p + guides(colour = guide_colorbar(), size = guide_legend(),
-  shape = guide_legend())
-#> Warning: Using size for a discrete variable is not advised.
-
-p +
- scale_colour_continuous(guide = "colorbar") +
- scale_size_discrete(guide = "legend") +
- scale_shape(guide = "legend")
-#> Warning: Using size for a discrete variable is not advised.
-
-
- # Remove some guides
- p + guides(colour = "none")
-#> Warning: Using size for a discrete variable is not advised.
-
- p + guides(colour = "colorbar",size = "none")
-#> Warning: Using size for a discrete variable is not advised.
-
-
-# Guides are integrated where possible
-
-p + guides(colour = guide_legend("title"), size = guide_legend("title"),
-  shape = guide_legend("title"))
-#> Warning: Using size for a discrete variable is not advised.
-
-# same as
-g <- guide_legend("title")
-p + guides(colour = g, size = g, shape = g)
-#> Warning: Using size for a discrete variable is not advised.
-
-
-p + theme(legend.position = "bottom")
-#> Warning: Using size for a discrete variable is not advised.
-
-
-# position of guides
-
-p + theme(legend.position = "bottom", legend.box = "horizontal")
-#> Warning: Using size for a discrete variable is not advised.
-
-
-# Set order for multiple guides
-ggplot(mpg, aes(displ, cty)) +
-  geom_point(aes(size = hwy, colour = cyl, shape = drv)) +
-  guides(
-   colour = guide_colourbar(order = 1),
-   shape = guide_legend(order = 2),
-   size = guide_legend(order = 3)
- )
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/hmisc.html b/docs/reference/hmisc.html deleted file mode 100644 index 06bfaf2fc..000000000 --- a/docs/reference/hmisc.html +++ /dev/null @@ -1,105 +0,0 @@ - -Wrap up a selection of summary functions from Hmisc to make it easy to use -with stat_summary. — hmisc • animint2 - Skip to contents - - -
-
-
- -
-

See the Hmisc documentation for details of their options.

-
- -
-

Usage

-
mean_cl_boot(x, ...)
-
-mean_cl_normal(x, ...)
-
-mean_sdl(x, ...)
-
-median_hilow(x, ...)
-
- -
-

Arguments

-
x
-

a numeric vector

- - -
...
-

other arguments passed on to the respective Hmisc function.

- -
- - -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/index.html b/docs/reference/index.html deleted file mode 100644 index a08e2dfb3..000000000 --- a/docs/reference/index.html +++ /dev/null @@ -1,1415 +0,0 @@ - -Function reference • animint2 - Skip to contents - - -
-
-
- -
-

Basics

- -

All the necessities you need to render animints or static data visualizations. You begin with ggplot() and your data. Add geoms, aesthetics, and other components with +. Then make your plot interactive with animint().

- - -
- - - - -
- - ggplot() -
-
Create a new ggplot plot.
-
- - animint() -
-
Create an animint
-
- - aes() -
-
Define aesthetic mappings.
-
- - `+`(<gganimint>) `%+%` `%+replace%` -
-
Add a new component to a ggplot or theme object.
-
- - ggsave() -
-
Save a ggplot (or other grid object) with sensible defaults
-
- - qplot() quickplot() -
-
Quick plot
-
-

Layers

- -

Layers determine how a graph looks and consist of the data; either a geom, a statistical transformation, or both; aesthetics; and possible position adjustments. Graphs may have more than one layer. It’s possible to use layer() to generate layers, but many people find it to be prolix. It’s convention to instead use a geom or stat function.

- - -
- - - - -
- - layer() -
-
Create a new layer
-
- -

Geoms

-

Geoms are geometric objects used to determine the kind of data visualization you’ll be generating. For example, you’d select geom_point() for a scatterplot and geom_line() for a line plot.

- - -
- - - - -
- - geom_abline() geom_hline() geom_vline() -
-
Lines: horizontal, vertical, and specified by slope and intercept.
-
- - geom_bar() stat_count() -
-
Bars, rectangles with bases on x-axis
-
- - geom_bin2d() stat_bin_2d() -
-
Add heatmap of 2d bin counts.
-
- - geom_blank() -
-
Blank, draws nothing.
-
- - geom_contour() stat_contour() -
-
Display contours of a 3d surface in 2d.
-
- - geom_count() stat_sum() -
-
Count the number of observations at each location.
-
- - geom_density() stat_density() -
-
Display a smooth density estimate.
-
- - geom_density_2d() stat_density_2d() -
-
Contours from a 2d density estimate.
-
- - geom_dotplot() -
-
Dot plot
-
- - geom_errorbarh() -
-
Horizontal error bars
-
- - geom_hex() stat_bin_hex() -
-
Hexagon binning.
-
- - geom_freqpoly() geom_histogram() stat_bin() -
-
Histograms and frequency polygons.
-
- - geom_jitter() -
-
Points, jittered to reduce overplotting.
-
- - geom_crossbar() geom_errorbar() geom_linerange() geom_pointrange() -
-
Vertical intervals: lines, crossbars & errorbars.
-
- - geom_map() -
-
Polygons from a reference map.
-
- - geom_path() geom_line() geom_step() -
-
Connect observations.
-
- - geom_point() -
-
Points, as for a scatterplot
-
- - geom_polygon() -
-
Polygon, a filled path.
-
- - geom_ribbon() geom_area() -
-
Ribbons and area plots.
-
- - geom_rug() -
-
Marginal rug plots.
-
- - geom_segment() geom_curve() -
-
Line segments and curves.
-
- - geom_smooth() stat_smooth() -
-
Add a smoothed conditional mean.
-
- - geom_spoke() -
-
A line segment parameterised by location, direction and distance.
-
- - geom_tallrect() -
-
ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements.
-
- - geom_label() geom_text() -
-
Textual annotations.
-
- - geom_raster() geom_rect() geom_tile() -
-
Draw rectangles.
-
- - geom_violin() stat_ydensity() -
-
Violin plot.
-
- - geom_widerect() -
-
ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements.
-
- - stat_qq() geom_qq() -
-
Calculation for quantile-quantile plot.
-
- - update_geom_defaults() update_stat_defaults() -
-
Modify geom/stat aesthetic defaults for future plots
-
- -

Stats

-

Stats are similar to geoms. They differ only in that they summarize or transform the data in some way.

- - -
- - - - -
- - geom_bar() stat_count() -
-
Bars, rectangles with bases on x-axis
-
- - geom_bin2d() stat_bin_2d() -
-
Add heatmap of 2d bin counts.
-
- - geom_contour() stat_contour() -
-
Display contours of a 3d surface in 2d.
-
- - geom_count() stat_sum() -
-
Count the number of observations at each location.
-
- - geom_density() stat_density() -
-
Display a smooth density estimate.
-
- - geom_density_2d() stat_density_2d() -
-
Contours from a 2d density estimate.
-
- - geom_hex() stat_bin_hex() -
-
Hexagon binning.
-
- - geom_freqpoly() geom_histogram() stat_bin() -
-
Histograms and frequency polygons.
-
- - geom_smooth() stat_smooth() -
-
Add a smoothed conditional mean.
-
- - geom_spoke() -
-
A line segment parameterised by location, direction and distance.
-
- - geom_violin() stat_ydensity() -
-
Violin plot.
-
- - stat_ecdf() -
-
Empirical Cumulative Density Function
-
- - stat_ellipse() -
-
Plot data ellipses.
-
- - stat_function() -
-
Superimpose a function.
-
- - stat_identity() -
-
Identity statistic.
-
- - stat_qq() geom_qq() -
-
Calculation for quantile-quantile plot.
-
- - stat_summary_bin() stat_summary() -
-
Summarise y values at unique/binned x x.
-
- - stat_summary_2d() stat_summary_hex() -
-
Bin and summarise in 2d (rectangle & hexagons)
-
- - stat_unique() -
-
Remove duplicates.
-
- - update_geom_defaults() update_stat_defaults() -
-
Modify geom/stat aesthetic defaults for future plots
-
- -

Position Adjustments

-

Position adjustments are used to stop overlapping geoms from overlapping.

- - -
- - - - -
- - position_dodge() -
-
Adjust position by dodging overlaps to the side.
-
- - position_identity() -
-
Don't adjust position
-
- - position_jitter() -
-
Jitter points to avoid overplotting.
-
- - position_jitterdodge() -
-
Adjust position by simultaneously dodging and jittering
-
- - position_nudge() -
-
Nudge points.
-
- - position_fill() position_stack() -
-
Stack overlapping objects on top of one another.
-
- -

Annotations

-

Annotations denote reference points or important features in a data visualization. They don’t inherit settings from the animint or static data visualization.

- - -
- - - - -
- - geom_abline() geom_hline() geom_vline() -
-
Lines: horizontal, vertical, and specified by slope and intercept.
-
- - annotate() -
-
Create an annotation layer.
-
- - annotation_custom() -
-
Annotation: Custom grob.
-
- - annotation_logticks() -
-
Annotation: log tick marks
-
- - annotation_map() -
-
Annotation: maps.
-
- - annotation_raster() -
-
Annotation: High-performance rectangular tiling.
-
- - borders() -
-
Create a layer of map borders.
-
-

Interactivity

- -

Generate animints by first using ggplot() and creating a layer. Then place the resulting ggplot into animint(), which will automatically render the plot interactive.

- - -
- - - - -
- - animint() -
-
Create an animint
-
- - animint2dir() -
-
Compile and render an animint in a local directory.
-
- - animint2gist() -
-
Convert a list of ggplots to an interactive animation and post files as a gist
-
- - animintOutput() -
-
Shiny ui output function
-
- - renderAnimint() -
-
Create an animint output element
-
- -

Animint Helpers

-

These functions give you more control over your animint or make doing things with animints a little more convenient.

- - -
- - - - -
- - addShowSelectedForLegend() -
-
Add a showSelected aesthetic if legend is specified
-
- - addSSandCSasAesthetics() -
-
Add the showSelected/clickSelects params to the aesthetics mapping
-
- - make_bar() -
-
Convenience function for an interactive bar that might otherwise be -created using stat_summary(geom="bar").
-
- - make_tallrect() -
-
Make a clickSelects geom_tallrect that completely tiles the x -range. This makes it easy to construct tallrects for the common -case of selecting a particular x value.
-
- - make_tallrect_or_widerect() -
-
Make a clickSelects geom_widerect or geom_tallrect that completely -tiles the x or y range. This function is used internally by -make_tallrect or make_widerect, which are more user-friendly.
-
- - make_text() -
-
Convenvience function for a showSelected plot label.
-
- - make_widerect() -
-
Make a clickSelects geom_widerect that completely tiles the y -range. This makes it easy to construct widerects for the common -case of selecting a particular y value.
-
- - setPlotSizes() -
-
Set plot width and height for all plots
-
- - switch_axes() -
-
Flip axes in case of coord_flip -Switches column names. Eg. xmin to ymin, yntercept to xintercept etc.
-
- -

Data Manipulation

-

Animints take data, but they also output it. These functions give you control over both the data inputted and outputted.

- - -
- - - - -
- - colsNotToCopy() -
-
Filter out columns that do not need to be copied
-
- - getCommonChunk() -
-
Save the common columns for each tsv to one chunk
-
- - getLayerName() -
-
Gives a unique name to each layer in saveLayer
-
- - getLayerParams() -
-
Get all parameters for a layer
-
- - getLegend() -
-
Function to get legend information for each scale
-
- - getLegendList() -
-
Function to get legend information from ggplot
-
- - getTextSize() -
-
Function to process text size with different types of unit
-
- - getUniqueAxisLabels() -
-
Get unique axis labels for the plot
-
- - issueSelectorWarnings() -
-
Issue warnings for selectors
-
- - merge_recurse() -
-
Merge a list of data frames.
-
- - newEnvironment() -
-
Environment to store meta data
-
- - parsePlot() -
-
Convert a ggplot to a list.
-
- - saveChunks() -
-
Split data set into chunks and save them to separate files.
-
- - selectSSandCS() -
-
Separate .variable/.value selectors
-
- - split_recursive() -
-
Split data.frame into recursive list of data.frame.
-
- - varied.chunk() -
-
Extract subset for each data.frame in a list of data.frame
-
-

Coordinates

- -

By default, animint2 uses a Cartesian coordinate system. These functions allow you to tweak or change the coordinate system your data visualization uses.

- - -
- - - - -
- - coord_cartesian() -
-
Cartesian coordinates.
-
- - coord_fixed() -
-
Cartesian coordinates with fixed relationship between x and y scales.
-
- - coord_flip() -
-
Flipped cartesian coordinates.
-
- - coord_map() coord_quickmap() -
-
Map projections.
-
- - coord_polar() -
-
Polar coordinates.
-
- - coord_trans() -
-
Transformed cartesian coordinate system.
-
-

Themes

- -

Themes give you broad control over the appearance of everything in the data visualization orthogonal to the data. theme() gives you control over a single data visualization, while theme_set() modifies all future visualizations.

- - -
- - - - -
- - theme_grey() theme_gray() theme_bw() theme_linedraw() theme_light() theme_minimal() theme_classic() theme_dark() theme_void() -
-
ggplot2 themes
-
- - theme() -
-
Set theme elements
-
- - theme_animint() -
-
theme for passing animint specific params
-
- - theme_update() theme_replace() theme_get() theme_set() -
-
Get, set and update themes.
-
- - element_blank() -
-
Theme element: blank. -This theme element draws nothing, and assigns no space
-
- - element_line() -
-
Theme element: line.
-
- - element_rect() -
-
Theme element: rectangle.
-
- - element_text() -
-
Theme element: text.
-
- - margin() -
-
Define margins.
-
- - add_theme() -
-
Modify properties of an element in a theme object
-
- - calc_element() -
-
Calculate the element properties, by inheriting properties from its parents
-
- - rel() -
-
Relative sizing for theme elements
-
-

Aesthetics

- -

Aesthetics control how the data are connected to visual aspects of a data visualizations. You can use aes() to control color, transparency, size, shape, and more.

- - -
- - - - -
- - aes_() aes_string() aes_q() -
-
Define aesthetic mappings from strings, or quoted calls and formulas.
-
- - aes_colour_fill_alpha colour color fill -
-
Colour related aesthetics: colour, fill and alpha
-
- - aes_linetype_size_shape linetype size shape -
-
Differentiation related aesthetics: linetype, size, shape
-
- - aes_position x y xmin xmax ymin ymax xend yend -
-
Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
-
- - update_labels() -
-
Update axis/legend labels
-
- -

Scales

-

Scales are a subset of aesthetics. These functions control axes, legends, and the like.

- - -
- - - - -
- - labs() xlab() ylab() ggtitle() -
-
Change axis labels, legend titles, plot title/subtitle and below-plot -caption.
-
- - lims() xlim() ylim() -
-
Convenience functions to set the axis limits.
-
- - expand_limits() -
-
Expand the plot limits with data.
-
- - scale_alpha() scale_alpha_continuous() scale_alpha_discrete() -
-
Alpha scales.
-
- - scale_colour_brewer() scale_fill_brewer() scale_colour_distiller() scale_fill_distiller() -
-
Sequential, diverging and qualitative colour scales from colorbrewer.org
-
- - scale_x_continuous() scale_y_continuous() scale_x_log10() scale_y_log10() scale_x_reverse() scale_y_reverse() scale_x_sqrt() scale_y_sqrt() -
-
Continuous position scales (x & y).
-
- - scale_x_date() scale_y_date() scale_x_datetime() scale_y_datetime() -
-
Position scale, date & date times
-
- - scale_x_discrete() scale_y_discrete() -
-
Discrete position.
-
- - scale_colour_gradient() scale_fill_gradient() scale_colour_gradient2() scale_fill_gradient2() scale_colour_gradientn() scale_fill_gradientn() -
-
Smooth gradient between two colours
-
- - scale_colour_grey() scale_fill_grey() -
-
Sequential grey colour scale.
-
- - scale_colour_hue() scale_fill_hue() -
-
Qualitative colour scale with evenly spaced hues.
-
- - scale_colour_identity() scale_fill_identity() scale_shape_identity() scale_linetype_identity() scale_alpha_identity() scale_size_identity() -
-
Use values without scaling.
-
- - scale_linetype() scale_linetype_continuous() scale_linetype_discrete() -
-
Scale for line patterns.
-
- - scale_colour_manual() scale_fill_manual() scale_size_manual() scale_shape_manual() scale_linetype_manual() scale_alpha_manual() -
-
Create your own discrete scale.
-
- - scale_shape() -
-
Scale for shapes, aka glyphs.
-
- - scale_radius() scale_size() scale_size_area() -
-
Scale size (area or radius).
-
- - scale_size_animint() -
-
Scale point sizes using circle area, but specifying the radius in -pixels.
-
- -

Guides

-

Guides are a subset of scales. These functions give you finer control over scales.

- - -
- - - - -
- - guides() -
-
Set guides for each scale.
-
- - guide_colourbar() guide_colorbar() -
-
Continuous colour bar guide.
-
- - guide_legend() -
-
Legend guide.
-
-

Facetting

- -

Generate many small graphs for static data visualizations. These don’t work for animints.

- - -
- - - - -
- - facet_grid() -
-
Lay out panels in a grid.
-
- - facet_null() -
-
Facet specification: a single panel.
-
- - facet_wrap() -
-
Wrap a 1d ribbon of panels into 2d.
-
- - - - -
- - labeller() -
-
Generic labeller function for facets
-
- - label_value() label_both() label_context() label_parsed() label_wrap_gen() -
-
Labeller functions
-
- - label_bquote() -
-
Backquoted labeller
-
- - as_labeller() -
-
Coerce to labeller function
-
-

Helpers

- -

Some additional functions that aren’t at the core of animint2. Most of them are used for convenience or automation.

- - -
- -

Automation

-

autoplot() is used to automate plot production, while the fortify functions are used to automate tidying dataframes.

- - -
- - - - -
- - autoplot() -
-
Create a complete ggplot appropriate to a particular data type
-
- - fortify(<lm>) -
-
Supplement the data fitted to a linear model with model fit statistics.
-
- - fortify(<map>) -
-
Fortify method for map objects.
-
- - fortify() -
-
Fortify a model with data.
-
- - fortify(<SpatialPolygonsDataFrame>) fortify(<SpatialPolygons>) fortify(<Polygons>) fortify(<Polygon>) fortify(<SpatialLinesDataFrame>) fortify(<Lines>) fortify(<Line>) -
-
Fortify method for classes from the sp package.
-
- - map_data() -
-
Create a data frame of map data.
-
- -

Extending Animint2

-

You don’t need to stick with just the functions animint2 gives you. Use these functions to make your own geoms, stats, and scales.

- - -
- - - - -
- - knit_print(<animint>) -
-
Insert an interactive animation into an R markdown document using a customized print method.
-
- - print(<animint>) -
-
print animint
-
- - print(<gganimintplot>) plot(<gganimintplot>) -
-
Draw plot on current graphics device.
-
- - print(<gganimintproto>) -
-
Print a gganimintproto object
-
- - as.list(<gganimintproto>) -
-
Convert a gganimintproto object to a list
-
- - format(<gganimintproto>) -
-
Format a gganimintproto object
-
- - gganimintproto() gganimintproto_parent() -
-
Create a new gganimintproto object
-
- - is.gganimintproto() -
-
Is an object a gganimintproto object?
-
- -

Programming with Animint2

-

These functions help you program with animint2.

- - -
- - - - -
- - aes_() aes_string() aes_q() -
-
Define aesthetic mappings from strings, or quoted calls and formulas.
-
- - knit_print(<animint>) -
-
Insert an interactive animation into an R markdown document using a customized print method.
-
- - print(<animint>) -
-
print animint
-
- - print(<gganimintplot>) plot(<gganimintplot>) -
-
Draw plot on current graphics device.
-
- - print(<gganimintproto>) -
-
Print a gganimintproto object
-
- -

Helping Functions

-

These are convenience functions that may be helpful when making data visualizations.

- - -
- - - - -
- - cut_interval() cut_number() cut_width() -
-
Cut up numeric vector into useful groups.
-
- - mean_cl_boot() mean_cl_normal() mean_sdl() median_hilow() -
-
Wrap up a selection of summary functions from Hmisc to make it easy to use -with stat_summary.
-
- - mean_se() -
-
Calculate mean and standard errors on either side.
-
- - pt.to.lines() -
-
Convert pt value to lines
-
- - resolution() -
-
Compute the "resolution" of a data vector.
-
- - toRGB() -
-
Convert R colors to RGB hexadecimal color values
-
-

Datasets

- -

animint2 comes with a wide range of datasets. Use them to experiment with plot-building and animints.

- - -
- - - - -
- - breakpoints -
-
The breakpointError of simulated signals
-
- - change -
-
Graphical model structure change
-
- - ChromHMMiterations -
-
ChromHMM iterations
-
- - climate -
-
Climate data in central America from 1995 to 2000
-
- - compare -
-
Testing rank and compare SVM on simulated patterns
-
- - diamonds -
-
Prices of 50,000 round cut diamonds
-
- - economics economics_long -
-
US economic time series.
-
- - faithfuld -
-
2d density estimate of Old Faithful data
-
- - FluView -
-
FluView
-
- - FunctionalPruning -
-
Functional Pruning Algorithm
-
- - generation.loci -
-
Evolution simulation
-
- - intreg -
-
Interval regression
-
- - luv_colours -
-
colors() in Luv space.
-
- - malaria -
-
Malaria parasite genome variants
-
- - midwest -
-
Midwest demographics.
-
- - mixtureKNN -
-
K-Nearest-Neighbors model of the mixture example data
-
- - montreal.bikes -
-
Montreal bikes
-
- - mpg -
-
Fuel economy data from 1999 and 2008 for 38 popular models of car
-
- - msleep -
-
An updated and expanded version of the mammals sleep dataset.
-
- - PeakConsistency -
-
Consistency of segmentation models in simulated Poisson peaks
-
- - pirates -
-
Worldwide pirate attacks from 1978 to 2013
-
- - presidential -
-
Terms of 11 presidents from Eisenhower to Obama.
-
- - prior -
-
Class prior change
-
- - prostateLasso -
-
Lasso model of the prostate cancer data set
-
- - seals -
-
Vector field of seal movements.
-
- - TestROC -
-
Test ROC curves
-
- - txhousing -
-
Housing sales in TX.
-
- - UStornadoes -
-
Tornadoes in the United States from 1950 to 2012
-
- - VariantModels -
-
Error rates of supervised learning methods for variant calling
-
- - vervet -
-
Vervet monkey intestinal microbiome
-
- - WorldBank -
-
Demographics by country from 1960 to 2012
-
- - worldPop -
-
World population by subcontinent
-
-

Testing

- -

Some functions that may be useful for debugging.

- - -
- - - - -
- - checkAnimationTimeVar() -
-
Check animation variable for errors
-
- - checkExtraParams() -
-
Check extra_params argument for duplicates, non-named list
-
- - checkForSSandCSasAesthetics() -
-
Check if showSelected and clickSelects have been used as aesthetics -as in old syntax. If yes, raise error
-
- - checkPlotForAnimintExtensions() -
-
Performs error checking on the plot for animint extensions
-
- - checkPlotList() -
-
Check plot.list for errors
-
- - checkSingleShowSelectedValue() -
-
Issue warnings for non interactive plots where there is only one -showSelected value
-
- - is.gganimintproto() -
-
Is an object a gganimintproto object?
-
- - is.rel() -
-
Reports whether x is a rel object
-
- - is.rgb() -
-
Check if character is an RGB hexadecimal color value
-
- - is.theme() -
-
Reports whether x is a theme object
-
- - issueSelectorWarnings() -
-
Issue warnings for selectors
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/intreg.html b/docs/reference/intreg.html deleted file mode 100644 index f1ece7a76..000000000 --- a/docs/reference/intreg.html +++ /dev/null @@ -1,101 +0,0 @@ - -Interval regression — intreg • animint2 - Skip to contents - - -
-
-
- -
-

Learning model complexity using max-margin interval regression. We have -observed several noisy piecewise constant signals, and we have -weak labels about how many change-points occur in several regions. Max -margin interval regression is an algorithm that uses this information to -learn a penalty function for accurate change-point detection.

-
- -
-

Usage

-
data(intreg)
-
- -
-

Format

-

There are 7 related data.frames: signals contains the noisy - piecewise constant signals, annotations contains the weak labels, - segments and breaks contain the segmentation model, selection contains - the penalty and cost information, intervals contains the target - intervals of penalty values for each signal, and model describes the - learned max margin interval regression model.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.Coord.html b/docs/reference/is.Coord.html deleted file mode 100644 index fea0f7f91..000000000 --- a/docs/reference/is.Coord.html +++ /dev/null @@ -1,79 +0,0 @@ - -Is this object a coordinate system? — is.Coord • animint2 - Skip to contents - - -
-
-
- -
-

Is this object a coordinate system?

-
- -
-

Usage

-
is.Coord(x)
-
- - -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.facet.html b/docs/reference/is.facet.html deleted file mode 100644 index 0f8b2db56..000000000 --- a/docs/reference/is.facet.html +++ /dev/null @@ -1,86 +0,0 @@ - -Is this object a facetting specification? — is.facet • animint2 - Skip to contents - - -
-
-
- -
-

Is this object a facetting specification?

-
- -
-

Usage

-
is.facet(x)
-
- -
-

Arguments

-
x
-

object to test

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.gganimintproto.html b/docs/reference/is.gganimintproto.html deleted file mode 100644 index b7a735305..000000000 --- a/docs/reference/is.gganimintproto.html +++ /dev/null @@ -1,86 +0,0 @@ - -Is an object a gganimintproto object? — is.gganimintproto • animint2 - Skip to contents - - -
-
-
- -
-

Is an object a gganimintproto object?

-
- -
-

Usage

-
is.gganimintproto(x)
-
- -
-

Arguments

-
x
-

An object to test.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.ggplot.html b/docs/reference/is.ggplot.html deleted file mode 100644 index 4e23ccd75..000000000 --- a/docs/reference/is.ggplot.html +++ /dev/null @@ -1,86 +0,0 @@ - -Reports whether x is a ggplot object — is.ggplot • animint2 - Skip to contents - - -
-
-
- -
-

Reports whether x is a ggplot object

-
- -
-

Usage

-
is.ggplot(x)
-
- -
-

Arguments

-
x
-

An object to test

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.rel.html b/docs/reference/is.rel.html deleted file mode 100644 index 56d2c89a6..000000000 --- a/docs/reference/is.rel.html +++ /dev/null @@ -1,86 +0,0 @@ - -Reports whether x is a rel object — is.rel • animint2 - Skip to contents - - -
-
-
- -
-

Reports whether x is a rel object

-
- -
-

Usage

-
is.rel(x)
-
- -
-

Arguments

-
x
-

An object to test

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.rgb.html b/docs/reference/is.rgb.html deleted file mode 100644 index 023401aa4..000000000 --- a/docs/reference/is.rgb.html +++ /dev/null @@ -1,92 +0,0 @@ - -Check if character is an RGB hexadecimal color value — is.rgb • animint2 - Skip to contents - - -
-
-
- -
-

Check if character is an RGB hexadecimal color value

-
- -
-

Usage

-
is.rgb(x)
-
- -
-

Arguments

-
x
-

character

- -
-
-

Value

- - -

True/False value

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/is.theme.html b/docs/reference/is.theme.html deleted file mode 100644 index 63f792e96..000000000 --- a/docs/reference/is.theme.html +++ /dev/null @@ -1,86 +0,0 @@ - -Reports whether x is a theme object — is.theme • animint2 - Skip to contents - - -
-
-
- -
-

Reports whether x is a theme object

-
- -
-

Usage

-
is.theme(x)
-
- -
-

Arguments

-
x
-

An object to test

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/issueSelectorWarnings.html b/docs/reference/issueSelectorWarnings.html deleted file mode 100644 index 3687cd4e7..000000000 --- a/docs/reference/issueSelectorWarnings.html +++ /dev/null @@ -1,102 +0,0 @@ - -Issue warnings for selectors — issueSelectorWarnings • animint2 - Skip to contents - - -
-
-
- -
-

Issue warnings for selectors

-
- -
-

Usage

-
issueSelectorWarnings(geoms, selector.aes, duration)
-
- -
-

Arguments

-
geoms
-

geoms to check for warnings

- - -
selector.aes
-

selectors for each geom

- - -
duration
-

animation variable information to check for key value

- -
-
-

Value

- - -

NULL

- - -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/knit_print.animint.html b/docs/reference/knit_print.animint.html deleted file mode 100644 index d9188715d..000000000 --- a/docs/reference/knit_print.animint.html +++ /dev/null @@ -1,103 +0,0 @@ - -Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint • animint2 - Skip to contents - - -
-
-
- -
-

Insert an interactive animation into an R markdown document using a customized print method.

-
- -
-

Usage

-
# S3 method for animint
-knit_print(x, options, ...)
-
- -
-

Arguments

-
x
-

named list of ggplots and option lists to pass to animint2dir.

- - -
options
-

knitr options.

- - -
...
-

placeholder.

- -
-
-

References

-

https://github.com/yihui/knitr/blob/master/vignettes/knit_print.Rmd

-
-
-

Author

-

Carson Sievert

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/label_bquote-1.png b/docs/reference/label_bquote-1.png deleted file mode 100644 index 07763251f..000000000 Binary files a/docs/reference/label_bquote-1.png and /dev/null differ diff --git a/docs/reference/label_bquote-2.png b/docs/reference/label_bquote-2.png deleted file mode 100644 index 7448a7556..000000000 Binary files a/docs/reference/label_bquote-2.png and /dev/null differ diff --git a/docs/reference/label_bquote-3.png b/docs/reference/label_bquote-3.png deleted file mode 100644 index ea7024712..000000000 Binary files a/docs/reference/label_bquote-3.png and /dev/null differ diff --git a/docs/reference/label_bquote.html b/docs/reference/label_bquote.html deleted file mode 100644 index 59ef6334d..000000000 --- a/docs/reference/label_bquote.html +++ /dev/null @@ -1,118 +0,0 @@ - -Backquoted labeller — label_bquote • animint2 - Skip to contents - - -
-
-
- -
-

label_bquote() offers a flexible way of labelling -facet rows or columns with plotmath expressions. Backquoted -variables will be replaced with their value in the facet.

-
- -
-

Usage

-
label_bquote(rows = NULL, cols = NULL, default = label_value)
-
- -
-

Arguments

-
rows
-

Backquoted labelling expression for rows.

- - -
cols
-

Backquoted labelling expression for columns.

- - -
default
-

Default labeller function for the rows or the -columns when no plotmath expression is provided.

- -
-
-

See also

- -
- -
-

Examples

-
# The variables mentioned in the plotmath expression must be
-# backquoted and referred to by their names.
-p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
-p + facet_grid(vs ~ ., labeller = label_bquote(alpha ^ .(vs)))
-
-p + facet_grid(. ~ vs, labeller = label_bquote(cols = .(vs) ^ .(vs)))
-
-p + facet_grid(. ~ vs + am, labeller = label_bquote(cols = .(am) ^ .(vs)))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/labeller-1.png b/docs/reference/labeller-1.png deleted file mode 100644 index 1c5c46cd3..000000000 Binary files a/docs/reference/labeller-1.png and /dev/null differ diff --git a/docs/reference/labeller-2.png b/docs/reference/labeller-2.png deleted file mode 100644 index 663b235c3..000000000 Binary files a/docs/reference/labeller-2.png and /dev/null differ diff --git a/docs/reference/labeller-3.png b/docs/reference/labeller-3.png deleted file mode 100644 index e51407e95..000000000 Binary files a/docs/reference/labeller-3.png and /dev/null differ diff --git a/docs/reference/labeller-4.png b/docs/reference/labeller-4.png deleted file mode 100644 index 437b97f8c..000000000 Binary files a/docs/reference/labeller-4.png and /dev/null differ diff --git a/docs/reference/labeller-5.png b/docs/reference/labeller-5.png deleted file mode 100644 index fde9ff463..000000000 Binary files a/docs/reference/labeller-5.png and /dev/null differ diff --git a/docs/reference/labeller-6.png b/docs/reference/labeller-6.png deleted file mode 100644 index 20b447e7f..000000000 Binary files a/docs/reference/labeller-6.png and /dev/null differ diff --git a/docs/reference/labeller-7.png b/docs/reference/labeller-7.png deleted file mode 100644 index 437b97f8c..000000000 Binary files a/docs/reference/labeller-7.png and /dev/null differ diff --git a/docs/reference/labeller-8.png b/docs/reference/labeller-8.png deleted file mode 100644 index 5478320da..000000000 Binary files a/docs/reference/labeller-8.png and /dev/null differ diff --git a/docs/reference/labeller-9.png b/docs/reference/labeller-9.png deleted file mode 100644 index 7ce917c4f..000000000 Binary files a/docs/reference/labeller-9.png and /dev/null differ diff --git a/docs/reference/labeller.html b/docs/reference/labeller.html deleted file mode 100644 index 36f174f20..000000000 --- a/docs/reference/labeller.html +++ /dev/null @@ -1,223 +0,0 @@ - -Generic labeller function for facets — labeller • animint2 - Skip to contents - - -
-
-
- -
-

This function makes it easy to assign different labellers to -different factors. The labeller can be a function or it can be a -named character vectors that will serve as a lookup table.

-
- -
-

Usage

-
labeller(
-  ...,
-  .rows = NULL,
-  .cols = NULL,
-  keep.as.numeric = NULL,
-  .multi_line = TRUE,
-  .default = label_value
-)
-
- -
-

Arguments

-
...
-

Named arguments of the form variable = -labeller. Each labeller is passed to as_labeller() -and can be a lookup table, a function taking and returning -character vectors, or simply a labeller function.

- - -
.rows, .cols
-

Labeller for a whole margin (either the rows or -the columns). It is passed to as_labeller(). When a -margin-wide labeller is set, make sure you don't mention in -... any variable belonging to the margin.

- - -
keep.as.numeric
-

Deprecated. All supplied labellers and -on-labeller functions should be able to work with character -labels.

- - -
.multi_line
-

Whether to display the labels of multiple -factors on separate lines. This is passed to the labeller -function.

- - -
.default
-

Default labeller for variables not specified. Also -used with lookup tables or non-labeller functions.

- -
-
-

Value

- - -

A labeller function to supply to facet_grid

- - -

for the argument labeller.

-
-
-

Details

-

In case of functions, if the labeller has class labeller, it -is directly applied on the data frame of labels. Otherwise, it is -applied to the columns of the data frame of labels. The data frame -is then processed with the function specified in the -.default argument. This is intended to be used with -functions taking a character vector such as -capitalize.

-
-
-

See also

- -
- -
-

Examples

-
# \donttest{
-p1 <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point()
-
-# You can assign different labellers to variables:
-p1 + facet_grid(vs + am ~ gear,
-  labeller = labeller(vs = label_both, am = label_value))
-
-
-# Or whole margins:
-p1 + facet_grid(vs + am ~ gear,
-  labeller = labeller(.rows = label_both, .cols = label_value))
-
-
-# You can supply functions operating on strings:
-capitalize <- function(string) {
-  substr(string, 1, 1) <- toupper(substr(string, 1, 1))
-  string
-}
-p2 <- ggplot(msleep, aes(x = sleep_total, y = awake)) + geom_point()
-p2 + facet_grid(vore ~ conservation, labeller = labeller(vore = capitalize))
-
-
-# Or use character vectors as lookup tables:
-conservation_status <- c(
-  cd = "Conservation Dependent",
-  en = "Endangered",
-  lc = "Least concern",
-  nt = "Near Threatened",
-  vu = "Vulnerable",
-  domesticated = "Domesticated"
-)
-## Source: http://en.wikipedia.org/wiki/Wikipedia:Conservation_status
-
-p2 + facet_grid(vore ~ conservation, labeller = labeller(
-  .default = capitalize,
-  conservation = conservation_status
-))
-
-
-# In the following example, we rename the levels to the long form,
-# then apply a wrap labeller to the columns to prevent cropped text
-msleep$conservation2 <- plyr::revalue(msleep$conservation,
-  conservation_status)
-
-p2 %+% msleep + facet_grid(vore ~ conservation2)
-
-p2 %+% msleep +
-  facet_grid(vore ~ conservation2,
-    labeller = labeller(conservation2 = label_wrap_gen(10))
-  )
-
-
-# labeller() is especially useful to act as a global labeller. You
-# can set it up once and use it on a range of different plots with
-# different facet specifications.
-
-global_labeller <- labeller(
-  vore = capitalize,
-  conservation = conservation_status,
-  conservation2 = label_wrap_gen(10),
-  .default = label_both
-)
-
-p2 + facet_grid(vore ~ conservation, labeller = global_labeller)
-
-p2 + facet_wrap(~vore, labeller = global_labeller)
-
-p2 %+% msleep + facet_wrap(~conservation2, labeller = global_labeller)
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/labellers-1.png b/docs/reference/labellers-1.png deleted file mode 100644 index e74c82ef4..000000000 Binary files a/docs/reference/labellers-1.png and /dev/null differ diff --git a/docs/reference/labellers-2.png b/docs/reference/labellers-2.png deleted file mode 100644 index e74c82ef4..000000000 Binary files a/docs/reference/labellers-2.png and /dev/null differ diff --git a/docs/reference/labellers-3.png b/docs/reference/labellers-3.png deleted file mode 100644 index a3d6c8f19..000000000 Binary files a/docs/reference/labellers-3.png and /dev/null differ diff --git a/docs/reference/labellers-4.png b/docs/reference/labellers-4.png deleted file mode 100644 index a1b8f4482..000000000 Binary files a/docs/reference/labellers-4.png and /dev/null differ diff --git a/docs/reference/labellers-5.png b/docs/reference/labellers-5.png deleted file mode 100644 index 32c9cb9bd..000000000 Binary files a/docs/reference/labellers-5.png and /dev/null differ diff --git a/docs/reference/labellers-6.png b/docs/reference/labellers-6.png deleted file mode 100644 index 19f880fdb..000000000 Binary files a/docs/reference/labellers-6.png and /dev/null differ diff --git a/docs/reference/labellers-7.png b/docs/reference/labellers-7.png deleted file mode 100644 index 8e277afad..000000000 Binary files a/docs/reference/labellers-7.png and /dev/null differ diff --git a/docs/reference/labellers.html b/docs/reference/labellers.html deleted file mode 100644 index 4fe4f19f6..000000000 --- a/docs/reference/labellers.html +++ /dev/null @@ -1,205 +0,0 @@ - -Labeller functions — labellers • animint2 - Skip to contents - - -
-
-
- -
-

Labeller functions are in charge of formatting the strip labels of -facet grids and wraps. Most of them accept a multi_line -argument to control whether multiple factors (defined in formulae -such as ~first + second) should be displayed on a single -line separated with commas, or each on their own line.

-
- -
-

Usage

-
label_value(labels, multi_line = TRUE)
-
-label_both(labels, multi_line = TRUE, sep = ": ")
-
-label_context(labels, multi_line = TRUE, sep = ": ")
-
-label_parsed(labels, multi_line = TRUE)
-
-label_wrap_gen(width = 25, multi_line = TRUE)
-
- -
-

Arguments

-
labels
-

Data frame of labels. Usually contains only one -element, but facetting over multiple factors entails multiple -label variables.

- - -
multi_line
-

Whether to display the labels of multiple factors -on separate lines.

- - -
sep
-

String separating variables and values.

- - -
width
-

Maximum number of characters before wrapping the strip.

- -
-
-

Details

-

label_value() only displays the value of a factor while -label_both() displays both the variable name and the factor -value. label_context() is context-dependent and uses -label_value() for single factor facetting and -label_both() when multiple factors are -involved. label_wrap_gen() uses strwrap() -for line wrapping.

-

label_parsed() interprets the labels as plotmath -expressions. label_bquote() offers a more flexible -way of constructing plotmath expressions. See examples and -bquote() for details on the syntax of the -argument.

-
-
-

Writing New Labeller Functions

- - - -

Note that an easy way to write a labeller function is to - transform a function operating on character vectors with - as_labeller().

-

A labeller function accepts a data frame of labels (character - vectors) containing one column for each factor. Multiple factors - occur with formula of the type ~first + second.

-

The return value must be a rectangular list where each 'row' - characterises a single facet. The list elements can be either - character vectors or lists of plotmath expressions. When multiple - elements are returned, they get displayed on their own new lines - (i.e., each facet gets a multi-line strip of labels).

-

To illustrate, let's say your labeller returns a list of two - character vectors of length 3. This is a rectangular list because - all elements have the same length. The first facet will get the - first elements of each vector and display each of them on their - own line. Then the second facet gets the second elements of each - vector, and so on.

-

If it's useful to your labeller, you can retrieve the type - attribute of the incoming data frame of labels. The value of this - attribute reflects the kind of strips your labeller is dealing - with: "cols" for columns and "rows" for rows. Note - that facet_wrap() has columns by default and rows - when the strips are switched with the switch option. The - facet attribute also provides metadata on the labels. It - takes the values "grid" or "wrap".

-

For compatibility with labeller(), each labeller - function must have the labeller S3 class.

-
-
-

See also

- -
- -
-

Examples

-
mtcars$cyl2 <- factor(mtcars$cyl, labels = c("alpha", "beta", "gamma"))
-p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
-
-# Displaying only the values
-p + facet_grid(. ~ cyl)
-
-p + facet_grid(. ~ cyl, labeller = label_value)
-
-
-# \donttest{
-# Displaying both the values and the variables
-p + facet_grid(. ~ cyl, labeller = label_both)
-
-
-# Displaying only the values or both the values and variables
-# depending on whether multiple factors are facetted over
-p + facet_grid(am ~ vs+cyl, labeller = label_context)
-
-
-# Interpreting the labels as plotmath expressions
-p + facet_grid(. ~ cyl2)
-
-p + facet_grid(. ~ cyl2, labeller = label_parsed)
-
-p + facet_wrap(~vs + cyl2, labeller = label_parsed)
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/labs-1.png b/docs/reference/labs-1.png deleted file mode 100644 index 65487351b..000000000 Binary files a/docs/reference/labs-1.png and /dev/null differ diff --git a/docs/reference/labs-10.png b/docs/reference/labs-10.png deleted file mode 100644 index 68f4c1d57..000000000 Binary files a/docs/reference/labs-10.png and /dev/null differ diff --git a/docs/reference/labs-11.png b/docs/reference/labs-11.png deleted file mode 100644 index 859049b40..000000000 Binary files a/docs/reference/labs-11.png and /dev/null differ diff --git a/docs/reference/labs-12.png b/docs/reference/labs-12.png deleted file mode 100644 index 306923771..000000000 Binary files a/docs/reference/labs-12.png and /dev/null differ diff --git a/docs/reference/labs-2.png b/docs/reference/labs-2.png deleted file mode 100644 index c44e40728..000000000 Binary files a/docs/reference/labs-2.png and /dev/null differ diff --git a/docs/reference/labs-3.png b/docs/reference/labs-3.png deleted file mode 100644 index c44e40728..000000000 Binary files a/docs/reference/labs-3.png and /dev/null differ diff --git a/docs/reference/labs-4.png b/docs/reference/labs-4.png deleted file mode 100644 index 4b0363d8b..000000000 Binary files a/docs/reference/labs-4.png and /dev/null differ diff --git a/docs/reference/labs-5.png b/docs/reference/labs-5.png deleted file mode 100644 index 65487351b..000000000 Binary files a/docs/reference/labs-5.png and /dev/null differ diff --git a/docs/reference/labs-6.png b/docs/reference/labs-6.png deleted file mode 100644 index cec11596f..000000000 Binary files a/docs/reference/labs-6.png and /dev/null differ diff --git a/docs/reference/labs-7.png b/docs/reference/labs-7.png deleted file mode 100644 index cec11596f..000000000 Binary files a/docs/reference/labs-7.png and /dev/null differ diff --git a/docs/reference/labs-8.png b/docs/reference/labs-8.png deleted file mode 100644 index 02de4bc79..000000000 Binary files a/docs/reference/labs-8.png and /dev/null differ diff --git a/docs/reference/labs-9.png b/docs/reference/labs-9.png deleted file mode 100644 index 68f4c1d57..000000000 Binary files a/docs/reference/labs-9.png and /dev/null differ diff --git a/docs/reference/labs.html b/docs/reference/labs.html deleted file mode 100644 index 723fed9e8..000000000 --- a/docs/reference/labs.html +++ /dev/null @@ -1,152 +0,0 @@ - -Change axis labels, legend titles, plot title/subtitle and below-plot -caption. — labs • animint2 - Skip to contents - - -
-
-
- -
-

Change axis labels, legend titles, plot title/subtitle and below-plot -caption.

-
- -
-

Usage

-
labs(...)
-
-xlab(label)
-
-ylab(label)
-
-ggtitle(label, subtitle = NULL)
-
- -
-

Arguments

-
...
-

a list of new names in the form aesthetic = "new name"

- - -
label
-

The text for the axis, plot title or caption below the plot.

- - -
subtitle
-

the text for the subtitle for the plot which will be -displayed below the title. Leave NULL for no subtitle.

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
-p + labs(title = "New plot title")
-
-p + labs(x = "New x label")
-
-p + xlab("New x label")
-
-p + ylab("New y label")
-
-p + ggtitle("New plot title")
-
-
-# Can add a subtitle to plots with either of the following
-p + ggtitle("New plot title", subtitle = "A subtitle")
-
-p + labs(title = "New plot title", subtitle = "A subtitle")
-
-
-# Can add a plot caption underneath the whole plot (for sources, notes or
-# copyright), similar to the \code{sub} parameter in base R, with the
-# following
-p + labs(caption = "(based on data from ...)")
-
-
-# This should work independently of other functions that modify the
-# the scale names
-p + ylab("New y label") + ylim(2, 4)
-#> Warning: Removed 8 rows containing missing values (geom_point).
-
-p + ylim(2, 4) + ylab("New y label")
-#> Warning: Removed 8 rows containing missing values (geom_point).
-
-
-# The labs function also modifies legend labels
-p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point()
-p + labs(colour = "Cylinders")
-
-
-# Can also pass in a list, if that is more convenient
-p + labs(list(title = "Title", subtitle = "Subtitle", x = "X", y = "Y"))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/last_plot.html b/docs/reference/last_plot.html deleted file mode 100644 index 233a93921..000000000 --- a/docs/reference/last_plot.html +++ /dev/null @@ -1,84 +0,0 @@ - -Retrieve the last plot to be modified or created. — last_plot • animint2 - Skip to contents - - -
-
-
- -
-

Retrieve the last plot to be modified or created.

-
- -
-

Usage

-
last_plot()
-
- -
-

See also

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/layer-1.png b/docs/reference/layer-1.png deleted file mode 100644 index 1430e770c..000000000 Binary files a/docs/reference/layer-1.png and /dev/null differ diff --git a/docs/reference/layer-2.png b/docs/reference/layer-2.png deleted file mode 100644 index 1430e770c..000000000 Binary files a/docs/reference/layer-2.png and /dev/null differ diff --git a/docs/reference/layer-3.png b/docs/reference/layer-3.png deleted file mode 100644 index 4abc7b3a6..000000000 Binary files a/docs/reference/layer-3.png and /dev/null differ diff --git a/docs/reference/layer.html b/docs/reference/layer.html deleted file mode 100644 index 258a5c829..000000000 --- a/docs/reference/layer.html +++ /dev/null @@ -1,175 +0,0 @@ - -Create a new layer — layer • animint2 - Skip to contents - - -
-
-
- -
-

A layer is a combination of data, stat and geom with a potential position -adjustment. Usually layers are created using geom_* or stat_* -calls but it can also be created directly using this function.

-
- -
-

Usage

-
layer(
-  geom = NULL,
-  stat = NULL,
-  data = NULL,
-  mapping = NULL,
-  position = NULL,
-  params = list(),
-  inherit.aes = TRUE,
-  subset = NULL,
-  show.legend = NA
-)
-
- -
-

Arguments

-
geom
-

The geometric object to use display the data

- - -
stat
-

The statistical transformation to use on the data for this -layer, as a string.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
params
-

Additional parameters to the geom and stat.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- - -
subset
-

DEPRECATED. An older way of subsetting the dataset used in a -layer.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- -
- -
-

Examples

-
# geom calls are just a short cut for layer
-ggplot(mpg, aes(displ, hwy)) + geom_point()
-
-# shortcut for
-ggplot(mpg, aes(displ, hwy)) +
-  layer(geom = "point", stat = "identity", position = "identity",
-    params = list(na.rm = FALSE)
-  )
-
-
-# use a function as data to plot a subset of global data
-ggplot(mpg, aes(displ, hwy)) +
-  layer(geom = "point", stat = "identity", position = "identity",
-    data = head, params = list(na.rm = FALSE)
-  )
-
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/limits.html b/docs/reference/limits.html deleted file mode 100644 index e6de38857..000000000 --- a/docs/reference/limits.html +++ /dev/null @@ -1,185 +0,0 @@ - -Generate correct scale type for specified limits — limits • animint2 - Skip to contents - - -
-
-
- -
-

Generate correct scale type for specified limits

-
- -
-

Usage

-
limits(lims, var)
-
- -
-

Arguments

-
var
-

name of variable

- - -
limits
-

vector of limits

- -
- -
-

Examples

-
animint2:::limits(c(1, 5), "x")
-#> <ScaleContinuousPosition>
-#>  Range:  
-#>  Limits:    1 --    5
-animint2:::limits(c(5, 1), "x")
-#> <ScaleContinuousPosition>
-#>  Range:  
-#>  Limits:   -5 --   -1
-animint2:::limits(c("A", "b", "c"), "x")
-#> <gganimintproto object: Class ScaleDiscretePosition, ScaleDiscrete, Scale>
-#>     aesthetics: x xmin xmax xend
-#>     break_info: function
-#>     break_positions: function
-#>     breaks: waiver
-#>     call: call
-#>     clone: function
-#>     dimension: function
-#>     drop: TRUE
-#>     expand: waiver
-#>     get_breaks: function
-#>     get_breaks_minor: function
-#>     get_labels: function
-#>     get_limits: function
-#>     guide: none
-#>     is_discrete: function
-#>     is_empty: function
-#>     labels: waiver
-#>     limits: A b c
-#>     map: function
-#>     map_df: function
-#>     na.value: NA
-#>     name: waiver
-#>     palette: function
-#>     range: <gganimintproto object: Class RangeDiscrete, Range>
-#>         range: NULL
-#>         reset: function
-#>         train: function
-#>         super:  <gganimintproto object: Class RangeDiscrete, Range>
-#>     range_c: <gganimintproto object: Class RangeContinuous, Range>
-#>         range: NULL
-#>         reset: function
-#>         train: function
-#>         super:  <gganimintproto object: Class RangeContinuous, Range>
-#>     reset: function
-#>     scale_name: position_d
-#>     train: function
-#>     train_df: function
-#>     transform: function
-#>     transform_df: function
-#>     super:  <gganimintproto object: Class ScaleDiscretePosition, ScaleDiscrete, Scale>
-animint2:::limits(c("A", "b", "c"), "fill")
-#> <gganimintproto object: Class ScaleDiscrete, Scale>
-#>     aesthetics: fill
-#>     break_info: function
-#>     break_positions: function
-#>     breaks: waiver
-#>     call: call
-#>     clone: function
-#>     dimension: function
-#>     drop: TRUE
-#>     expand: waiver
-#>     get_breaks: function
-#>     get_breaks_minor: function
-#>     get_labels: function
-#>     get_limits: function
-#>     guide: legend
-#>     is_discrete: function
-#>     is_empty: function
-#>     labels: waiver
-#>     limits: A b c
-#>     map: function
-#>     map_df: function
-#>     na.value: grey50
-#>     name: waiver
-#>     palette: function
-#>     range: <gganimintproto object: Class RangeDiscrete, Range>
-#>         range: NULL
-#>         reset: function
-#>         train: function
-#>         super:  <gganimintproto object: Class RangeDiscrete, Range>
-#>     reset: function
-#>     scale_name: hue
-#>     train: function
-#>     train_df: function
-#>     transform: function
-#>     transform_df: function
-#>     super:  <gganimintproto object: Class ScaleDiscrete, Scale>
-animint2:::limits(as.Date(c("2008-01-01", "2009-01-01")), "x")
-#> <ScaleContinuousDate>
-#>  Range:  
-#>  Limits: 1.39e+04 -- 1.42e+04
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/lims-1.png b/docs/reference/lims-1.png deleted file mode 100644 index 862a5943a..000000000 Binary files a/docs/reference/lims-1.png and /dev/null differ diff --git a/docs/reference/lims-2.png b/docs/reference/lims-2.png deleted file mode 100644 index 40e2d2492..000000000 Binary files a/docs/reference/lims-2.png and /dev/null differ diff --git a/docs/reference/lims-3.png b/docs/reference/lims-3.png deleted file mode 100644 index ab8ca66fe..000000000 Binary files a/docs/reference/lims-3.png and /dev/null differ diff --git a/docs/reference/lims.html b/docs/reference/lims.html deleted file mode 100644 index 8b45052e9..000000000 --- a/docs/reference/lims.html +++ /dev/null @@ -1,181 +0,0 @@ - -Convenience functions to set the axis limits. — lims • animint2 - Skip to contents - - -
-
-
- -
-

Observations not in this range will be dropped completely and -not passed to any other layers. If a NA value is substituted for one of the -limits that limit is automatically calculated.

-
- -
-

Usage

-
lims(...)
-
-xlim(...)
-
-ylim(...)
-
- -
-

Arguments

-
...
-

If numeric, will create a continuous scale, if factor or -character, will create a discrete scale. For lims, every -argument must be named.

- -
-
-

See also

-

For changing x or y axis limits without dropping data - observations, see coord_cartesian.

-
- -
-

Examples

-
# xlim
-xlim(15, 20)
-#> <ScaleContinuousPosition>
-#>  Range:  
-#>  Limits:   15 --   20
-xlim(20, 15)
-#> <ScaleContinuousPosition>
-#>  Range:  
-#>  Limits:  -20 --  -15
-xlim(c(10, 20))
-#> <ScaleContinuousPosition>
-#>  Range:  
-#>  Limits:   10 --   20
-xlim("a", "b", "c")
-#> <gganimintproto object: Class ScaleDiscretePosition, ScaleDiscrete, Scale>
-#>     aesthetics: x xmin xmax xend
-#>     break_info: function
-#>     break_positions: function
-#>     breaks: waiver
-#>     call: call
-#>     clone: function
-#>     dimension: function
-#>     drop: TRUE
-#>     expand: waiver
-#>     get_breaks: function
-#>     get_breaks_minor: function
-#>     get_labels: function
-#>     get_limits: function
-#>     guide: none
-#>     is_discrete: function
-#>     is_empty: function
-#>     labels: waiver
-#>     limits: a b c
-#>     map: function
-#>     map_df: function
-#>     na.value: NA
-#>     name: waiver
-#>     palette: function
-#>     range: <gganimintproto object: Class RangeDiscrete, Range>
-#>         range: NULL
-#>         reset: function
-#>         train: function
-#>         super:  <gganimintproto object: Class RangeDiscrete, Range>
-#>     range_c: <gganimintproto object: Class RangeContinuous, Range>
-#>         range: NULL
-#>         reset: function
-#>         train: function
-#>         super:  <gganimintproto object: Class RangeContinuous, Range>
-#>     reset: function
-#>     scale_name: position_d
-#>     train: function
-#>     train_df: function
-#>     transform: function
-#>     transform_df: function
-#>     super:  <gganimintproto object: Class ScaleDiscretePosition, ScaleDiscrete, Scale>
-
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point() +
-  xlim(15, 20)
-#> Warning: Removed 19 rows containing missing values (geom_point).
-
-# with automatic lower limit
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point() +
-  xlim(NA, 20)
-#> Warning: Removed 14 rows containing missing values (geom_point).
-
-
-# Change both xlim and ylim
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point() +
-  lims(x = c(10, 20), y = c(3, 5))
-#> Warning: Removed 18 rows containing missing values (geom_point).
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/luv_colours.html b/docs/reference/luv_colours.html deleted file mode 100644 index e5d569420..000000000 --- a/docs/reference/luv_colours.html +++ /dev/null @@ -1,85 +0,0 @@ - -colors() in Luv space. — luv_colours • animint2 - Skip to contents - - -
-
-
- -
-

All built-in colors() translated into Luv colour space.

-
- -
-

Usage

-
luv_colours
-
- -
-

Format

-

A data frame with 657 observations and 4 variables:

  • L,u,vPosition in Luv colour space

  • -
  • colColour name

  • -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/make_bar.html b/docs/reference/make_bar.html deleted file mode 100644 index e8dfbcd7e..000000000 --- a/docs/reference/make_bar.html +++ /dev/null @@ -1,110 +0,0 @@ - -Convenience function for an interactive bar that might otherwise be -created using stat_summary(geom="bar"). — make_bar • animint2 - Skip to contents - - -
-
-
- -
-

Convenience function for an interactive bar that might otherwise be -created using stat_summary(geom="bar").

-
- -
-

Usage

-
make_bar(data, x.name, alpha = 1)
-
- -
-

Arguments

-
data
-

data.frame to analyze for unique x.name values.

- - -
x.name
-

variable to be used for x, clickSelects.

- - -
alpha
-

transparency of selected bar, default 1.

- -
-
-

Value

- - -

a geom_bar layer.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/make_tallrect.html b/docs/reference/make_tallrect.html deleted file mode 100644 index ac7cf590f..000000000 --- a/docs/reference/make_tallrect.html +++ /dev/null @@ -1,124 +0,0 @@ - -Make a clickSelects geom_tallrect that completely tiles the x -range. This makes it easy to construct tallrects for the common -case of selecting a particular x value. — make_tallrect • animint2 - Skip to contents - - -
-
-
- -
-

Make a clickSelects geom_tallrect that completely tiles the x -range. This makes it easy to construct tallrects for the common -case of selecting a particular x value.

-
- -
-

Usage

-
make_tallrect(data, x.name, even = FALSE, alpha = 1/2, ...)
-
- -
-

Arguments

-
data
-

data.frame to analyze for unique x.name values.

- - -
x.name
-

variable to be used for x, clickSelects.

- - -
even
-

Logical parameter, should tallrects be of even width?

- - -
alpha
-

transparency of a selected tallrect, default 1/2.

- - -
...
-

passed to geom_tallrect.

- -
-
-

Value

- - -

a geom_tallrect layer.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/make_tallrect_or_widerect.html b/docs/reference/make_tallrect_or_widerect.html deleted file mode 100644 index d05c2ae45..000000000 --- a/docs/reference/make_tallrect_or_widerect.html +++ /dev/null @@ -1,148 +0,0 @@ - -Make a clickSelects geom_widerect or geom_tallrect that completely -tiles the x or y range. This function is used internally by -make_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect • animint2 - Skip to contents - - -
-
-
- -
-

Make a clickSelects geom_widerect or geom_tallrect that completely -tiles the x or y range. This function is used internally by -make_tallrect or make_widerect, which are more user-friendly.

-
- -
-

Usage

-
make_tallrect_or_widerect(
-  aes.prefix,
-  geom_xrect,
-  data,
-  var.name,
-  even = FALSE,
-  alpha = 0.5,
-  ...,
-  data.fun = identity
-)
-
- -
-

Arguments

-
aes.prefix
-

"x" or "y"

- - -
geom_xrect
-

geom_tallrect or geom_widerect

- - -
data
-

data.frame to analyze for unique var.name values.

- - -
var.name
-

variable to be used for clickSelects

- - -
even
-

Logical parameter, should xrects be of even width?

- - -
alpha
-

transparency of a selected xrect, default 1/2.

- - -
...
-

passed to geom_xrect

- - -
data.fun
-

called on data passed to geom_xrect(aes(..), -data.fun(df)) this is useful in facetted plots, for adding -columns to the data.frame, if you want that geom in only one -panel.

- -
-
-

Value

- - -

a geom_xrect layer

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/make_text.html b/docs/reference/make_text.html deleted file mode 100644 index 72552f1fc..000000000 --- a/docs/reference/make_text.html +++ /dev/null @@ -1,112 +0,0 @@ - -Convenvience function for a showSelected plot label. — make_text • animint2 - Skip to contents - - -
-
-
- -
-

Convenvience function for a showSelected plot label.

-
- -
-

Usage

-
make_text(data, x, y, label.var, format = NULL)
-
- -
-

Arguments

-
data
-

data.frame of relevant data

- - -
x
-

x coordinate of label position

- - -
y
-

y coordinate of label position

- - -
label.var
-

variable matching showSelected, used to obtain label value

- - -
format
-

String format for label. Use %d, %f, etc. to insert relevant label.var value.

- -
-
-

Value

- - -

a geom_text layer.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/make_widerect.html b/docs/reference/make_widerect.html deleted file mode 100644 index cc1921231..000000000 --- a/docs/reference/make_widerect.html +++ /dev/null @@ -1,124 +0,0 @@ - -Make a clickSelects geom_widerect that completely tiles the y -range. This makes it easy to construct widerects for the common -case of selecting a particular y value. — make_widerect • animint2 - Skip to contents - - -
-
-
- -
-

Make a clickSelects geom_widerect that completely tiles the y -range. This makes it easy to construct widerects for the common -case of selecting a particular y value.

-
- -
-

Usage

-
make_widerect(data, y.name, even = FALSE, alpha = 0.5, ...)
-
- -
-

Arguments

-
data
-

data.frame to analyze for unique y.name values.

- - -
y.name
-

variable to be used for y, clickSelects.

- - -
even
-

Logical parameter, should widerects be of even width?

- - -
alpha
-

transparency of a selected widerect, default 1/2.

- - -
...
-

passed to geom_widerect.

- -
-
-

Value

- - -

a geom_widerect layer.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/malaria.html b/docs/reference/malaria.html deleted file mode 100644 index 109cd923a..000000000 --- a/docs/reference/malaria.html +++ /dev/null @@ -1,111 +0,0 @@ - -Malaria parasite genome variants — malaria • animint2 - Skip to contents - - -
-
-
- -
-

Two sequencing methods were used to measure genetic variants in - malaria parasite yoelii yoelii, strain N67. High quality gold standard - Sanger sequences were obtained for 45 amplicons, a small subset of the - 14-chromosome genome. Next generation sequencing (NGS) was used to - find genome-wide variants, but there is a lot more noise and so some - false positive variants need to be filtered via thresholding the MQ score.

-
- -
-

Usage

-
data("malaria")
-
- -
-

Format

-

List of 8 data.frames: - $ error.variants :'data.frame': 18800 obs. of 19 variables: - $ regions :'data.frame': 14 obs. of 6 variables: - $ amplicons :'data.frame': 45 obs. of 8 variables: - $ chroms :'data.frame': 14 obs. of 2 variables: - $ error.amplicons :'data.frame': 1800 obs. of 11 variables: - $ filterVar.labels:'data.frame': 40 obs. of 3 variables: - $ error.curves :'data.frame': 120 obs. of 4 variables: - $ filterVar :'data.frame': 1 obs. of 2 variables:

-
-
-

Source

-

https://github.com/tdhock/malaria-evolution-viz

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/map_data-1.png b/docs/reference/map_data-1.png deleted file mode 100644 index 1fec45b1c..000000000 Binary files a/docs/reference/map_data-1.png and /dev/null differ diff --git a/docs/reference/map_data.html b/docs/reference/map_data.html deleted file mode 100644 index 344aac013..000000000 --- a/docs/reference/map_data.html +++ /dev/null @@ -1,126 +0,0 @@ - -Create a data frame of map data. — map_data • animint2 - Skip to contents - - -
-
-
- -
-

Create a data frame of map data.

-
- -
-

Usage

-
map_data(map, region = ".", exact = FALSE, ...)
-
- -
-

Arguments

-
map
-

name of map provided by the maps package. These -include county, france, -italy, nz, -state, usa, -world, world2.

- - -
region
-

name of subregions to include. Defaults to . which -includes all subregion. See documentation for map -for more details.

- - -
exact
-

should the region be treated as a regular expression -(FALSE) or as a fixed string (TRUE).

- - -
...
-

all other arguments passed on to map

- -
- -
-

Examples

-
if (require("maps")) {
-states <- map_data("state")
-arrests <- USArrests
-names(arrests) <- tolower(names(arrests))
-arrests$region <- tolower(rownames(USArrests))
-
-choro <- merge(states, arrests, sort = FALSE, by = "region")
-choro <- choro[order(choro$order), ]
-ggplot(choro, aes(long, lat)) +
-  geom_polygon(aes(group = group, fill = assault)) +
-  coord_map("albers",  at0 = 45.5, lat1 = 29.5)
-
-ggplot(choro, aes(long, lat)) +
-  geom_polygon(aes(group = group, fill = assault / murder)) +
-  coord_map("albers",  at0 = 45.5, lat1 = 29.5)
-}
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/margin.html b/docs/reference/margin.html deleted file mode 100644 index f023164bf..000000000 --- a/docs/reference/margin.html +++ /dev/null @@ -1,104 +0,0 @@ - -Define margins. — margin • animint2 - Skip to contents - - -
-
-
- -
-

This is a convenient function that creates a grid unit object of the -correct length to use for setting margins.

-
- -
-

Usage

-
margin(t = 0, r = 0, b = 0, l = 0, unit = "pt")
-
- -
-

Arguments

-
t, r, b, l
-

Dimensions of each margin. (To remember order, think trouble).

- - -
unit
-

Default units of dimensions. Defaults to "pt" so it -can be most easily scaled with the text.

- -
- -
-

Examples

-
margin(4)
-#> [1] 4points 0points 0points 0points
-margin(4, 2)
-#> [1] 4points 2points 0points 0points
-margin(4, 3, 2, 1)
-#> [1] 4points 3points 2points 1points
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/mean_se.html b/docs/reference/mean_se.html deleted file mode 100644 index 4572ec207..000000000 --- a/docs/reference/mean_se.html +++ /dev/null @@ -1,94 +0,0 @@ - -Calculate mean and standard errors on either side. — mean_se • animint2 - Skip to contents - - -
-
-
- -
-

Calculate mean and standard errors on either side.

-
- -
-

Usage

-
mean_se(x, mult = 1)
-
- -
-

Arguments

-
x
-

numeric vector

- - -
mult
-

number of multiples of standard error

- -
-
-

See also

-

for use with stat_summary

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/merge_recurse.html b/docs/reference/merge_recurse.html deleted file mode 100644 index 36fd6ffbd..000000000 --- a/docs/reference/merge_recurse.html +++ /dev/null @@ -1,92 +0,0 @@ - -Merge a list of data frames. — merge_recurse • animint2 - Skip to contents - - -
-
-
- -
-

Merge a list of data frames.

-
- -
-

Usage

-
merge_recurse(dfs)
-
- -
-

Arguments

-
dfs
-

list of data frames

- -
-
-

Value

- - -

data frame

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/midwest.html b/docs/reference/midwest.html deleted file mode 100644 index 564f72f2b..000000000 --- a/docs/reference/midwest.html +++ /dev/null @@ -1,111 +0,0 @@ - -Midwest demographics. — midwest • animint2 - Skip to contents - - -
-
-
- -
-

Demographic information of midwest counties

-
- -
-

Usage

-
midwest
-
- -
-

Format

-

A data frame with 437 rows and 28 variables

  • PID

  • -
  • county

  • -
  • state

  • -
  • area

  • -
  • poptotal. Total population

  • -
  • popdensity. Population density

  • -
  • popwhite. Number of whites.

  • -
  • popblack. Number of blacks.

  • -
  • popamerindian. Number of American Indians.

  • -
  • popasian. Number of Asians.

  • -
  • popother. Number of other races.

  • -
  • percwhite. Percent white.

  • -
  • percblack. Percent black.

  • -
  • percamerindan. Percent American Indian.

  • -
  • percasian. Percent Asian.

  • -
  • percother. Percent other races.

  • -
  • popadults. Number of adults.

  • -
  • perchsd.

  • -
  • percollege. Percent college educated.

  • -
  • percprof. Percent profession.

  • -
  • poppovertyknown.

  • -
  • percpovertyknown

  • -
  • percbelowpoverty

  • -
  • percchildbelowpovert

  • -
  • percadultpoverty

  • -
  • percelderlypoverty

  • -
  • inmetro. In a metro area.

  • -
  • category'

  • -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/mixtureKNN.html b/docs/reference/mixtureKNN.html deleted file mode 100644 index 3379122f3..000000000 --- a/docs/reference/mixtureKNN.html +++ /dev/null @@ -1,92 +0,0 @@ - -K-Nearest-Neighbors model of the mixture example data — mixtureKNN • animint2 - Skip to contents - - -
-
-
- -
-

Several KNN models were fit to the mixture example data set.

-
- -
-

Usage

-
data("mixtureKNN")
-
- -
-

Format

-

Named list of 9 data.frames.

-
-
-

Source

-

animint/inst/examples/knn.R

-
-
-

References

-

help(mixture.example, package="ElemStatLearn")

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/montreal.bikes.html b/docs/reference/montreal.bikes.html deleted file mode 100644 index 116d24f68..000000000 --- a/docs/reference/montreal.bikes.html +++ /dev/null @@ -1,93 +0,0 @@ - -Montreal bikes — montreal.bikes • animint2 - Skip to contents - - -
-
-
- -
-

Data on montreal bike usage, paths, and accidents, 2009-2014.

-
- -
-

Usage

-
data("montreal.bikes")
-
- -
-

Format

-

A named list of four data.frames. counter.counts contains dates - and counts of bikes at several locations in - Montreal. counter.locations has the geographical coordinates of the - counter locations. path.locations has the geographical coordinates of - several Montreal bike paths. accidents has - dates/times/locations/severity of accidents involving bikes.

-
-
-

Source

-

github.com/tdhock/montreal-velos

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/mpg.html b/docs/reference/mpg.html deleted file mode 100644 index 8e7174952..000000000 --- a/docs/reference/mpg.html +++ /dev/null @@ -1,103 +0,0 @@ - -Fuel economy data from 1999 and 2008 for 38 popular models of car — mpg • animint2 - Skip to contents - - -
-
-
- -
-

This dataset contains a subset of the fuel economy data that the EPA makes -available on https://fueleconomy.gov. It contains only models which -had a new release every year between 1999 and 2008 - this was used as a -proxy for the popularity of the car.

-
- -
-

Usage

-
mpg
-
- -
-

Format

-

A data frame with 234 rows and 11 variables

  • manufacturer.

  • -
  • model.

  • -
  • displ. engine displacement, in litres

  • -
  • year.

  • -
  • cyl. number of cylinders

  • -
  • trans. type of transmission

  • -
  • drv. f = front-wheel drive, r = rear wheel drive, 4 = 4wd

  • -
  • cty. city miles per gallon

  • -
  • hwy. highway miles per gallon

  • -
  • fl.

  • -
  • class.

  • -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/msleep.html b/docs/reference/msleep.html deleted file mode 100644 index ae38be666..000000000 --- a/docs/reference/msleep.html +++ /dev/null @@ -1,111 +0,0 @@ - -An updated and expanded version of the mammals sleep dataset. — msleep • animint2 - Skip to contents - - -
-
-
- -
-

This is an updated and expanded version of the mammals sleep dataset. -Updated sleep times and weights were taken from V. M. Savage and G. B. -West. A quantitative, theoretical framework for understanding mammalian -sleep. Proceedings of the National Academy of Sciences, 104 (3):1051-1056, -2007.

-
- -
-

Usage

-
msleep
-
- -
-

Format

-

A data frame with 83 rows and 11 variables

  • name. common name

  • -
  • genus.

  • -
  • vore. carnivore, omnivore or herbivore?

  • -
  • order.

  • -
  • conservation. the conservation status of the animal

  • -
  • sleep_total. total amount of sleep, in hours

  • -
  • sleep_rem. rem sleep, in hours

  • -
  • sleep_cycle. length of sleep cycle, in hours

  • -
  • awake. amount of time spent awake, in hours

  • -
  • brainwt. brain weight in kilograms

  • -
  • bodywt. body weight in kilograms

  • -
-
-

Details

-

Additional variables order, conservation status and vore were added from -wikipedia.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/newEnvironment.html b/docs/reference/newEnvironment.html deleted file mode 100644 index c156b022e..000000000 --- a/docs/reference/newEnvironment.html +++ /dev/null @@ -1,89 +0,0 @@ - -Environment to store meta data — newEnvironment • animint2 - Skip to contents - - -
-
-
- -
-

Get a new environment to store meta-data. Used to alter state in the -lower-level functions

-
- -
-

Usage

-
newEnvironment()
-
- -
-

Value

- - -

A new environment to store meta data

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/parsePlot.html b/docs/reference/parsePlot.html deleted file mode 100644 index b280ab1c8..000000000 --- a/docs/reference/parsePlot.html +++ /dev/null @@ -1,100 +0,0 @@ - -Convert a ggplot to a list. — parsePlot • animint2 - Skip to contents - - -
-
-
- -
-

Convert a ggplot to a list.

-
- -
-

Usage

-
parsePlot(meta, plot, plot.name)
-
- -
-

Arguments

-
meta
-

environment with previously calculated plot data, and a new plot to parse, already stored in plot and plot.name.

- - -
plot
-

ggplot list object

- - -
plot.name
-

name of plot

- -
-
-

Value

- - -

nothing, info is stored in meta.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/pirates.html b/docs/reference/pirates.html deleted file mode 100644 index 8b6cbb3ad..000000000 --- a/docs/reference/pirates.html +++ /dev/null @@ -1,133 +0,0 @@ - -Worldwide pirate attacks from 1978 to 2013 — pirates • animint2 - Skip to contents - - -
-
-
- -
-

Each row is 1 pirate attack, with geographic location and - textual descriptions.

-
- -
-

Usage

-
data(pirates)
-
- -
-

Format

-

A data frame with 6636 observations on the following 14 variables.

Reference
-

factor

- -
DateOfOcc
-

a Date

- -
SubReg
-

factor

- -
Aggressor
-

factor

- -
Victim
-

factor

- -
Descript
-

factor

- -
Desc1
-

factor

- -
Desc2
-

factor

- -
Desc3
-

factor

- -
Desc4
-

factor

- -
Desc5
-

factor

- -
Desc6
-

factor

- -
coords.x1
-

a numeric vector

- -
coords.x2
-

a numeric vector

- - -
-
-

Source

-

http://msi.nga.mil/MSISiteContent/StaticFiles/Files/ASAM_shp.zip

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/position_dodge-1.png b/docs/reference/position_dodge-1.png deleted file mode 100644 index 6b1e7b3a8..000000000 Binary files a/docs/reference/position_dodge-1.png and /dev/null differ diff --git a/docs/reference/position_dodge-2.png b/docs/reference/position_dodge-2.png deleted file mode 100644 index 52db4ef3d..000000000 Binary files a/docs/reference/position_dodge-2.png and /dev/null differ diff --git a/docs/reference/position_dodge-3.png b/docs/reference/position_dodge-3.png deleted file mode 100644 index e1eaaede4..000000000 Binary files a/docs/reference/position_dodge-3.png and /dev/null differ diff --git a/docs/reference/position_dodge-4.png b/docs/reference/position_dodge-4.png deleted file mode 100644 index 54bbfae65..000000000 Binary files a/docs/reference/position_dodge-4.png and /dev/null differ diff --git a/docs/reference/position_dodge-5.png b/docs/reference/position_dodge-5.png deleted file mode 100644 index 536a56af7..000000000 Binary files a/docs/reference/position_dodge-5.png and /dev/null differ diff --git a/docs/reference/position_dodge-6.png b/docs/reference/position_dodge-6.png deleted file mode 100644 index a4f374e30..000000000 Binary files a/docs/reference/position_dodge-6.png and /dev/null differ diff --git a/docs/reference/position_dodge-7.png b/docs/reference/position_dodge-7.png deleted file mode 100644 index 721d397ea..000000000 Binary files a/docs/reference/position_dodge-7.png and /dev/null differ diff --git a/docs/reference/position_dodge.html b/docs/reference/position_dodge.html deleted file mode 100644 index 010c16607..000000000 --- a/docs/reference/position_dodge.html +++ /dev/null @@ -1,137 +0,0 @@ - -Adjust position by dodging overlaps to the side. — position_dodge • animint2 - Skip to contents - - -
-
-
- -
-

Adjust position by dodging overlaps to the side.

-
- -
-

Usage

-
position_dodge(width = NULL)
-
- -
-

Arguments

-
width
-

Dodging width, when different to the width of the individual -elements. This is useful when you want to align narrow geoms with wider -geoms. See the examples for a use case.

- -
-
-

See also

- -
- -
-

Examples

-
ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
-  geom_bar(position = "dodge")
-
-# \donttest{
-ggplot(diamonds, aes(price, fill = cut)) +
-  geom_histogram(position="dodge")
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-
-# To dodge items with different widths, you need to be explicit
-df <- data.frame(x = c("a","a","b","b"), y = 2:5, g = rep(1:2, 2))
-p <- ggplot(df, aes(x, y, group = g)) +
-  geom_bar(
-    stat = "identity", position = "dodge",
-    fill = "grey50", colour = "black"
-  )
-p
-
-
-# A line range has no width:
-p + geom_linerange(aes(ymin = y-1, ymax = y+1), position = "dodge")
-#> Warning: Width not defined. Set with `position_dodge(width = ?)`
-
-# You need to explicitly specify the width for dodging
-p + geom_linerange(aes(ymin = y-1, ymax = y+1),
-  position = position_dodge(width = 0.9))
-
-
-# Similarly with error bars:
-p + geom_errorbar(aes(ymin = y-1, ymax = y+1), width = 0.2,
-  position = "dodge")
-
-p + geom_errorbar(aes(ymin = y-1, ymax = y+1, width = 0.2),
-  position = position_dodge(width = 0.90))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/position_identity.html b/docs/reference/position_identity.html deleted file mode 100644 index ffb5b8c57..000000000 --- a/docs/reference/position_identity.html +++ /dev/null @@ -1,89 +0,0 @@ - -Don't adjust position — position_identity • animint2 - Skip to contents - - -
-
-
- -
-

Don't adjust position

-
- -
-

Usage

-
position_identity()
-
- -
-

See also

-

Other position adjustments: -position_dodge(), -position_fill(), -position_jitterdodge(), -position_jitter(), -position_nudge()

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/position_jitter-1.png b/docs/reference/position_jitter-1.png deleted file mode 100644 index 7d4b8f417..000000000 Binary files a/docs/reference/position_jitter-1.png and /dev/null differ diff --git a/docs/reference/position_jitter-2.png b/docs/reference/position_jitter-2.png deleted file mode 100644 index 43a35e339..000000000 Binary files a/docs/reference/position_jitter-2.png and /dev/null differ diff --git a/docs/reference/position_jitter-3.png b/docs/reference/position_jitter-3.png deleted file mode 100644 index ece48d719..000000000 Binary files a/docs/reference/position_jitter-3.png and /dev/null differ diff --git a/docs/reference/position_jitter-4.png b/docs/reference/position_jitter-4.png deleted file mode 100644 index a7e3b69f8..000000000 Binary files a/docs/reference/position_jitter-4.png and /dev/null differ diff --git a/docs/reference/position_jitter.html b/docs/reference/position_jitter.html deleted file mode 100644 index fb15e78ee..000000000 --- a/docs/reference/position_jitter.html +++ /dev/null @@ -1,120 +0,0 @@ - -Jitter points to avoid overplotting. — position_jitter • animint2 - Skip to contents - - -
-
-
- -
-

Jitter points to avoid overplotting.

-
- -
-

Usage

-
position_jitter(width = NULL, height = NULL)
-
- -
-

Arguments

-
width, height
-

Amount of vertical and horizontal jitter. The jitter - is added in both positive and negative directions, so the total spread - is twice the value specified here.

-

If omitted, defaults to 40% of the resolution of the data: this means the - jitter values will occupy 80% of the implied bins. Categorical data - is aligned on the integers, so a width or height of 0.5 will spread the - data so it's not possible to see the distinction between the categories.

- -
-
-

See also

- -
- -
-

Examples

-
ggplot(mtcars, aes(am, vs)) + geom_point()
-
-
-# Default amount of jittering will generally be too much for
-# small datasets:
-ggplot(mtcars, aes(am, vs)) + geom_jitter()
-
-
-# Two ways to override
-ggplot(mtcars, aes(am, vs)) +
-  geom_jitter(width = 0.1, height = 0.1)
-
-ggplot(mtcars, aes(am, vs)) +
-  geom_jitter(position = position_jitter(width = 0.1, height = 0.1))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/position_jitterdodge.html b/docs/reference/position_jitterdodge.html deleted file mode 100644 index b23500d3c..000000000 --- a/docs/reference/position_jitterdodge.html +++ /dev/null @@ -1,109 +0,0 @@ - -Adjust position by simultaneously dodging and jittering — position_jitterdodge • animint2 - Skip to contents - - -
-
-
- -
-

Adjust position by simultaneously dodging and jittering

-
- -
-

Usage

-
position_jitterdodge(
-  jitter.width = NULL,
-  jitter.height = 0,
-  dodge.width = 0.75
-)
-
- -
-

Arguments

-
jitter.width
-

degree of jitter in x direction. Defaults to 40% of the -resolution of the data.

- - -
jitter.height
-

degree of jitter in y direction. Defaults to 0.

- - -
dodge.width
-

the amount to dodge in the x direction. Defaults to 0.75, -the default position_dodge() width.

- -
-
-

See also

-

Other position adjustments: -position_dodge(), -position_fill(), -position_identity(), -position_jitter(), -position_nudge()

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/position_nudge-1.png b/docs/reference/position_nudge-1.png deleted file mode 100644 index 8bad76a66..000000000 Binary files a/docs/reference/position_nudge-1.png and /dev/null differ diff --git a/docs/reference/position_nudge-2.png b/docs/reference/position_nudge-2.png deleted file mode 100644 index 0e60e8c50..000000000 Binary files a/docs/reference/position_nudge-2.png and /dev/null differ diff --git a/docs/reference/position_nudge.html b/docs/reference/position_nudge.html deleted file mode 100644 index 7a0ed0206..000000000 --- a/docs/reference/position_nudge.html +++ /dev/null @@ -1,116 +0,0 @@ - -Nudge points. — position_nudge • animint2 - Skip to contents - - -
-
-
- -
-

This is useful if you want to nudge labels a little ways from their -points.

-
- -
-

Usage

-
position_nudge(x = 0, y = 0)
-
- -
-

Arguments

-
x, y
-

Amount of vertical and horizontal distance to move.

- -
-
-

See also

- -
- -
-

Examples

-
df <- data.frame(
-  x = c(1,3,2,5),
-  y = c("a","c","d","c")
-)
-
-ggplot(df, aes(x, y)) +
-  geom_point() +
-  geom_text(aes(label = y))
-
-
-ggplot(df, aes(x, y)) +
-  geom_point() +
-  geom_text(aes(label = y), position = position_nudge(y = -0.1))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/position_stack-1.png b/docs/reference/position_stack-1.png deleted file mode 100644 index bbd1b99f9..000000000 Binary files a/docs/reference/position_stack-1.png and /dev/null differ diff --git a/docs/reference/position_stack-2.png b/docs/reference/position_stack-2.png deleted file mode 100644 index e0b568857..000000000 Binary files a/docs/reference/position_stack-2.png and /dev/null differ diff --git a/docs/reference/position_stack-3.png b/docs/reference/position_stack-3.png deleted file mode 100644 index 3a28ae39c..000000000 Binary files a/docs/reference/position_stack-3.png and /dev/null differ diff --git a/docs/reference/position_stack-4.png b/docs/reference/position_stack-4.png deleted file mode 100644 index 8d40f7ab8..000000000 Binary files a/docs/reference/position_stack-4.png and /dev/null differ diff --git a/docs/reference/position_stack-5.png b/docs/reference/position_stack-5.png deleted file mode 100644 index 99c9a367b..000000000 Binary files a/docs/reference/position_stack-5.png and /dev/null differ diff --git a/docs/reference/position_stack-6.png b/docs/reference/position_stack-6.png deleted file mode 100644 index 884dd1e28..000000000 Binary files a/docs/reference/position_stack-6.png and /dev/null differ diff --git a/docs/reference/position_stack-7.png b/docs/reference/position_stack-7.png deleted file mode 100644 index 45582c27a..000000000 Binary files a/docs/reference/position_stack-7.png and /dev/null differ diff --git a/docs/reference/position_stack-8.png b/docs/reference/position_stack-8.png deleted file mode 100644 index 59cc3cfa2..000000000 Binary files a/docs/reference/position_stack-8.png and /dev/null differ diff --git a/docs/reference/position_stack.html b/docs/reference/position_stack.html deleted file mode 100644 index fda1ddd3a..000000000 --- a/docs/reference/position_stack.html +++ /dev/null @@ -1,141 +0,0 @@ - -Stack overlapping objects on top of one another. — position_fill • animint2 - Skip to contents - - -
-
-
- -
-

position_fill additionally standardises each stack to have unit -height.

-
- -
-

Usage

-
position_fill()
-
-position_stack()
-
- -
-

See also

-

See geom_bar and geom_area for - more examples.

-

Other position adjustments: -position_dodge(), -position_identity(), -position_jitterdodge(), -position_jitter(), -position_nudge()

-
- -
-

Examples

-
# Stacking is the default behaviour for most area plots:
-ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar()
-
-# Fill makes it easier to compare proportions
-ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
-  geom_bar(position = "fill")
-
-
-# To change stacking order, use factor() to change order of levels
-mtcars$vs <- factor(mtcars$vs, levels = c(1,0))
-ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar()
-
-
-ggplot(diamonds, aes(price, fill = cut)) +
-  geom_histogram(binwidth = 500)
-
-# When used with a histogram, position_fill creates a conditional density
-# estimate
-ggplot(diamonds, aes(price, fill = cut)) +
-  geom_histogram(binwidth = 500, position = "fill")
-
-
-# Stacking is also useful for time series
-data.set <- data.frame(
-  Time = c(rep(1, 4),rep(2, 4), rep(3, 4), rep(4, 4)),
-  Type = rep(c('a', 'b', 'c', 'd'), 4),
-  Value = rpois(16, 10)
-)
-
-ggplot(data.set, aes(Time, Value)) + geom_area(aes(fill = Type))
-
-
-# If you want to stack lines, you need to say so:
-ggplot(data.set, aes(Time, Value)) + geom_line(aes(colour = Type))
-
-ggplot(data.set, aes(Time, Value)) +
-  geom_line(position = "stack", aes(colour = Type))
-
-
-# But realise that this makes it *much* harder to compare individual
-# trends
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/presidential.html b/docs/reference/presidential.html deleted file mode 100644 index 618ca21f2..000000000 --- a/docs/reference/presidential.html +++ /dev/null @@ -1,87 +0,0 @@ - -Terms of 11 presidents from Eisenhower to Obama. — presidential • animint2 - Skip to contents - - -
-
-
- -
-

The names of each president, the start and end date of their term, and -their party of 11 US presidents from Eisenhower to Obama.

-
- -
-

Usage

-
presidential
-
- -
-

Format

-

A data frame with 11 rows and 4 variables

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/print.animint.html b/docs/reference/print.animint.html deleted file mode 100644 index d4eb0bb62..000000000 --- a/docs/reference/print.animint.html +++ /dev/null @@ -1,102 +0,0 @@ - -print animint — print.animint • animint2 - Skip to contents - - -
-
-
- -
-

Print animint by rendering to local directory.

-
- -
-

Usage

-
# S3 method for animint
-print(x, ...)
-
- -
-

Arguments

-
x
-

List of ggplots and options. In particular the out.dir -option is passed along to animint2dir.

- - -
...
-

passed to animint2dir

- -
-
-

Value

- - -

same as animint2dir

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/print.gganimintplot.html b/docs/reference/print.gganimintplot.html deleted file mode 100644 index 9ebccd47b..000000000 --- a/docs/reference/print.gganimintplot.html +++ /dev/null @@ -1,110 +0,0 @@ - -Draw plot on current graphics device. — print.gganimintplot • animint2 - Skip to contents - - -
-
-
- -
-

Draw plot on current graphics device.

-
- -
-

Usage

-
# S3 method for gganimintplot
-print(x, newpage = is.null(vp), vp = NULL, ...)
-
-# S3 method for gganimintplot
-plot(x, newpage = is.null(vp), vp = NULL, ...)
-
- -
-

Arguments

-
x
-

plot to display

- - -
newpage
-

draw new (empty) page first?

- - -
vp
-

viewport to draw plot in

- - -
...
-

other arguments not used by this method

- -
-
-

Value

- - -

Invisibly returns the result of ggplot_build, which - is a list with components that contain the plot itself, the data, - information about the scales, panels etc.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/print.gganimintproto.html b/docs/reference/print.gganimintproto.html deleted file mode 100644 index b5e17d44f..000000000 --- a/docs/reference/print.gganimintproto.html +++ /dev/null @@ -1,103 +0,0 @@ - -Print a gganimintproto object — print.gganimintproto • animint2 - Skip to contents - - -
-
-
- -
-

If a gganimintproto object has a $print method, this will call that method. -Otherwise, it will print out the members of the object, and optionally, the -members of the inherited objects.

-
- -
-

Usage

-
# S3 method for gganimintproto
-print(x, ..., flat = TRUE)
-
- -
-

Arguments

-
x
-

A gganimintproto object to print.

- - -
...
-

If the gganimintproto object has a print method, further arguments -will be passed to it. Otherwise, these arguments are unused.

- - -
flat
-

If TRUE (the default), show a flattened list of all local -and inherited members. If FALSE, show the inheritance hierarchy.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/prior.html b/docs/reference/prior.html deleted file mode 100644 index 76fbdad06..000000000 --- a/docs/reference/prior.html +++ /dev/null @@ -1,100 +0,0 @@ - -Class prior change — prior • animint2 - Skip to contents - - -
-
-
- -
-

Performance of several class prior change models was studied across 4 -data sets.

-
- -
-

Usage

-
data(prior)
-
- -
-

Format

-

List of 2 data.frames: accuracy contains the mean and standard error of -the performance measures (sqErr and accuracy), data.set.info contains -meta-data about the dimension and number of positive and negative -examples in each data set.

-
-
-

Source

-

MC du Plessis, personal communication.

-
-
-

References

-

du Plessis MC, Sugiyama M. - Semi-Supervised Learning of Class Balance under Class-Prior Change by - Distribution Matching. ICML 2012.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/prostateLasso.html b/docs/reference/prostateLasso.html deleted file mode 100644 index cc6bb05d5..000000000 --- a/docs/reference/prostateLasso.html +++ /dev/null @@ -1,91 +0,0 @@ - -Lasso model of the prostate cancer data set — prostateLasso • animint2 - Skip to contents - - -
-
-
- -
-

The lars package was used to obtain a full path of lasso solutions.

-
- -
-

Usage

-
data("prostateLasso")
-
- -
-

Format

-

A list of 4 data.frames: path for the piecewise linear coefficient - path, residuals for the prediction error of every model at every data - point, models with one row per regularization parameter, error for - total train/validation prediction error for each regularization parameter.

-
-
-

Source

-

https://github.com/tdhock/animint-book/blob/master/Ch11-lasso.Rmd

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/pt.to.lines.html b/docs/reference/pt.to.lines.html deleted file mode 100644 index bb361b7c4..000000000 --- a/docs/reference/pt.to.lines.html +++ /dev/null @@ -1,98 +0,0 @@ - -Convert pt value to lines — pt.to.lines • animint2 - Skip to contents - - -
-
-
- -
-

Convert pt value to lines

-
- -
-

Usage

-
pt.to.lines(pt_value)
-
- -
-

Arguments

-
pt_value
-

Value in pt to be converted to lines

- -
-
-

Value

- - -

Value in lines

- - -
-
-

Note

-

Does NOT work if input is not in pt. Input is returned as is.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/qplot-1.png b/docs/reference/qplot-1.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/qplot-1.png and /dev/null differ diff --git a/docs/reference/qplot-10.png b/docs/reference/qplot-10.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/qplot-10.png and /dev/null differ diff --git a/docs/reference/qplot-11.png b/docs/reference/qplot-11.png deleted file mode 100644 index 494e5db25..000000000 Binary files a/docs/reference/qplot-11.png and /dev/null differ diff --git a/docs/reference/qplot-12.png b/docs/reference/qplot-12.png deleted file mode 100644 index 7c25b39b9..000000000 Binary files a/docs/reference/qplot-12.png and /dev/null differ diff --git a/docs/reference/qplot-13.png b/docs/reference/qplot-13.png deleted file mode 100644 index 60aaf7c17..000000000 Binary files a/docs/reference/qplot-13.png and /dev/null differ diff --git a/docs/reference/qplot-2.png b/docs/reference/qplot-2.png deleted file mode 100644 index aab142318..000000000 Binary files a/docs/reference/qplot-2.png and /dev/null differ diff --git a/docs/reference/qplot-3.png b/docs/reference/qplot-3.png deleted file mode 100644 index 2f9849671..000000000 Binary files a/docs/reference/qplot-3.png and /dev/null differ diff --git a/docs/reference/qplot-4.png b/docs/reference/qplot-4.png deleted file mode 100644 index 47b881d79..000000000 Binary files a/docs/reference/qplot-4.png and /dev/null differ diff --git a/docs/reference/qplot-5.png b/docs/reference/qplot-5.png deleted file mode 100644 index ca9835e0d..000000000 Binary files a/docs/reference/qplot-5.png and /dev/null differ diff --git a/docs/reference/qplot-6.png b/docs/reference/qplot-6.png deleted file mode 100644 index 6c1a7b019..000000000 Binary files a/docs/reference/qplot-6.png and /dev/null differ diff --git a/docs/reference/qplot-7.png b/docs/reference/qplot-7.png deleted file mode 100644 index f077a617f..000000000 Binary files a/docs/reference/qplot-7.png and /dev/null differ diff --git a/docs/reference/qplot-8.png b/docs/reference/qplot-8.png deleted file mode 100644 index 4d1452f1c..000000000 Binary files a/docs/reference/qplot-8.png and /dev/null differ diff --git a/docs/reference/qplot-9.png b/docs/reference/qplot-9.png deleted file mode 100644 index 386ad599d..000000000 Binary files a/docs/reference/qplot-9.png and /dev/null differ diff --git a/docs/reference/qplot.html b/docs/reference/qplot.html deleted file mode 100644 index cd56292d7..000000000 --- a/docs/reference/qplot.html +++ /dev/null @@ -1,229 +0,0 @@ - -Quick plot — qplot • animint2 - Skip to contents - - -
-
-
- -
-

qplot is the basic plotting function in the ggplot2 package, -designed to be familiar if you're used to base plot(). -It's a convenient wrapper for creating a number of different types of plots -using a consistent calling scheme.

-
- -
-

Usage

-
qplot(
-  x,
-  y = NULL,
-  ...,
-  data,
-  facets = NULL,
-  margins = FALSE,
-  geom = "auto",
-  xlim = c(NA, NA),
-  ylim = c(NA, NA),
-  log = "",
-  main = NULL,
-  xlab = deparse(substitute(x)),
-  ylab = deparse(substitute(y)),
-  asp = NA,
-  stat = NULL,
-  position = NULL
-)
-
-quickplot(
-  x,
-  y = NULL,
-  ...,
-  data,
-  facets = NULL,
-  margins = FALSE,
-  geom = "auto",
-  xlim = c(NA, NA),
-  ylim = c(NA, NA),
-  log = "",
-  main = NULL,
-  xlab = deparse(substitute(x)),
-  ylab = deparse(substitute(y)),
-  asp = NA,
-  stat = NULL,
-  position = NULL
-)
-
- -
-

Arguments

-
x, y, ...
-

Aesthetics passed into each layer

- - -
data
-

Data frame to use (optional). If not specified, will create -one, extracting vectors from the current environment.

- - -
facets
-

faceting formula to use. Picks facet_wrap or -facet_grid depending on whether the formula is one- -or two-sided

- - -
margins
-

See facet_grid: display marginal facets?

- - -
geom
-

Character vector specifying geom(s) to draw. Defaults to -"point" if x and y are specified, and "histogram" if only x is specified.

- - -
xlim, ylim
-

X and y axis limits

- - -
log
-

Which variables to log transform ("x", "y", or "xy")

- - -
main, xlab, ylab
-

Character vector (or expression) giving plot title, -x axis label, and y axis label respectively.

- - -
asp
-

The y/x aspect ratio

- - -
stat, position
-

DEPRECATED.

- -
- -
-

Examples

-
# Use data from data.frame
-qplot(mpg, wt, data = mtcars)
-
-qplot(mpg, wt, data = mtcars, colour = cyl)
-
-qplot(mpg, wt, data = mtcars, size = cyl)
-
-qplot(mpg, wt, data = mtcars, facets = vs ~ am)
-
-
-# \donttest{
-qplot(1:10, rnorm(10), colour = runif(10))
-
-qplot(1:10, letters[1:10])
-
-mod <- lm(mpg ~ wt, data = mtcars)
-qplot(resid(mod), fitted(mod))
-
-
-f <- function() {
-   a <- 1:10
-   b <- a ^ 2
-   qplot(a, b)
-}
-f()
-
-
-# To set aesthetics, wrap in I()
-qplot(mpg, wt, data = mtcars, colour = I("red"))
-
-
-# qplot will attempt to guess what geom you want depending on the input
-# both x and y supplied = scatterplot
-qplot(mpg, wt, data = mtcars)
-
-# just x supplied = histogram
-qplot(mpg, data = mtcars)
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-# just y supplied = scatterplot, with x = seq_along(y)
-qplot(y = mpg, data = mtcars)
-#> Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous.
-#> Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous.
-#> Error: Aesthetics must be either length 1 or the same as the data (32): y, x
-
-# Use different geoms
-qplot(mpg, wt, data = mtcars, geom = "path")
-
-qplot(mpg, data = mtcars, geom = "dotplot")
-#> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
-#> Warning: Unit type of dotdia should be 'npc'
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/reexports-1.png b/docs/reference/reexports-1.png deleted file mode 100644 index a44bf4eb6..000000000 Binary files a/docs/reference/reexports-1.png and /dev/null differ diff --git a/docs/reference/reexports-2.png b/docs/reference/reexports-2.png deleted file mode 100644 index a44bf4eb6..000000000 Binary files a/docs/reference/reexports-2.png and /dev/null differ diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html deleted file mode 100644 index 4e3c1ce1e..000000000 --- a/docs/reference/reexports.html +++ /dev/null @@ -1,117 +0,0 @@ - -Objects exported from other packages — reexports • animint2 - Skip to contents - - -
-
-
- -
-

These objects are imported from other packages. Follow the links -below to see their documentation.

-
grid
-

arrow, unit

- - -
scales
-

alpha

- - -
- - - -
-

Examples

-
ggplot(mpg, aes(displ, hwy)) +
-  geom_point(alpha = 0.5, colour = "blue")
-
-
-ggplot(mpg, aes(displ, hwy)) +
-  geom_point(colour = alpha("blue", 0.5))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/rel-1.png b/docs/reference/rel-1.png deleted file mode 100644 index a836cfdf5..000000000 Binary files a/docs/reference/rel-1.png and /dev/null differ diff --git a/docs/reference/rel.html b/docs/reference/rel.html deleted file mode 100644 index 6fd868ad5..000000000 --- a/docs/reference/rel.html +++ /dev/null @@ -1,95 +0,0 @@ - -Relative sizing for theme elements — rel • animint2 - Skip to contents - - -
-
-
- -
-

Relative sizing for theme elements

-
- -
-

Usage

-
rel(x)
-
- -
-

Arguments

-
x
-

A number representing the relative size

- -
- -
-

Examples

-
df <- data.frame(x = 1:3, y = 1:3)
-ggplot(df, aes(x, y)) +
-  geom_point() +
-  theme(axis.title.x = element_text(size = rel(2.5)))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/remove_missing.html b/docs/reference/remove_missing.html deleted file mode 100644 index f6d72a4c6..000000000 --- a/docs/reference/remove_missing.html +++ /dev/null @@ -1,114 +0,0 @@ - -Convenience function to remove missing values from a data.frame — remove_missing • animint2 - Skip to contents - - -
-
-
- -
-

Remove all non-complete rows, with a warning if na.rm = FALSE. -ggplot is somewhat more accommodating of missing values than R generally. -For those stats which require complete data, missing values will be -automatically removed with a warning. If na.rm = TRUE is supplied -to the statistic, the warning will be suppressed.

-
- -
-

Usage

-
remove_missing(df, na.rm = FALSE, vars = names(df), name = "", finite = FALSE)
-
- -
-

Arguments

-
df
-

data.frame

- - -
na.rm
-

If true, will suppress warning message.

- - -
vars
-

Character vector of variables to check for missings in

- - -
name
-

Optional function name to improve error message.

- - -
finite
-

If TRUE, will also remove non-finite values.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/renderAnimint.html b/docs/reference/renderAnimint.html deleted file mode 100644 index accc29c04..000000000 --- a/docs/reference/renderAnimint.html +++ /dev/null @@ -1,102 +0,0 @@ - -Create an animint output element — renderAnimint • animint2 - Skip to contents - - -
-
-
- -
-

Shiny server output function customized for animint plots -(similar to shiny::plotOutput and friends).

-
- -
-

Usage

-
renderAnimint(expr, env = parent.frame(), quoted = FALSE)
-
- -
-

Arguments

-
expr
-

An expression that creates a list of ggplot objects.

- - -
env
-

The environment in which to evaluate expr.

- - -
quoted
-

Is expr a quoted expression (with quote())? -This is useful if you want to save an expression in a variable.

- -
-
-

See also

-

http://shiny.rstudio.com/articles/building-outputs.html

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/resolution.html b/docs/reference/resolution.html deleted file mode 100644 index 971da5c93..000000000 --- a/docs/reference/resolution.html +++ /dev/null @@ -1,116 +0,0 @@ - -Compute the "resolution" of a data vector. — resolution • animint2 - Skip to contents - - -
-
-
- -
-

The resolution is is the smallest non-zero distance between adjacent -values. If there is only one unique value, then the resolution is defined -to be one.

-
- -
-

Usage

-
resolution(x, zero = TRUE)
-
- -
-

Arguments

-
x
-

numeric vector

- - -
zero
-

should a zero value be automatically included in the -computation of resolution

- -
-
-

Details

-

If x is an integer vector, then it is assumed to represent a discrete -variable, and the resolution is 1.

-
- -
-

Examples

-
resolution(1:10)
-#> [1] 1
-resolution((1:10) - 0.5)
-#> [1] 0.5
-resolution((1:10) - 0.5, FALSE)
-#> [1] 1
-resolution(c(1,2, 10, 20, 50))
-#> [1] 1
-resolution(as.integer(c(1, 10, 20, 50)))  # Returns 1
-#> [1] 1
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/saveChunks.html b/docs/reference/saveChunks.html deleted file mode 100644 index 40a060bd0..000000000 --- a/docs/reference/saveChunks.html +++ /dev/null @@ -1,100 +0,0 @@ - -Split data set into chunks and save them to separate files. — saveChunks • animint2 - Skip to contents - - -
-
-
- -
-

Split data set into chunks and save them to separate files.

-
- -
-

Usage

-
saveChunks(x, meta)
-
- -
-

Arguments

-
x
-

data.frame.

- - -
meta
-

environment.

- -
-
-

Value

- - -

recursive list of chunk file names.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_alpha-1.png b/docs/reference/scale_alpha-1.png deleted file mode 100644 index 30e9fffe1..000000000 Binary files a/docs/reference/scale_alpha-1.png and /dev/null differ diff --git a/docs/reference/scale_alpha-2.png b/docs/reference/scale_alpha-2.png deleted file mode 100644 index 09a617f66..000000000 Binary files a/docs/reference/scale_alpha-2.png and /dev/null differ diff --git a/docs/reference/scale_alpha-3.png b/docs/reference/scale_alpha-3.png deleted file mode 100644 index 8b7c7a737..000000000 Binary files a/docs/reference/scale_alpha-3.png and /dev/null differ diff --git a/docs/reference/scale_alpha-4.png b/docs/reference/scale_alpha-4.png deleted file mode 100644 index 81555808a..000000000 Binary files a/docs/reference/scale_alpha-4.png and /dev/null differ diff --git a/docs/reference/scale_alpha-5.png b/docs/reference/scale_alpha-5.png deleted file mode 100644 index 22a90fced..000000000 Binary files a/docs/reference/scale_alpha-5.png and /dev/null differ diff --git a/docs/reference/scale_alpha-6.png b/docs/reference/scale_alpha-6.png deleted file mode 100644 index 293f9337a..000000000 Binary files a/docs/reference/scale_alpha-6.png and /dev/null differ diff --git a/docs/reference/scale_alpha.html b/docs/reference/scale_alpha.html deleted file mode 100644 index fcd84093a..000000000 --- a/docs/reference/scale_alpha.html +++ /dev/null @@ -1,119 +0,0 @@ - -Alpha scales. — scale_alpha • animint2 - Skip to contents - - -
-
-
- -
-

scale_alpha is an alias for scale_alpha_continuous since -that is the most common use of alpha, and it saves a bit of typing.

-
- -
-

Usage

-
scale_alpha(..., range = c(0.1, 1))
-
-scale_alpha_continuous(..., range = c(0.1, 1))
-
-scale_alpha_discrete(..., range = c(0.1, 1))
-
- -
-

Arguments

-
...
-

Other arguments passed on to continuous_scale -or discrete_scale as appropriate, to control name, limits, -breaks, labels and so forth.

- - -
range
-

range of output alpha values. Should lie between 0 and 1.

- -
- -
-

Examples

-
(p <- ggplot(mtcars, aes(mpg, cyl)) +
-  geom_point(aes(alpha = cyl)))
-
-p + scale_alpha("cylinders")
-
-p + scale_alpha("number\nof\ncylinders")
-
-
-p + scale_alpha(range = c(0.4, 0.8))
-
-
-(p <- ggplot(mtcars, aes(mpg, cyl)) +
-  geom_point(aes(alpha = factor(cyl))))
-
-p + scale_alpha_discrete(range = c(0.4, 0.8))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_brewer-1.png b/docs/reference/scale_brewer-1.png deleted file mode 100644 index acf5643b4..000000000 Binary files a/docs/reference/scale_brewer-1.png and /dev/null differ diff --git a/docs/reference/scale_brewer-10.png b/docs/reference/scale_brewer-10.png deleted file mode 100644 index 0eb50eca6..000000000 Binary files a/docs/reference/scale_brewer-10.png and /dev/null differ diff --git a/docs/reference/scale_brewer-11.png b/docs/reference/scale_brewer-11.png deleted file mode 100644 index c0741291e..000000000 Binary files a/docs/reference/scale_brewer-11.png and /dev/null differ diff --git a/docs/reference/scale_brewer-2.png b/docs/reference/scale_brewer-2.png deleted file mode 100644 index d28b467fe..000000000 Binary files a/docs/reference/scale_brewer-2.png and /dev/null differ diff --git a/docs/reference/scale_brewer-3.png b/docs/reference/scale_brewer-3.png deleted file mode 100644 index a180c54ad..000000000 Binary files a/docs/reference/scale_brewer-3.png and /dev/null differ diff --git a/docs/reference/scale_brewer-4.png b/docs/reference/scale_brewer-4.png deleted file mode 100644 index ed390b4cd..000000000 Binary files a/docs/reference/scale_brewer-4.png and /dev/null differ diff --git a/docs/reference/scale_brewer-5.png b/docs/reference/scale_brewer-5.png deleted file mode 100644 index 35c142f61..000000000 Binary files a/docs/reference/scale_brewer-5.png and /dev/null differ diff --git a/docs/reference/scale_brewer-6.png b/docs/reference/scale_brewer-6.png deleted file mode 100644 index 96005b9e6..000000000 Binary files a/docs/reference/scale_brewer-6.png and /dev/null differ diff --git a/docs/reference/scale_brewer-7.png b/docs/reference/scale_brewer-7.png deleted file mode 100644 index e9d6b212b..000000000 Binary files a/docs/reference/scale_brewer-7.png and /dev/null differ diff --git a/docs/reference/scale_brewer-8.png b/docs/reference/scale_brewer-8.png deleted file mode 100644 index 2bfb20d75..000000000 Binary files a/docs/reference/scale_brewer-8.png and /dev/null differ diff --git a/docs/reference/scale_brewer-9.png b/docs/reference/scale_brewer-9.png deleted file mode 100644 index c93b569df..000000000 Binary files a/docs/reference/scale_brewer-9.png and /dev/null differ diff --git a/docs/reference/scale_brewer.html b/docs/reference/scale_brewer.html deleted file mode 100644 index e746fc823..000000000 --- a/docs/reference/scale_brewer.html +++ /dev/null @@ -1,240 +0,0 @@ - -Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer • animint2 - Skip to contents - - -
-
-
- -
-

ColorBrewer provides sequential, diverging and qualitative colour schemes -which are particularly suited and tested to display discrete values (levels -of a factor) on a map. ggplot2 can use those colours in discrete scales. It -also allows to smoothly interpolate 6 colours from any palette to a -continuous scale (6 colours per palette gives nice gradients; more results in -more saturated colours which do not look as good). However, the original -colour schemes (particularly the qualitative ones) were not intended for this -and the perceptual result is left to the appreciation of the user. -See https://colorbrewer2.org for more information.

-
- -
-

Usage

-
scale_colour_brewer(..., type = "seq", palette = 1, direction = 1)
-
-scale_fill_brewer(..., type = "seq", palette = 1, direction = 1)
-
-scale_colour_distiller(
-  ...,
-  type = "seq",
-  palette = 1,
-  direction = -1,
-  values = NULL,
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar"
-)
-
-scale_fill_distiller(
-  ...,
-  type = "seq",
-  palette = 1,
-  direction = -1,
-  values = NULL,
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar"
-)
-
- -
-

Arguments

-
...
-

Other arguments passed on to discrete_scale -to control name, limits, breaks, labels and so forth.

- - -
type
-

One of "seq" (sequential), "div" (diverging) or "qual" -(qualitative)

- - -
palette
-

If a string, will use that named palette. If a number, will -index into the list of palettes of appropriate type

- - -
direction
-

Sets the order of colours in the scale. If 1, the default, -colours are as output by RColorBrewer::brewer.pal(). If -1, the -order of colours is reversed.

- - -
values
-

if colours should not be evenly positioned along the gradient -this vector gives the position (between 0 and 1) for each colour in the -colours vector. See rescale() for a convenience function -to map an arbitrary range to between 0 and 1.

- - -
space
-

colour space in which to calculate gradient. Must be "Lab" - -other values are deprecated.

- - -
na.value
-

Colour to use for missing values

- - -
guide
-

Type of legend. Use "colourbar" for continuous -colour bar, or "legend" for discrete colour legend.

- -
-
-

Palettes

- - -

The following palettes are available for use with these scales:

Diverging
-

BrBG, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, Spectral

- -
Qualitative
-

Accent, Dark2, Paired, Pastel1, Pastel2, Set1, Set2, Set3

- -
Sequential
-

Blues, BuGn, BuPu, GnBu, Greens, Greys, Oranges, - OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd

- - -
-
-

See also

- -
- -
-

Examples

-
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
-(d <- ggplot(dsamp, aes(carat, price)) +
-  geom_point(aes(colour = clarity)))
-
-
-# Change scale label
-d + scale_colour_brewer()
-
-d + scale_colour_brewer("Diamond\nclarity")
-
-
-# Select brewer palette to use, see ?scales::brewer_pal for more details
-d + scale_colour_brewer(palette = "Greens")
-
-d + scale_colour_brewer(palette = "Set1")
-
-
-# \donttest{
-# scale_fill_brewer works just the same as
-# scale_colour_brewer but for fill colours
-p <- ggplot(diamonds, aes(x = price, fill = cut)) +
-  geom_histogram(position = "dodge", binwidth = 1000)
-p + scale_fill_brewer()
-
-# the order of colour can be reversed
-p + scale_fill_brewer(direction = -1)
-
-# the brewer scales look better on a darker background
-p + scale_fill_brewer(direction = -1) + theme_dark()
-
-# }
-
-# Use distiller variant with continous data
-v <- ggplot(faithfuld) +
-  geom_tile(aes(waiting, eruptions, fill = density))
-v
-
-v + scale_fill_distiller()
-
-v + scale_fill_distiller(palette = "Spectral")
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_continuous-1.png b/docs/reference/scale_continuous-1.png deleted file mode 100644 index 7ba2a9a94..000000000 Binary files a/docs/reference/scale_continuous-1.png and /dev/null differ diff --git a/docs/reference/scale_continuous.html b/docs/reference/scale_continuous.html deleted file mode 100644 index 102afc93a..000000000 --- a/docs/reference/scale_continuous.html +++ /dev/null @@ -1,268 +0,0 @@ - -Continuous position scales (x & y). — scale_continuous • animint2 - Skip to contents - - -
-
-
- -
-

scale_x_continuous and scale_y_continuous are the key functions. -The others, scale_x_log10, scale_y_sqrt etc, are aliases -that set the trans argument to commonly used transformations.

-
- -
-

Usage

-
scale_x_continuous(
-  name = waiver(),
-  breaks = waiver(),
-  minor_breaks = waiver(),
-  labels = waiver(),
-  limits = NULL,
-  expand = waiver(),
-  oob = censor,
-  na.value = NA_real_,
-  trans = "identity"
-)
-
-scale_y_continuous(
-  name = waiver(),
-  breaks = waiver(),
-  minor_breaks = waiver(),
-  labels = waiver(),
-  limits = NULL,
-  expand = waiver(),
-  oob = censor,
-  na.value = NA_real_,
-  trans = "identity"
-)
-
-scale_x_log10(...)
-
-scale_y_log10(...)
-
-scale_x_reverse(...)
-
-scale_y_reverse(...)
-
-scale_x_sqrt(...)
-
-scale_y_sqrt(...)
-
- -
-

Arguments

-
name
-

The name of the scale. Used as axis or legend title. If -NULL, the default, the name of the scale is taken from the first -mapping used for that aesthetic.

- - -
breaks
-

One of:

  • NULL for no breaks

  • -
  • waiver() for the default breaks computed by the - transformation object

  • -
  • A numeric vector of positions

  • -
  • A function that takes the limits as input and returns breaks - as output

  • -
- - -
minor_breaks
-

One of:

  • NULL for no minor breaks

  • -
  • waiver() for the default breaks (one minor break between - each major break)

  • -
  • A numeric vector of positions

  • -
  • A function that given the limits returns a vector of minor breaks.

  • -
- - -
labels
-

One of:

  • NULL for no labels

  • -
  • waiver() for the default labels computed by the - transformation object

  • -
  • A character vector giving labels (must be same length as breaks)

  • -
  • A function that takes the breaks as input and returns labels - as output

  • -
- - -
limits
-

A numeric vector of length two providing limits of the scale. -Use NA to refer to the existing minimum or maximum.

- - -
expand
-

A numeric vector of length two giving multiplicative and -additive expansion constants. These constants ensure that the data is -placed some distance away from the axes. The defaults are -c(0.05, 0) for continuous variables, and c(0, 0.6) for -discrete variables.

- - -
oob
-

Function that handles limits outside of the scale limits -(out of bounds). The default replaces out of bounds values with NA.

- - -
na.value
-

Missing values will be replaced with this value.

- - -
trans
-

Either the name of a transformation object, or the - object itself. Built-in transformations include "asn", "atanh", - "boxcox", "exp", "identity", "log", "log10", "log1p", "log2", - "logit", "probability", "probit", "reciprocal", "reverse" and "sqrt".

-

A transformation object bundles together a transform, it's inverse, - and methods for generating breaks and labels. Transformation objects - are defined in the scales package, and are called name_trans, e.g. - boxcox_trans. You can create your own - transformation with trans_new.

- - -
...
-

Other arguments passed on to scale_(x|y)_continuous

- -
-
-

See also

-

scale_date for date/time position scales.

-
- -
-

Examples

-
# \donttest{
-if (require(ggplot2movies)) {
-m <- ggplot(subset(movies, votes > 1000), aes(rating, votes)) +
-  geom_point(na.rm = TRUE)
-m
-
-# Manipulating the default position scales lets you:
-
-#  * change the axis labels
-m + scale_y_continuous("number of votes")
-m + scale_y_continuous(quote(votes ^ alpha))
-
-#  * modify the axis limits
-m + scale_y_continuous(limits = c(0, 5000))
-m + scale_y_continuous(limits = c(1000, 10000))
-m + scale_x_continuous(limits = c(7, 8))
-
-# you can also use the short hand functions xlim and ylim
-m + ylim(0, 5000)
-m + ylim(1000, 10000)
-m + xlim(7, 8)
-
-#  * choose where the ticks appear
-m + scale_x_continuous(breaks = 1:10)
-m + scale_x_continuous(breaks = c(1,3,7,9))
-
-#  * manually label the ticks
-m + scale_x_continuous(breaks = c(2,5,8), labels = c("two", "five", "eight"))
-m + scale_x_continuous(breaks = c(2,5,8), labels = c("horrible", "ok", "awesome"))
-m + scale_x_continuous(breaks = c(2,5,8), labels = expression(Alpha, Beta, Omega))
-
-# There are a few built in transformation that you can use:
-m + scale_y_log10()
-m + scale_y_sqrt()
-m + scale_y_reverse()
-# You can also create your own and supply them to the trans argument.
-# See ?scales::trans_new
-
-# You can control the formatting of the labels with the formatter
-# argument.  Some common formats are built into the scales package:
-df <- data.frame(
-  x = rnorm(10) * 100000,
-  y = seq(0, 1, length.out = 10)
-)
-p <- ggplot(df, aes(x, y)) + geom_point()
-p + scale_y_continuous(labels = scales::percent)
-p + scale_y_continuous(labels = scales::dollar)
-p + scale_x_continuous(labels = scales::comma)
-
-# Other shortcut functions
-ggplot(movies, aes(rating, votes)) +
-  geom_point() +
-  ylim(1e4, 5e4)
-#   * axis labels
-ggplot(movies, aes(rating, votes)) +
-  geom_point() +
-  labs(x = "My x axis", y = "My y axis")
-#   * log scaling
-ggplot(movies, aes(rating, votes)) +
-  geom_point() +
-  scale_x_log10() +
-  scale_y_log10()
-}
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_date-1.png b/docs/reference/scale_date-1.png deleted file mode 100644 index 2d6f3c2c2..000000000 Binary files a/docs/reference/scale_date-1.png and /dev/null differ diff --git a/docs/reference/scale_date-2.png b/docs/reference/scale_date-2.png deleted file mode 100644 index 3b89bd956..000000000 Binary files a/docs/reference/scale_date-2.png and /dev/null differ diff --git a/docs/reference/scale_date-3.png b/docs/reference/scale_date-3.png deleted file mode 100644 index a265a29eb..000000000 Binary files a/docs/reference/scale_date-3.png and /dev/null differ diff --git a/docs/reference/scale_date-4.png b/docs/reference/scale_date-4.png deleted file mode 100644 index 38f558c3f..000000000 Binary files a/docs/reference/scale_date-4.png and /dev/null differ diff --git a/docs/reference/scale_date.html b/docs/reference/scale_date.html deleted file mode 100644 index 708d8118c..000000000 --- a/docs/reference/scale_date.html +++ /dev/null @@ -1,227 +0,0 @@ - -Position scale, date & date times — scale_date • animint2 - Skip to contents - - -
-
-
- -
-

Use scale_*_date with Date variables, and -scale_*_datetime with POSIXct variables.

-
- -
-

Usage

-
scale_x_date(
-  name = waiver(),
-  breaks = waiver(),
-  date_breaks = waiver(),
-  labels = waiver(),
-  date_labels = waiver(),
-  minor_breaks = waiver(),
-  date_minor_breaks = waiver(),
-  limits = NULL,
-  expand = waiver()
-)
-
-scale_y_date(
-  name = waiver(),
-  breaks = waiver(),
-  date_breaks = waiver(),
-  labels = waiver(),
-  date_labels = waiver(),
-  minor_breaks = waiver(),
-  date_minor_breaks = waiver(),
-  limits = NULL,
-  expand = waiver()
-)
-
-scale_x_datetime(
-  name = waiver(),
-  breaks = waiver(),
-  date_breaks = waiver(),
-  labels = waiver(),
-  date_labels = waiver(),
-  minor_breaks = waiver(),
-  date_minor_breaks = waiver(),
-  limits = NULL,
-  expand = waiver()
-)
-
-scale_y_datetime(
-  name = waiver(),
-  breaks = waiver(),
-  date_breaks = waiver(),
-  labels = waiver(),
-  date_labels = waiver(),
-  minor_breaks = waiver(),
-  date_minor_breaks = waiver(),
-  limits = NULL,
-  expand = waiver()
-)
-
- -
-

Arguments

-
name
-

The name of the scale. Used as axis or legend title. If -NULL, the default, the name of the scale is taken from the first -mapping used for that aesthetic.

- - -
breaks
-

One of:

  • NULL for no breaks

  • -
  • waiver() for the default breaks computed by the - transformation object

  • -
  • A numeric vector of positions

  • -
  • A function that takes the limits as input and returns breaks - as output

  • -
- - -
date_breaks
-

A string giving the distance between breaks like "2 -weeks", or "10 years". If both breaks and date_breaks are -specified, date_breaks wins.

- - -
labels
-

One of:

  • NULL for no labels

  • -
  • waiver() for the default labels computed by the - transformation object

  • -
  • A character vector giving labels (must be same length as breaks)

  • -
  • A function that takes the breaks as input and returns labels - as output

  • -
- - -
date_labels
-

A string giving the formatting specification for the -labels. Codes are defined in strftime. If both labels -and date_labels are specified, date_labels wins.

- - -
minor_breaks
-

One of:

  • NULL for no minor breaks

  • -
  • waiver() for the default breaks (one minor break between - each major break)

  • -
  • A numeric vector of positions

  • -
  • A function that given the limits returns a vector of minor breaks.

  • -
- - -
date_minor_breaks
-

A string giving the distance between minor breaks -like "2 weeks", or "10 years". If both minor_breaks and -date_minor_breaks are specified, date_minor_breaks wins.

- - -
limits
-

A numeric vector of length two providing limits of the scale. -Use NA to refer to the existing minimum or maximum.

- - -
expand
-

A numeric vector of length two giving multiplicative and -additive expansion constants. These constants ensure that the data is -placed some distance away from the axes. The defaults are -c(0.05, 0) for continuous variables, and c(0, 0.6) for -discrete variables.

- -
-
-

See also

-

scale_continuous for continuous position scales.

-
- -
-

Examples

-
last_month <- Sys.Date() - 0:29
-df <- data.frame(
-  date = last_month,
-  price = runif(30)
-)
-base <- ggplot(df, aes(date, price)) +
-  geom_line()
-
-# The date scale will attempt to pick sensible defaults for
-# major and minor tick marks. Override with date_breaks, date_labels
-# date_minor_breaks arguments.
-base + scale_x_date(date_labels = "%b %d")
-
-base + scale_x_date(date_breaks = "1 week", date_labels = "%W")
-
-base + scale_x_date(date_minor_breaks = "1 day")
-
-
-# Set limits
-base + scale_x_date(limits = c(Sys.Date() - 7, NA))
-#> Warning: Removed 22 rows containing missing values (geom_path).
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_discrete-1.png b/docs/reference/scale_discrete-1.png deleted file mode 100644 index db332a7ea..000000000 Binary files a/docs/reference/scale_discrete-1.png and /dev/null differ diff --git a/docs/reference/scale_discrete-10.png b/docs/reference/scale_discrete-10.png deleted file mode 100644 index b12ae9a90..000000000 Binary files a/docs/reference/scale_discrete-10.png and /dev/null differ diff --git a/docs/reference/scale_discrete-11.png b/docs/reference/scale_discrete-11.png deleted file mode 100644 index 134ddee77..000000000 Binary files a/docs/reference/scale_discrete-11.png and /dev/null differ diff --git a/docs/reference/scale_discrete-2.png b/docs/reference/scale_discrete-2.png deleted file mode 100644 index 286fa0004..000000000 Binary files a/docs/reference/scale_discrete-2.png and /dev/null differ diff --git a/docs/reference/scale_discrete-3.png b/docs/reference/scale_discrete-3.png deleted file mode 100644 index ed6e2eed5..000000000 Binary files a/docs/reference/scale_discrete-3.png and /dev/null differ diff --git a/docs/reference/scale_discrete-4.png b/docs/reference/scale_discrete-4.png deleted file mode 100644 index d977c1e04..000000000 Binary files a/docs/reference/scale_discrete-4.png and /dev/null differ diff --git a/docs/reference/scale_discrete-5.png b/docs/reference/scale_discrete-5.png deleted file mode 100644 index 630993dc1..000000000 Binary files a/docs/reference/scale_discrete-5.png and /dev/null differ diff --git a/docs/reference/scale_discrete-6.png b/docs/reference/scale_discrete-6.png deleted file mode 100644 index 6e69cef41..000000000 Binary files a/docs/reference/scale_discrete-6.png and /dev/null differ diff --git a/docs/reference/scale_discrete-7.png b/docs/reference/scale_discrete-7.png deleted file mode 100644 index 82a33bc9b..000000000 Binary files a/docs/reference/scale_discrete-7.png and /dev/null differ diff --git a/docs/reference/scale_discrete-8.png b/docs/reference/scale_discrete-8.png deleted file mode 100644 index 8d7d1da78..000000000 Binary files a/docs/reference/scale_discrete-8.png and /dev/null differ diff --git a/docs/reference/scale_discrete-9.png b/docs/reference/scale_discrete-9.png deleted file mode 100644 index 42985cccd..000000000 Binary files a/docs/reference/scale_discrete-9.png and /dev/null differ diff --git a/docs/reference/scale_discrete.html b/docs/reference/scale_discrete.html deleted file mode 100644 index 7f270692c..000000000 --- a/docs/reference/scale_discrete.html +++ /dev/null @@ -1,157 +0,0 @@ - -Discrete position. — scale_x_discrete • animint2 - Skip to contents - - -
-
-
- -
-

You can use continuous positions even with a discrete position scale - -this allows you (e.g.) to place labels between bars in a bar chart. -Continuous positions are numeric values starting at one for the first -level, and increasing by one for each level (i.e. the labels are placed -at integer positions). This is what allows jittering to work.

-
- -
-

Usage

-
scale_x_discrete(..., expand = waiver())
-
-scale_y_discrete(..., expand = waiver())
-
- -
-

Arguments

-
...
-

common discrete scale parameters: name, breaks, -labels, na.value, limits and guide. See -discrete_scale for more details

- - -
expand
-

a numeric vector of length two giving multiplicative and -additive expansion constants. These constants ensure that the data is -placed some distance away from the axes.

- -
- -
-

Examples

-
ggplot(diamonds, aes(cut)) + geom_bar()
-
-
-# \donttest{
-# The discrete position scale is added automatically whenever you
-# have a discrete position.
-
-(d <- ggplot(subset(diamonds, carat > 1), aes(cut, clarity)) +
-      geom_jitter())
-
-
-d + scale_x_discrete("Cut")
-
-d + scale_x_discrete("Cut", labels = c("Fair" = "F","Good" = "G",
-  "Very Good" = "VG","Perfect" = "P","Ideal" = "I"))
-
-
-# Use limits to adjust the which levels (and in what order)
-# are displayed
-d + scale_x_discrete(limits = c("Fair","Ideal"))
-#> Warning: Removed 11189 rows containing missing values (geom_point).
-
-
-# you can also use the short hand functions xlim and ylim
-d + xlim("Fair","Ideal", "Good")
-#> Warning: Removed 9610 rows containing missing values (geom_point).
-
-d + ylim("I1", "IF")
-#> Warning: Removed 16770 rows containing missing values (geom_point).
-
-
-# See ?reorder to reorder based on the values of another variable
-ggplot(mpg, aes(manufacturer, cty)) + geom_point()
-
-ggplot(mpg, aes(reorder(manufacturer, cty), cty)) + geom_point()
-
-ggplot(mpg, aes(reorder(manufacturer, displ), cty)) + geom_point()
-
-
-# Use abbreviate as a formatter to reduce long names
-ggplot(mpg, aes(reorder(manufacturer, displ), cty)) +
-  geom_point() +
-  scale_x_discrete(labels = abbreviate)
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_gradient-1.png b/docs/reference/scale_gradient-1.png deleted file mode 100644 index 7cf19a23a..000000000 Binary files a/docs/reference/scale_gradient-1.png and /dev/null differ diff --git a/docs/reference/scale_gradient-2.png b/docs/reference/scale_gradient-2.png deleted file mode 100644 index 0ab67bbd7..000000000 Binary files a/docs/reference/scale_gradient-2.png and /dev/null differ diff --git a/docs/reference/scale_gradient-3.png b/docs/reference/scale_gradient-3.png deleted file mode 100644 index 64a70d69e..000000000 Binary files a/docs/reference/scale_gradient-3.png and /dev/null differ diff --git a/docs/reference/scale_gradient-4.png b/docs/reference/scale_gradient-4.png deleted file mode 100644 index c273ae1bf..000000000 Binary files a/docs/reference/scale_gradient-4.png and /dev/null differ diff --git a/docs/reference/scale_gradient-5.png b/docs/reference/scale_gradient-5.png deleted file mode 100644 index 7e8021276..000000000 Binary files a/docs/reference/scale_gradient-5.png and /dev/null differ diff --git a/docs/reference/scale_gradient.html b/docs/reference/scale_gradient.html deleted file mode 100644 index ffd3fd40f..000000000 --- a/docs/reference/scale_gradient.html +++ /dev/null @@ -1,247 +0,0 @@ - -Smooth gradient between two colours — scale_colour_gradient • animint2 - Skip to contents - - -
-
-
- -
-

scale_*_gradient creates a two colour gradient (low-high), -scale_*_gradient2 creates a diverging colour gradient (low-mid-high), -scale_*_gradientn creats a n-colour gradient.

-
- -
-

Usage

-
scale_colour_gradient(
-  ...,
-  low = "#132B43",
-  high = "#56B1F7",
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar"
-)
-
-scale_fill_gradient(
-  ...,
-  low = "#132B43",
-  high = "#56B1F7",
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar"
-)
-
-scale_colour_gradient2(
-  ...,
-  low = muted("red"),
-  mid = "white",
-  high = muted("blue"),
-  midpoint = 0,
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar"
-)
-
-scale_fill_gradient2(
-  ...,
-  low = muted("red"),
-  mid = "white",
-  high = muted("blue"),
-  midpoint = 0,
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar"
-)
-
-scale_colour_gradientn(
-  ...,
-  colours,
-  values = NULL,
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar",
-  colors
-)
-
-scale_fill_gradientn(
-  ...,
-  colours,
-  values = NULL,
-  space = "Lab",
-  na.value = "grey50",
-  guide = "colourbar",
-  colors
-)
-
- -
-

Arguments

-
...
-

Other arguments passed on to discrete_scale -to control name, limits, breaks, labels and so forth.

- - -
low, high
-

Colours for low and high ends of the gradient.

- - -
space
-

colour space in which to calculate gradient. Must be "Lab" - -other values are deprecated.

- - -
na.value
-

Colour to use for missing values

- - -
guide
-

Type of legend. Use "colourbar" for continuous -colour bar, or "legend" for discrete colour legend.

- - -
mid
-

colour for mid point

- - -
midpoint
-

The midpoint (in data value) of the diverging scale. -Defaults to 0.

- - -
colours, colors
-

Vector of colours to use for n-colour gradient.

- - -
values
-

if colours should not be evenly positioned along the gradient -this vector gives the position (between 0 and 1) for each colour in the -colours vector. See rescale() for a convenience function -to map an arbitrary range to between 0 and 1.

- -
-
-

Details

-

Default colours are generated with munsell and -mnsl(c("2.5PB 2/4", "2.5PB 7/10"). Generally, for continuous -colour scales you want to keep hue constant, but vary chroma and -luminance. The munsell package makes this easy to do using the -Munsell colour system.

-
-
-

See also

-

seq_gradient_pal for details on underlying - palette

-

Other colour scales: - scale_colour_brewer, - scale_colour_grey, - scale_colour_hue

-
- -
-

Examples

-
df <- data.frame(
-  x = runif(100),
-  y = runif(100),
-  z1 = rnorm(100),
-  z2 = abs(rnorm(100))
-)
-
-# Default colour scale colours from light blue to dark blue
-ggplot(df, aes(x, y)) +
-  geom_point(aes(colour = z2))
-
-
-# For diverging colour scales use gradient2
-ggplot(df, aes(x, y)) +
-  geom_point(aes(colour = z1)) +
-  scale_colour_gradient2()
-
-
-# Use your own colour scale with gradientn
-ggplot(df, aes(x, y)) +
-  geom_point(aes(colour = z1)) +
-  scale_colour_gradientn(colours = terrain.colors(10))
-
-
-# Equivalent fill scales do the same job for the fill aesthetic
-ggplot(faithfuld, aes(waiting, eruptions)) +
-  geom_raster(aes(fill = density)) +
-  scale_fill_gradientn(colours = terrain.colors(10))
-
-
-# Adjust colour choices with low and high
-ggplot(df, aes(x, y)) +
-  geom_point(aes(colour = z2)) +
-  scale_colour_gradient(low = "white", high = "black")
-
-# Avoid red-green colour contrasts because ~10% of men have difficulty
-# seeing them
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_grey-1.png b/docs/reference/scale_grey-1.png deleted file mode 100644 index b2911eb4c..000000000 Binary files a/docs/reference/scale_grey-1.png and /dev/null differ diff --git a/docs/reference/scale_grey-2.png b/docs/reference/scale_grey-2.png deleted file mode 100644 index c07902efa..000000000 Binary files a/docs/reference/scale_grey-2.png and /dev/null differ diff --git a/docs/reference/scale_grey-3.png b/docs/reference/scale_grey-3.png deleted file mode 100644 index 077ffc3d9..000000000 Binary files a/docs/reference/scale_grey-3.png and /dev/null differ diff --git a/docs/reference/scale_grey-4.png b/docs/reference/scale_grey-4.png deleted file mode 100644 index e64251f6d..000000000 Binary files a/docs/reference/scale_grey-4.png and /dev/null differ diff --git a/docs/reference/scale_grey-5.png b/docs/reference/scale_grey-5.png deleted file mode 100644 index 84c638463..000000000 Binary files a/docs/reference/scale_grey-5.png and /dev/null differ diff --git a/docs/reference/scale_grey.html b/docs/reference/scale_grey.html deleted file mode 100644 index a3896ed86..000000000 --- a/docs/reference/scale_grey.html +++ /dev/null @@ -1,132 +0,0 @@ - -Sequential grey colour scale. — scale_colour_grey • animint2 - Skip to contents - - -
-
-
- -
-

Based on gray.colors

-
- -
-

Usage

-
scale_colour_grey(..., start = 0.2, end = 0.8, na.value = "red")
-
-scale_fill_grey(..., start = 0.2, end = 0.8, na.value = "red")
-
- -
-

Arguments

-
...
-

Other arguments passed on to discrete_scale -to control name, limits, breaks, labels and so forth.

- - -
start
-

grey value at low end of palette

- - -
end
-

grey value at high end of palette

- - -
na.value
-

Colour to use for missing values

- -
-
-

See also

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = factor(cyl)))
-p + scale_colour_grey()
-
-p + scale_colour_grey(end = 0)
-
-
-# You may want to turn off the pale grey background with this scale
-p + scale_colour_grey() + theme_bw()
-
-
-# Colour of missing values is controlled with na.value:
-miss <- factor(sample(c(NA, 1:5), nrow(mtcars), replace = TRUE))
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(colour = miss)) +
-  scale_colour_grey()
-
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(colour = miss)) +
-  scale_colour_grey(na.value = "green")
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_hue-1.png b/docs/reference/scale_hue-1.png deleted file mode 100644 index f074aa035..000000000 Binary files a/docs/reference/scale_hue-1.png and /dev/null differ diff --git a/docs/reference/scale_hue-10.png b/docs/reference/scale_hue-10.png deleted file mode 100644 index e40714cff..000000000 Binary files a/docs/reference/scale_hue-10.png and /dev/null differ diff --git a/docs/reference/scale_hue-11.png b/docs/reference/scale_hue-11.png deleted file mode 100644 index 36d5c566d..000000000 Binary files a/docs/reference/scale_hue-11.png and /dev/null differ diff --git a/docs/reference/scale_hue-12.png b/docs/reference/scale_hue-12.png deleted file mode 100644 index bccad0a75..000000000 Binary files a/docs/reference/scale_hue-12.png and /dev/null differ diff --git a/docs/reference/scale_hue-13.png b/docs/reference/scale_hue-13.png deleted file mode 100644 index 27b447cf0..000000000 Binary files a/docs/reference/scale_hue-13.png and /dev/null differ diff --git a/docs/reference/scale_hue-14.png b/docs/reference/scale_hue-14.png deleted file mode 100644 index 2109b093a..000000000 Binary files a/docs/reference/scale_hue-14.png and /dev/null differ diff --git a/docs/reference/scale_hue-15.png b/docs/reference/scale_hue-15.png deleted file mode 100644 index 21cd7e037..000000000 Binary files a/docs/reference/scale_hue-15.png and /dev/null differ diff --git a/docs/reference/scale_hue-16.png b/docs/reference/scale_hue-16.png deleted file mode 100644 index 8286bbee8..000000000 Binary files a/docs/reference/scale_hue-16.png and /dev/null differ diff --git a/docs/reference/scale_hue-17.png b/docs/reference/scale_hue-17.png deleted file mode 100644 index 33a28f7c5..000000000 Binary files a/docs/reference/scale_hue-17.png and /dev/null differ diff --git a/docs/reference/scale_hue-2.png b/docs/reference/scale_hue-2.png deleted file mode 100644 index f074aa035..000000000 Binary files a/docs/reference/scale_hue-2.png and /dev/null differ diff --git a/docs/reference/scale_hue-3.png b/docs/reference/scale_hue-3.png deleted file mode 100644 index f074aa035..000000000 Binary files a/docs/reference/scale_hue-3.png and /dev/null differ diff --git a/docs/reference/scale_hue-4.png b/docs/reference/scale_hue-4.png deleted file mode 100644 index a824fe3fe..000000000 Binary files a/docs/reference/scale_hue-4.png and /dev/null differ diff --git a/docs/reference/scale_hue-5.png b/docs/reference/scale_hue-5.png deleted file mode 100644 index 18432cd73..000000000 Binary files a/docs/reference/scale_hue-5.png and /dev/null differ diff --git a/docs/reference/scale_hue-6.png b/docs/reference/scale_hue-6.png deleted file mode 100644 index ed26d38ff..000000000 Binary files a/docs/reference/scale_hue-6.png and /dev/null differ diff --git a/docs/reference/scale_hue-7.png b/docs/reference/scale_hue-7.png deleted file mode 100644 index 299035931..000000000 Binary files a/docs/reference/scale_hue-7.png and /dev/null differ diff --git a/docs/reference/scale_hue-8.png b/docs/reference/scale_hue-8.png deleted file mode 100644 index fbce37cfa..000000000 Binary files a/docs/reference/scale_hue-8.png and /dev/null differ diff --git a/docs/reference/scale_hue-9.png b/docs/reference/scale_hue-9.png deleted file mode 100644 index 55d179964..000000000 Binary files a/docs/reference/scale_hue-9.png and /dev/null differ diff --git a/docs/reference/scale_hue.html b/docs/reference/scale_hue.html deleted file mode 100644 index c4772077b..000000000 --- a/docs/reference/scale_hue.html +++ /dev/null @@ -1,194 +0,0 @@ - -Qualitative colour scale with evenly spaced hues. — scale_colour_hue • animint2 - Skip to contents - - -
-
-
- -
-

Qualitative colour scale with evenly spaced hues.

-
- -
-

Usage

-
scale_colour_hue(
-  ...,
-  h = c(0, 360) + 15,
-  c = 100,
-  l = 65,
-  h.start = 0,
-  direction = 1,
-  na.value = "grey50"
-)
-
-scale_fill_hue(
-  ...,
-  h = c(0, 360) + 15,
-  c = 100,
-  l = 65,
-  h.start = 0,
-  direction = 1,
-  na.value = "grey50"
-)
-
- -
-

Arguments

-
...
-

Other arguments passed on to discrete_scale -to control name, limits, breaks, labels and so forth.

- - -
h
-

range of hues to use, in [0, 360]

- - -
c
-

chroma (intensity of colour), maximum value varies depending on -combination of hue and luminance.

- - -
l
-

luminance (lightness), in [0, 100]

- - -
h.start
-

hue to start at

- - -
direction
-

direction to travel around the colour wheel, -1 = clockwise, -1 = counter-clockwise

- - -
na.value
-

Colour to use for missing values

- -
-
-

See also

- -
- -
-

Examples

-
# \donttest{
-dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
-(d <- ggplot(dsamp, aes(carat, price)) + geom_point(aes(colour = clarity)))
-
-
-# Change scale label
-d + scale_colour_hue()
-
-d + scale_colour_hue("clarity")
-
-d + scale_colour_hue(expression(clarity[beta]))
-
-
-# Adjust luminosity and chroma
-d + scale_colour_hue(l = 40, c = 30)
-
-d + scale_colour_hue(l = 70, c = 30)
-
-d + scale_colour_hue(l = 70, c = 150)
-
-d + scale_colour_hue(l = 80, c = 150)
-
-
-# Change range of hues used
-d + scale_colour_hue(h = c(0, 90))
-
-d + scale_colour_hue(h = c(90, 180))
-
-d + scale_colour_hue(h = c(180, 270))
-
-d + scale_colour_hue(h = c(270, 360))
-
-
-# Vary opacity
-# (only works with pdf, quartz and cairo devices)
-d <- ggplot(dsamp, aes(carat, price, colour = clarity))
-d + geom_point(alpha = 0.9)
-
-d + geom_point(alpha = 0.5)
-
-d + geom_point(alpha = 0.2)
-
-
-# Colour of missing values is controlled with na.value:
-miss <- factor(sample(c(NA, 1:5), nrow(mtcars), replace = TRUE))
-ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss))
-
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(colour = miss)) +
-  scale_colour_hue(na.value = "black")
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_identity-1.png b/docs/reference/scale_identity-1.png deleted file mode 100644 index 0fdfc8741..000000000 Binary files a/docs/reference/scale_identity-1.png and /dev/null differ diff --git a/docs/reference/scale_identity-2.png b/docs/reference/scale_identity-2.png deleted file mode 100644 index 2eb7b05f2..000000000 Binary files a/docs/reference/scale_identity-2.png and /dev/null differ diff --git a/docs/reference/scale_identity-3.png b/docs/reference/scale_identity-3.png deleted file mode 100644 index f4e3c2610..000000000 Binary files a/docs/reference/scale_identity-3.png and /dev/null differ diff --git a/docs/reference/scale_identity-4.png b/docs/reference/scale_identity-4.png deleted file mode 100644 index eb8b257ee..000000000 Binary files a/docs/reference/scale_identity-4.png and /dev/null differ diff --git a/docs/reference/scale_identity-5.png b/docs/reference/scale_identity-5.png deleted file mode 100644 index 3d251ec4a..000000000 Binary files a/docs/reference/scale_identity-5.png and /dev/null differ diff --git a/docs/reference/scale_identity-6.png b/docs/reference/scale_identity-6.png deleted file mode 100644 index 2f9849671..000000000 Binary files a/docs/reference/scale_identity-6.png and /dev/null differ diff --git a/docs/reference/scale_identity-7.png b/docs/reference/scale_identity-7.png deleted file mode 100644 index 2b4053857..000000000 Binary files a/docs/reference/scale_identity-7.png and /dev/null differ diff --git a/docs/reference/scale_identity.html b/docs/reference/scale_identity.html deleted file mode 100644 index c35e6d1f5..000000000 --- a/docs/reference/scale_identity.html +++ /dev/null @@ -1,144 +0,0 @@ - -Use values without scaling. — scale_identity • animint2 - Skip to contents - - -
-
-
- -
-

Use values without scaling.

-
- -
-

Usage

-
scale_colour_identity(..., guide = "none")
-
-scale_fill_identity(..., guide = "none")
-
-scale_shape_identity(..., guide = "none")
-
-scale_linetype_identity(..., guide = "none")
-
-scale_alpha_identity(..., guide = "none")
-
-scale_size_identity(..., guide = "none")
-
- -
-

Arguments

-
...
-

Other arguments passed on to discrete_scale or -continuous_scale

- - -
guide
-

Guide to use for this scale - defaults to "none".

- -
- -
-

Examples

-
ggplot(luv_colours, aes(u, v)) +
-  geom_point(aes(colour = col), size = 3) +
-  scale_color_identity() +
-  coord_equal()
-
-
-df <- data.frame(
-  x = 1:4,
-  y = 1:4,
-  colour = c("red", "green", "blue", "yellow")
-)
-ggplot(df, aes(x, y)) + geom_tile(aes(fill = colour))
-
-ggplot(df, aes(x, y)) +
-  geom_tile(aes(fill = colour)) +
-  scale_fill_identity()
-
-
-# To get a legend guide, specify guide = "legend"
-ggplot(df, aes(x, y)) +
-  geom_tile(aes(fill = colour)) +
-  scale_fill_identity(guide = "legend")
-
-# But you'll typically also need to supply breaks and labels:
-ggplot(df, aes(x, y)) +
-  geom_tile(aes(fill = colour)) +
-  scale_fill_identity("trt", labels = letters[1:4], breaks = df$colour,
-  guide = "legend")
-
-
-# cyl scaled to appropriate size
-ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(size = cyl))
-
-
-# cyl used as point size
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(size = cyl)) +
-  scale_size_identity()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_linetype-1.png b/docs/reference/scale_linetype-1.png deleted file mode 100644 index 10d5fb829..000000000 Binary files a/docs/reference/scale_linetype-1.png and /dev/null differ diff --git a/docs/reference/scale_linetype-2.png b/docs/reference/scale_linetype-2.png deleted file mode 100644 index 788b0d94e..000000000 Binary files a/docs/reference/scale_linetype-2.png and /dev/null differ diff --git a/docs/reference/scale_linetype.html b/docs/reference/scale_linetype.html deleted file mode 100644 index e6af7e43d..000000000 --- a/docs/reference/scale_linetype.html +++ /dev/null @@ -1,113 +0,0 @@ - -Scale for line patterns. — scale_linetype • animint2 - Skip to contents - - -
-
-
- -
-

Default line types based on a set supplied by Richard Pearson, -University of Manchester. Line types can not be mapped to continuous -values.

-
- -
-

Usage

-
scale_linetype(..., na.value = "blank")
-
-scale_linetype_continuous(...)
-
-scale_linetype_discrete(..., na.value = "blank")
-
- -
-

Arguments

-
...
-

common discrete scale parameters: name, breaks, -labels, na.value, limits and guide. See -discrete_scale for more details

- - -
na.value
-

The linetype to use for NA values.

- -
- -
-

Examples

-
base <- ggplot(economics_long, aes(date, value01))
-base + geom_line(aes(group = variable))
-
-base + geom_line(aes(linetype = variable))
-
-
-# See scale_manual for more flexibility
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_manual-1.png b/docs/reference/scale_manual-1.png deleted file mode 100644 index 8d0cce2ad..000000000 Binary files a/docs/reference/scale_manual-1.png and /dev/null differ diff --git a/docs/reference/scale_manual-10.png b/docs/reference/scale_manual-10.png deleted file mode 100644 index e3733b7da..000000000 Binary files a/docs/reference/scale_manual-10.png and /dev/null differ diff --git a/docs/reference/scale_manual-2.png b/docs/reference/scale_manual-2.png deleted file mode 100644 index 876109161..000000000 Binary files a/docs/reference/scale_manual-2.png and /dev/null differ diff --git a/docs/reference/scale_manual-3.png b/docs/reference/scale_manual-3.png deleted file mode 100644 index 8d0cce2ad..000000000 Binary files a/docs/reference/scale_manual-3.png and /dev/null differ diff --git a/docs/reference/scale_manual-4.png b/docs/reference/scale_manual-4.png deleted file mode 100644 index 401510893..000000000 Binary files a/docs/reference/scale_manual-4.png and /dev/null differ diff --git a/docs/reference/scale_manual-5.png b/docs/reference/scale_manual-5.png deleted file mode 100644 index 401510893..000000000 Binary files a/docs/reference/scale_manual-5.png and /dev/null differ diff --git a/docs/reference/scale_manual-6.png b/docs/reference/scale_manual-6.png deleted file mode 100644 index be5d17f60..000000000 Binary files a/docs/reference/scale_manual-6.png and /dev/null differ diff --git a/docs/reference/scale_manual-7.png b/docs/reference/scale_manual-7.png deleted file mode 100644 index ff9a5e9a6..000000000 Binary files a/docs/reference/scale_manual-7.png and /dev/null differ diff --git a/docs/reference/scale_manual-8.png b/docs/reference/scale_manual-8.png deleted file mode 100644 index 7e213887e..000000000 Binary files a/docs/reference/scale_manual-8.png and /dev/null differ diff --git a/docs/reference/scale_manual-9.png b/docs/reference/scale_manual-9.png deleted file mode 100644 index 3f8969e73..000000000 Binary files a/docs/reference/scale_manual-9.png and /dev/null differ diff --git a/docs/reference/scale_manual.html b/docs/reference/scale_manual.html deleted file mode 100644 index 61f4f2c5a..000000000 --- a/docs/reference/scale_manual.html +++ /dev/null @@ -1,147 +0,0 @@ - -Create your own discrete scale. — scale_manual • animint2 - Skip to contents - - -
-
-
- -
-

Create your own discrete scale.

-
- -
-

Usage

-
scale_colour_manual(..., values)
-
-scale_fill_manual(..., values)
-
-scale_size_manual(..., values)
-
-scale_shape_manual(..., values)
-
-scale_linetype_manual(..., values)
-
-scale_alpha_manual(..., values)
-
- -
-

Arguments

-
...
-

common discrete scale parameters: name, breaks, -labels, na.value, limits and guide. See -discrete_scale for more details

- - -
values
-

a set of aesthetic values to map data values to. If this -is a named vector, then the values will be matched based on the names. -If unnamed, values will be matched in order (usually alphabetical) with -the limits of the scale. Any data values that don't match will be -given na.value.

- -
- -
-

Examples

-
# \donttest{
-p <- ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(colour = factor(cyl)))
-
-p + scale_colour_manual(values = c("red","blue", "green"))
-
-p + scale_colour_manual(
-  values = c("8" = "red","4" = "blue","6" = "green"))
-
-# With rgb hex values
-p + scale_colour_manual(values = c("#FF0000", "#0000FF", "#00FF00"))
-
-
-# As with other scales you can use breaks to control the appearance
-# of the legend
-cols <- c("8" = "red","4" = "blue","6" = "darkgreen", "10" = "orange")
-p + scale_colour_manual(values = cols)
-
-p + scale_colour_manual(values = cols, breaks = c("4", "6", "8"))
-
-p + scale_colour_manual(values = cols, breaks = c("8", "6", "4"))
-
-p + scale_colour_manual(values = cols, breaks = c("4", "6", "8"),
-  labels = c("four", "six", "eight"))
-
-
-# And limits to control the possible values of the scale
-p + scale_colour_manual(values = cols, limits = c("4", "8"))
-
-p + scale_colour_manual(values = cols, limits = c("4", "6", "8", "10"))
-
-
-# Notice that the values are matched with limits, and not breaks
-p + scale_colour_manual(limits = c(6, 8, 4), breaks = c(8, 4, 6),
-  values = c("grey50", "grey80", "black"))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_shape-1.png b/docs/reference/scale_shape-1.png deleted file mode 100644 index fc87d69e2..000000000 Binary files a/docs/reference/scale_shape-1.png and /dev/null differ diff --git a/docs/reference/scale_shape-2.png b/docs/reference/scale_shape-2.png deleted file mode 100644 index fc87d69e2..000000000 Binary files a/docs/reference/scale_shape-2.png and /dev/null differ diff --git a/docs/reference/scale_shape-3.png b/docs/reference/scale_shape-3.png deleted file mode 100644 index eb12268f5..000000000 Binary files a/docs/reference/scale_shape-3.png and /dev/null differ diff --git a/docs/reference/scale_shape-4.png b/docs/reference/scale_shape-4.png deleted file mode 100644 index d4bbd0908..000000000 Binary files a/docs/reference/scale_shape-4.png and /dev/null differ diff --git a/docs/reference/scale_shape-5.png b/docs/reference/scale_shape-5.png deleted file mode 100644 index 3b1a8c0cb..000000000 Binary files a/docs/reference/scale_shape-5.png and /dev/null differ diff --git a/docs/reference/scale_shape-6.png b/docs/reference/scale_shape-6.png deleted file mode 100644 index 9119f35a4..000000000 Binary files a/docs/reference/scale_shape-6.png and /dev/null differ diff --git a/docs/reference/scale_shape-7.png b/docs/reference/scale_shape-7.png deleted file mode 100644 index fc87d69e2..000000000 Binary files a/docs/reference/scale_shape-7.png and /dev/null differ diff --git a/docs/reference/scale_shape.html b/docs/reference/scale_shape.html deleted file mode 100644 index c6247e748..000000000 --- a/docs/reference/scale_shape.html +++ /dev/null @@ -1,120 +0,0 @@ - -Scale for shapes, aka glyphs. — scale_shape • animint2 - Skip to contents - - -
-
-
- -
-

A continuous variable can not be mapped to shape.

-
- -
-

Usage

-
scale_shape(..., solid = TRUE)
-
- -
-

Arguments

-
...
-

common discrete scale parameters: name, breaks, -labels, na.value, limits and guide. See -discrete_scale for more details

- - -
solid
-

Are the shapes solid, TRUE, or hollow FALSE?

- -
- -
-

Examples

-
dsmall <- diamonds[sample(nrow(diamonds), 100), ]
-
-(d <- ggplot(dsmall, aes(carat, price)) + geom_point(aes(shape = cut)))
-
-d + scale_shape(solid = TRUE) # the default
-
-d + scale_shape(solid = FALSE)
-
-d + scale_shape(name = "Cut of diamond")
-
-d + scale_shape(name = "Cut of\ndiamond")
-
-
-# To change order of levels, change order of
-# underlying factor
-levels(dsmall$cut) <- c("Fair", "Good", "Very Good", "Premium", "Ideal")
-
-# Need to recreate plot to pick up new data
-ggplot(dsmall, aes(price, carat)) + geom_point(aes(shape = cut))
-
-
-# Or for short:
-d %+% dsmall
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_size-1.png b/docs/reference/scale_size-1.png deleted file mode 100644 index 6cb5bbd1b..000000000 Binary files a/docs/reference/scale_size-1.png and /dev/null differ diff --git a/docs/reference/scale_size-2.png b/docs/reference/scale_size-2.png deleted file mode 100644 index 517b05139..000000000 Binary files a/docs/reference/scale_size-2.png and /dev/null differ diff --git a/docs/reference/scale_size-3.png b/docs/reference/scale_size-3.png deleted file mode 100644 index 93b9e3f29..000000000 Binary files a/docs/reference/scale_size-3.png and /dev/null differ diff --git a/docs/reference/scale_size-4.png b/docs/reference/scale_size-4.png deleted file mode 100644 index 29168886f..000000000 Binary files a/docs/reference/scale_size-4.png and /dev/null differ diff --git a/docs/reference/scale_size-5.png b/docs/reference/scale_size-5.png deleted file mode 100644 index 9dc7648c5..000000000 Binary files a/docs/reference/scale_size-5.png and /dev/null differ diff --git a/docs/reference/scale_size-6.png b/docs/reference/scale_size-6.png deleted file mode 100644 index aeb8e42fd..000000000 Binary files a/docs/reference/scale_size-6.png and /dev/null differ diff --git a/docs/reference/scale_size.html b/docs/reference/scale_size.html deleted file mode 100644 index 7f81fce69..000000000 --- a/docs/reference/scale_size.html +++ /dev/null @@ -1,206 +0,0 @@ - -Scale size (area or radius). — scale_size • animint2 - Skip to contents - - -
-
-
- -
-

scale_size scales area, scale_radius scales radius. The size -aesthetic is most commonly used for points and text, and humans perceive -the area of points (not their radius), so this provides for optimal -perception. scale_size_area ensures that a value of 0 is mapped -to a size of 0.

-
- -
-

Usage

-
scale_radius(
-  name = waiver(),
-  breaks = waiver(),
-  labels = waiver(),
-  limits = NULL,
-  range = c(1, 6),
-  trans = "identity",
-  guide = "legend"
-)
-
-scale_size(
-  name = waiver(),
-  breaks = waiver(),
-  labels = waiver(),
-  limits = NULL,
-  range = c(1, 6),
-  trans = "identity",
-  guide = "legend"
-)
-
-scale_size_area(..., max_size = 6)
-
- -
-

Arguments

-
name
-

The name of the scale. Used as axis or legend title. If -NULL, the default, the name of the scale is taken from the first -mapping used for that aesthetic.

- - -
breaks
-

One of:

  • NULL for no breaks

  • -
  • waiver() for the default breaks computed by the - transformation object

  • -
  • A numeric vector of positions

  • -
  • A function that takes the limits as input and returns breaks - as output

  • -
- - -
labels
-

One of:

  • NULL for no labels

  • -
  • waiver() for the default labels computed by the - transformation object

  • -
  • A character vector giving labels (must be same length as breaks)

  • -
  • A function that takes the breaks as input and returns labels - as output

  • -
- - -
limits
-

A numeric vector of length two providing limits of the scale. -Use NA to refer to the existing minimum or maximum.

- - -
range
-

a numeric vector of length 2 that specifies the minimum and -maximum size of the plotting symbol after transformation.

- - -
trans
-

Either the name of a transformation object, or the - object itself. Built-in transformations include "asn", "atanh", - "boxcox", "exp", "identity", "log", "log10", "log1p", "log2", - "logit", "probability", "probit", "reciprocal", "reverse" and "sqrt".

-

A transformation object bundles together a transform, it's inverse, - and methods for generating breaks and labels. Transformation objects - are defined in the scales package, and are called name_trans, e.g. - boxcox_trans. You can create your own - transformation with trans_new.

- - -
guide
-

Name of guide object, or object itself.

- - -
...
-

Other arguments passed on to continuous_scale -to control name, limits, breaks, labels and so forth.

- - -
max_size
-

Size of largest points.

- -
-
-

See also

-

scale_size_area if you want 0 values to be mapped - to points with size 0.

-
- -
-

Examples

-
p <- ggplot(mpg, aes(displ, hwy, size = hwy)) +
-   geom_point()
-p
-
-p + scale_size("Highway mpg")
-
-p + scale_size(range = c(0, 10))
-
-
-# If you want zero value to have zero size, use scale_size_area:
-p + scale_size_area()
-
-
-# This is most useful when size is a count
-ggplot(mpg, aes(class, cyl)) +
-  geom_count() +
-  scale_size_area()
-
-
-# If you want to map size to radius (usually bad idea), use scale_radius
-p + scale_radius()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/scale_size_animint.html b/docs/reference/scale_size_animint.html deleted file mode 100644 index 04cdac670..000000000 --- a/docs/reference/scale_size_animint.html +++ /dev/null @@ -1,96 +0,0 @@ - -Scale point sizes using circle area, but specifying the radius in -pixels. — scale_size_animint • animint2 - Skip to contents - - -
-
-
- -
-

Scale point sizes using circle area, but specifying the radius in -pixels.

-
- -
-

Usage

-
scale_size_animint(pixel.range = c(2, 20), ...)
-
- -
-

Arguments

-
pixel.range
-

min and max circle radius in pixels.

- - -
...
-

passed to continuous_scale.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/seals.html b/docs/reference/seals.html deleted file mode 100644 index ab72f7b75..000000000 --- a/docs/reference/seals.html +++ /dev/null @@ -1,103 +0,0 @@ - -Vector field of seal movements. — seals • animint2 - Skip to contents - - -
-
-
- -
-

This vector field was produced from the data described in Brillinger, D.R., -Preisler, H.K., Ager, A.A. and Kie, J.G. "An exploratory data analysis -(EDA) of the paths of moving animals". J. Statistical Planning and -Inference 122 (2004), 43-63, using the methods of Brillinger, D.R., -"Learning a potential function from a trajectory", Signal Processing -Letters. December (2007).

-
- -
-

Usage

-
seals
-
- -
-

Format

-

A data frame with 1155 rows and 4 variables

-
- - -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/selectSSandCS.html b/docs/reference/selectSSandCS.html deleted file mode 100644 index df56413b0..000000000 --- a/docs/reference/selectSSandCS.html +++ /dev/null @@ -1,93 +0,0 @@ - -Separate .variable/.value selectors — selectSSandCS • animint2 - Skip to contents - - -
-
-
- -
-

Separate .variable/.value selectors

-
- -
-

Usage

-
selectSSandCS(aesthetics_list)
-
- -
-

Arguments

-
aesthetics_list
-

aesthetics mapping of the layer

- -
-
-

Value

- - -

Modified aes.list list with separated -showSelected.variable/value

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/setPlotSizes.html b/docs/reference/setPlotSizes.html deleted file mode 100644 index 12439c661..000000000 --- a/docs/reference/setPlotSizes.html +++ /dev/null @@ -1,96 +0,0 @@ - -Set plot width and height for all plots — setPlotSizes • animint2 - Skip to contents - - -
-
-
- -
-

Set plot width and height for all plots

-
- -
-

Usage

-
setPlotSizes(meta, AllPlotsInfo)
-
- -
-

Arguments

-
meta
-

meta object with all information

- - -
AllPlotsInfo
-

plot info list

- -
-
-

Value

- - -

NULL. Sizes are stored in meta object

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/should_stop.html b/docs/reference/should_stop.html deleted file mode 100644 index 8a3f2d6ff..000000000 --- a/docs/reference/should_stop.html +++ /dev/null @@ -1,93 +0,0 @@ - -Used in examples to illustrate when errors should occur. — should_stop • animint2 - Skip to contents - - -
-
-
- -
-

Used in examples to illustrate when errors should occur.

-
- -
-

Usage

-
should_stop(expr)
-
- -
-

Arguments

-
expr
-

code to evaluate.

- -
- -
-

Examples

-
should_stop(stop("Hi!"))
-should_stop(should_stop("Hi!"))
-#> [1] "Hi!"
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/split_recursive.html b/docs/reference/split_recursive.html deleted file mode 100644 index 2dcbad72e..000000000 --- a/docs/reference/split_recursive.html +++ /dev/null @@ -1,96 +0,0 @@ - -Split data.frame into recursive list of data.frame. — split_recursive • animint2 - Skip to contents - - -
-
-
- -
-

Split data.frame into recursive list of data.frame.

-
- -
-

Usage

-
split_recursive(x, vars)
-
- -
-

Arguments

-
x
-

data.frame.

- - -
vars
-

character vector of variable names to split on.

- -
-
-

Value

- - -

recursive list of data.frame.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_ecdf-1.png b/docs/reference/stat_ecdf-1.png deleted file mode 100644 index 5884d1731..000000000 Binary files a/docs/reference/stat_ecdf-1.png and /dev/null differ diff --git a/docs/reference/stat_ecdf-2.png b/docs/reference/stat_ecdf-2.png deleted file mode 100644 index 15208769d..000000000 Binary files a/docs/reference/stat_ecdf-2.png and /dev/null differ diff --git a/docs/reference/stat_ecdf.html b/docs/reference/stat_ecdf.html deleted file mode 100644 index 572da52df..000000000 --- a/docs/reference/stat_ecdf.html +++ /dev/null @@ -1,184 +0,0 @@ - -Empirical Cumulative Density Function — stat_ecdf • animint2 - Skip to contents - - -
-
-
- -
-

Empirical Cumulative Density Function

-
- -
-

Usage

-
stat_ecdf(
-  mapping = NULL,
-  data = NULL,
-  geom = "step",
-  position = "identity",
-  ...,
-  n = NULL,
-  pad = TRUE,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
n
-

if NULL, do not interpolate. If not NULL, this is the number -of points to interpolate with.

- - -
pad
-

If TRUE, pad the ecdf with additional points (-Inf, 0) -and (Inf, 1)

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Computed variables

- - -
x
-

x in data

- -
y
-

cumulative density corresponding x

- - -
- -
-

Examples

-
# \donttest{
-df <- data.frame(x = rnorm(1000))
-ggplot(df, aes(x)) + stat_ecdf(geom = "step")
-
-
-df <- data.frame(x = c(rnorm(100, 0, 3), rnorm(100, 0, 10)),
-                 g = gl(2, 100))
-
-ggplot(df, aes(x, colour = g)) + stat_ecdf()
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_ellipse-1.png b/docs/reference/stat_ellipse-1.png deleted file mode 100644 index beaad633c..000000000 Binary files a/docs/reference/stat_ellipse-1.png and /dev/null differ diff --git a/docs/reference/stat_ellipse-2.png b/docs/reference/stat_ellipse-2.png deleted file mode 100644 index 53d286e5d..000000000 Binary files a/docs/reference/stat_ellipse-2.png and /dev/null differ diff --git a/docs/reference/stat_ellipse-3.png b/docs/reference/stat_ellipse-3.png deleted file mode 100644 index 83de56bc2..000000000 Binary files a/docs/reference/stat_ellipse-3.png and /dev/null differ diff --git a/docs/reference/stat_ellipse-4.png b/docs/reference/stat_ellipse-4.png deleted file mode 100644 index 405a75154..000000000 Binary files a/docs/reference/stat_ellipse-4.png and /dev/null differ diff --git a/docs/reference/stat_ellipse-5.png b/docs/reference/stat_ellipse-5.png deleted file mode 100644 index 4920be071..000000000 Binary files a/docs/reference/stat_ellipse-5.png and /dev/null differ diff --git a/docs/reference/stat_ellipse.html b/docs/reference/stat_ellipse.html deleted file mode 100644 index e8c9e9f3d..000000000 --- a/docs/reference/stat_ellipse.html +++ /dev/null @@ -1,204 +0,0 @@ - -Plot data ellipses. — stat_ellipse • animint2 - Skip to contents - - -
-
-
- -
-

The method for calculating the ellipses has been modified from -car::ellipse (Fox and Weisberg, 2011)

-
- -
-

Usage

-
stat_ellipse(
-  mapping = NULL,
-  data = NULL,
-  geom = "path",
-  position = "identity",
-  ...,
-  type = "t",
-  level = 0.95,
-  segments = 51,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
type
-

The type of ellipse. -The default "t" assumes a multivariate t-distribution, and -"norm" assumes a multivariate normal distribution. -"euclid" draws a circle with the radius equal to level, -representing the euclidean distance from the center. -This ellipse probably won't appear circular unless coord_fixed() is applied.

- - -
level
-

The confidence level at which to draw an ellipse (default is 0.95), -or, if type="euclid", the radius of the circle to be drawn.

- - -
segments
-

The number of segments to be used in drawing the ellipse.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

References

-

John Fox and Sanford Weisberg (2011). An R Companion to - Applied Regression, Second Edition. Thousand Oaks CA: Sage.

-
- -
-

Examples

-
ggplot(faithful, aes(waiting, eruptions)) +
-  geom_point() +
-  stat_ellipse()
-
-
-ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) +
-  geom_point() +
-  stat_ellipse()
-
-
-ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) +
-  geom_point() +
-  stat_ellipse(type = "norm", linetype = 2) +
-  stat_ellipse(type = "t")
-
-
-ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) +
-  geom_point() +
-  stat_ellipse(type = "norm", linetype = 2) +
-  stat_ellipse(type = "euclid", level = 3) +
-  coord_fixed()
-
-
-ggplot(faithful, aes(waiting, eruptions, fill = eruptions > 3)) +
-  stat_ellipse(geom = "polygon")
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_function-1.png b/docs/reference/stat_function-1.png deleted file mode 100644 index 8cec5e808..000000000 Binary files a/docs/reference/stat_function-1.png and /dev/null differ diff --git a/docs/reference/stat_function-2.png b/docs/reference/stat_function-2.png deleted file mode 100644 index 0ab538167..000000000 Binary files a/docs/reference/stat_function-2.png and /dev/null differ diff --git a/docs/reference/stat_function-3.png b/docs/reference/stat_function-3.png deleted file mode 100644 index 85f9c11b9..000000000 Binary files a/docs/reference/stat_function-3.png and /dev/null differ diff --git a/docs/reference/stat_function-4.png b/docs/reference/stat_function-4.png deleted file mode 100644 index f17418e8a..000000000 Binary files a/docs/reference/stat_function-4.png and /dev/null differ diff --git a/docs/reference/stat_function-5.png b/docs/reference/stat_function-5.png deleted file mode 100644 index a9554ecb9..000000000 Binary files a/docs/reference/stat_function-5.png and /dev/null differ diff --git a/docs/reference/stat_function-6.png b/docs/reference/stat_function-6.png deleted file mode 100644 index 9668f015c..000000000 Binary files a/docs/reference/stat_function-6.png and /dev/null differ diff --git a/docs/reference/stat_function-7.png b/docs/reference/stat_function-7.png deleted file mode 100644 index 859941a73..000000000 Binary files a/docs/reference/stat_function-7.png and /dev/null differ diff --git a/docs/reference/stat_function.html b/docs/reference/stat_function.html deleted file mode 100644 index 487d6e07e..000000000 --- a/docs/reference/stat_function.html +++ /dev/null @@ -1,225 +0,0 @@ - -Superimpose a function. — stat_function • animint2 - Skip to contents - - -
-
-
- -
-

Superimpose a function.

-
- -
-

Usage

-
stat_function(
-  mapping = NULL,
-  data = NULL,
-  geom = "path",
-  position = "identity",
-  ...,
-  fun,
-  xlim = NULL,
-  n = 101,
-  args = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
fun
-

function to use

- - -
xlim
-

Optionally, restrict the range of the function to this range.

- - -
n
-

number of points to interpolate along

- - -
args
-

list of additional arguments to pass to fun

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

stat_function understands the following aesthetics (required aesthetics are in bold):

  • y

  • -
-
-

Computed variables

- - -
x
-

x's along a grid

- -
y
-

value of function evaluated at corresponding x

- - -
- -
-

Examples

-
set.seed(1492)
-df <- data.frame(
-  x = rnorm(100)
-)
-x <- df$x
-base <- ggplot(df, aes(x)) + geom_density()
-base + stat_function(fun = dnorm, colour = "red")
-
-base + stat_function(fun = dnorm, colour = "red", args = list(mean = 3))
-
-
-# Plot functions without data
-# Examples adapted from Kohske Takahashi
-
-# Specify range of x-axis
-ggplot(data.frame(x = c(0, 2)), aes(x)) +
-  stat_function(fun = exp, geom = "line")
-
-
-# Plot a normal curve
-ggplot(data.frame(x = c(-5, 5)), aes(x)) + stat_function(fun = dnorm)
-
-
-# To specify a different mean or sd, use the args parameter to supply new values
-ggplot(data.frame(x = c(-5, 5)), aes(x)) +
-  stat_function(fun = dnorm, args = list(mean = 2, sd = .5))
-
-
-# Two functions on the same plot
-f <- ggplot(data.frame(x = c(0, 10)), aes(x))
-f + stat_function(fun = sin, colour = "red") +
-  stat_function(fun = cos, colour = "blue")
-
-
-# Using a custom function
-test <- function(x) {x ^ 2 + x + 20}
-f + stat_function(fun = test)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_identity-1.png b/docs/reference/stat_identity-1.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/stat_identity-1.png and /dev/null differ diff --git a/docs/reference/stat_identity.html b/docs/reference/stat_identity.html deleted file mode 100644 index eb6f29b33..000000000 --- a/docs/reference/stat_identity.html +++ /dev/null @@ -1,146 +0,0 @@ - -Identity statistic. — stat_identity • animint2 - Skip to contents - - -
-
-
- -
-

The identity statistic leaves the data unchanged.

-
- -
-

Usage

-
stat_identity(
-  mapping = NULL,
-  data = NULL,
-  geom = "point",
-  position = "identity",
-  ...,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(wt, mpg))
-p + stat_identity()
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_qq-1.png b/docs/reference/stat_qq-1.png deleted file mode 100644 index e2d87c4d1..000000000 Binary files a/docs/reference/stat_qq-1.png and /dev/null differ diff --git a/docs/reference/stat_qq-2.png b/docs/reference/stat_qq-2.png deleted file mode 100644 index e2d87c4d1..000000000 Binary files a/docs/reference/stat_qq-2.png and /dev/null differ diff --git a/docs/reference/stat_qq-3.png b/docs/reference/stat_qq-3.png deleted file mode 100644 index a5228ee23..000000000 Binary files a/docs/reference/stat_qq-3.png and /dev/null differ diff --git a/docs/reference/stat_qq-4.png b/docs/reference/stat_qq-4.png deleted file mode 100644 index a255aaedc..000000000 Binary files a/docs/reference/stat_qq-4.png and /dev/null differ diff --git a/docs/reference/stat_qq-5.png b/docs/reference/stat_qq-5.png deleted file mode 100644 index 726b86fe5..000000000 Binary files a/docs/reference/stat_qq-5.png and /dev/null differ diff --git a/docs/reference/stat_qq.html b/docs/reference/stat_qq.html deleted file mode 100644 index b9f2eabe8..000000000 --- a/docs/reference/stat_qq.html +++ /dev/null @@ -1,217 +0,0 @@ - -Calculation for quantile-quantile plot. — stat_qq • animint2 - Skip to contents - - -
-
-
- -
-

Calculation for quantile-quantile plot.

-
- -
-

Usage

-
stat_qq(
-  mapping = NULL,
-  data = NULL,
-  geom = "point",
-  position = "identity",
-  ...,
-  distribution = stats::qnorm,
-  dparams = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-geom_qq(
-  mapping = NULL,
-  data = NULL,
-  geom = "point",
-  position = "identity",
-  ...,
-  distribution = stats::qnorm,
-  dparams = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
distribution
-

Distribution function to use, if x not specified

- - -
dparams
-

Additional parameters passed on to distribution -function.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

stat_qq understands the following aesthetics (required aesthetics are in bold):

  • sample

  • -
  • x

  • -
  • y

  • -
-
-

Computed variables

- - -
sample
-

sample quantiles

- -
theoretical
-

theoretical quantiles

- - -
- -
-

Examples

-
# \donttest{
-df <- data.frame(y = rt(200, df = 5))
-p <- ggplot(df, aes(sample = y))
-p + stat_qq()
-
-p + geom_point(stat = "qq")
-
-
-# Use fitdistr from MASS to estimate distribution params
-params <- as.list(MASS::fitdistr(df$y, "t")$estimate)
-#> Warning: NaNs produced
-#> Warning: NaNs produced
-ggplot(df, aes(sample = y)) +
-  stat_qq(distribution = qt, dparams = params["df"])
-
-
-# Using to explore the distribution of a variable
-ggplot(mtcars) +
-  stat_qq(aes(sample = mpg))
-
-ggplot(mtcars) +
-  stat_qq(aes(sample = mpg, colour = factor(cyl)))
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_summary.html b/docs/reference/stat_summary.html deleted file mode 100644 index 2e976cbb6..000000000 --- a/docs/reference/stat_summary.html +++ /dev/null @@ -1,232 +0,0 @@ - -Summarise y values at unique/binned x x. — stat_summary_bin • animint2 - Skip to contents - - -
-
-
- -
-

stat_summary operates on unique x; stat_summary_bin -operators on binned x. They are more flexible versions of -stat_bin: instead of just counting, they can compute any -aggregate.

-
- -
-

Usage

-
stat_summary_bin(
-  mapping = NULL,
-  data = NULL,
-  geom = "pointrange",
-  position = "identity",
-  ...,
-  fun.data = NULL,
-  fun.y = NULL,
-  fun.ymax = NULL,
-  fun.ymin = NULL,
-  fun.args = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_summary(
-  mapping = NULL,
-  data = NULL,
-  geom = "pointrange",
-  position = "identity",
-  ...,
-  fun.data = NULL,
-  fun.y = NULL,
-  fun.ymax = NULL,
-  fun.ymin = NULL,
-  fun.args = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
fun.data
-

A function that is given the complete data and should -return a data frame with variables ymin, y, and ymax.

- - -
fun.ymin, fun.y, fun.ymax
-

Alternatively, supply three individual -functions that are each passed a vector of x's and should return a -single number.

- - -
fun.args
-

Optional additional arguments passed on to the functions.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

stat_summary understands the following aesthetics (required aesthetics are in bold):

  • x

  • -
  • y

  • -
-
-

Summary functions

- - -

You can either supply summary functions individually (fun.y, -fun.ymax, fun.ymin), or as a single function (fun.data):

-
fun.data
-

Complete summary function. Should take numeric vector as - input and return data frame as output

- -
fun.ymin
-

ymin summary function (should take numeric vector and - return single number)

- -
fun.y
-

y summary function (should take numeric vector and return - single number)

- -
fun.ymax
-

ymax summary function (should take numeric vector and - return single number)

- - -

A simple vector function is easiest to work with as you can return a single -number, but is somewhat less flexible. If your summary function computes -multiple values at once (e.g. ymin and ymax), use fun.data.

-

If no aggregation functions are suppled, will default to -mean_se.

-
-
-

See also

-

geom_errorbar, geom_pointrange, - geom_linerange, geom_crossbar for geoms to - display summarised data

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_summary_2d-1.png b/docs/reference/stat_summary_2d-1.png deleted file mode 100644 index b70fcbcfd..000000000 Binary files a/docs/reference/stat_summary_2d-1.png and /dev/null differ diff --git a/docs/reference/stat_summary_2d-2.png b/docs/reference/stat_summary_2d-2.png deleted file mode 100644 index 1534617d8..000000000 Binary files a/docs/reference/stat_summary_2d-2.png and /dev/null differ diff --git a/docs/reference/stat_summary_2d-3.png b/docs/reference/stat_summary_2d-3.png deleted file mode 100644 index 19594af11..000000000 Binary files a/docs/reference/stat_summary_2d-3.png and /dev/null differ diff --git a/docs/reference/stat_summary_2d-4.png b/docs/reference/stat_summary_2d-4.png deleted file mode 100644 index 7004c3ab9..000000000 Binary files a/docs/reference/stat_summary_2d-4.png and /dev/null differ diff --git a/docs/reference/stat_summary_2d-5.png b/docs/reference/stat_summary_2d-5.png deleted file mode 100644 index 705083dd7..000000000 Binary files a/docs/reference/stat_summary_2d-5.png and /dev/null differ diff --git a/docs/reference/stat_summary_2d.html b/docs/reference/stat_summary_2d.html deleted file mode 100644 index dbbfcf0c6..000000000 --- a/docs/reference/stat_summary_2d.html +++ /dev/null @@ -1,245 +0,0 @@ - -Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d • animint2 - Skip to contents - - -
-
-
- -
-

stat_summary_2d is a 2d variation of stat_summary. -stat_summary_hex is a hexagonal variation of -stat_summary_2d. The data are divided into bins defined -by x and y, and then the values of z in each cell is -are summarised with fun.

-
- -
-

Usage

-
stat_summary_2d(
-  mapping = NULL,
-  data = NULL,
-  geom = "tile",
-  position = "identity",
-  ...,
-  bins = 30,
-  binwidth = NULL,
-  drop = TRUE,
-  fun = "mean",
-  fun.args = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
-stat_summary_hex(
-  mapping = NULL,
-  data = NULL,
-  geom = "hex",
-  position = "identity",
-  ...,
-  bins = 30,
-  binwidth = NULL,
-  drop = TRUE,
-  fun = "mean",
-  fun.args = list(),
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
bins
-

numeric vector giving number of bins in both vertical and -horizontal directions. Set to 30 by default.

- - -
binwidth
-

Numeric vector giving bin width in both vertical and -horizontal directions. Overrides bins if both set.

- - -
drop
-

drop if the output of fun is NA.

- - -
fun
-

function for summary.

- - -
fun.args
-

A list of extra arguments to pass to fun

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -
  • x: horizontal position

  • -
  • y: vertical position

  • -
  • z: value passed to the summary function

  • -
-
-

Computed variables

- - -
x,y
-

Location

- -
value
-

Value of summary statistic.

- - -
-
-

See also

-

stat_summary_hex for hexagonal summarization. - stat_bin2d for the binning options.

-
- -
-

Examples

-
d <- ggplot(diamonds, aes(carat, depth, z = price))
-d + stat_summary_2d()
-
-
-# Specifying function
-d + stat_summary_2d(fun = function(x) sum(x^2))
-
-d + stat_summary_2d(fun = var)
-
-d + stat_summary_2d(fun = "quantile", fun.args = list(probs = 0.1))
-
-
-if (requireNamespace("hexbin")) {
-d + stat_summary_hex()
-}
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/stat_unique-1.png b/docs/reference/stat_unique-1.png deleted file mode 100644 index 49f842b38..000000000 Binary files a/docs/reference/stat_unique-1.png and /dev/null differ diff --git a/docs/reference/stat_unique-2.png b/docs/reference/stat_unique-2.png deleted file mode 100644 index d3964b7b5..000000000 Binary files a/docs/reference/stat_unique-2.png and /dev/null differ diff --git a/docs/reference/stat_unique.html b/docs/reference/stat_unique.html deleted file mode 100644 index 18a2bf249..000000000 --- a/docs/reference/stat_unique.html +++ /dev/null @@ -1,159 +0,0 @@ - -Remove duplicates. — stat_unique • animint2 - Skip to contents - - -
-
-
- -
-

Remove duplicates.

-
- -
-

Usage

-
stat_unique(
-  mapping = NULL,
-  data = NULL,
-  geom = "point",
-  position = "identity",
-  ...,
-  na.rm = FALSE,
-  show.legend = NA,
-  inherit.aes = TRUE
-)
-
- -
-

Arguments

-
mapping
-

Set of aesthetic mappings created by aes or -aes_. If specified and inherit.aes = TRUE (the -default), it is combined with the default mapping at the top level of the -plot. You must supply mapping if there is no plot mapping.

- - -
data
-

The data to be displayed in this layer. There are three - options:

-

If NULL, the default, the data is inherited from the plot - data as specified in the call to ggplot.

-

A data.frame, or other object, will override the plot - data. All objects will be fortified to produce a data frame. See - fortify for which variables will be created.

-

A function will be called with a single argument, - the plot data. The return value must be a data.frame., and - will be used as the layer data.

- - -
geom
-

The geometric object to use display the data

- - -
position
-

Position adjustment, either as a string, or the result of -a call to a position adjustment function.

- - -
...
-

other arguments passed on to layer. These are -often aesthetics, used to set an aesthetic to a fixed value, like -color = "red" or size = 3. They may also be parameters -to the paired geom/stat.

- - -
na.rm
-

If FALSE (the default), removes missing values with -a warning. If TRUE silently removes missing values.

- - -
show.legend
-

logical. Should this layer be included in the legends? -NA, the default, includes if any aesthetics are mapped. -FALSE never includes, and TRUE always includes.

- - -
inherit.aes
-

If FALSE, overrides the default aesthetics, -rather than combining with them. This is most useful for helper functions -that define both data and aesthetics and shouldn't inherit behaviour from -the default plot specification, e.g. borders.

- -
-
-

Aesthetics

- - -

stat_unique understands the following aesthetics (required aesthetics are in bold):

  • -
- -
-

Examples

-
ggplot(mtcars, aes(vs, am)) + geom_point(alpha = 0.1)
-
-ggplot(mtcars, aes(vs, am)) + geom_point(alpha = 0.1, stat="unique")
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/summary.gganimintplot.html b/docs/reference/summary.gganimintplot.html deleted file mode 100644 index 673a77a98..000000000 --- a/docs/reference/summary.gganimintplot.html +++ /dev/null @@ -1,106 +0,0 @@ - -Displays a useful description of a ggplot object — summary.gganimintplot • animint2 - Skip to contents - - -
-
-
- -
-

Displays a useful description of a ggplot object

-
- -
-

Usage

-
# S3 method for gganimintplot
-summary(object, ...)
-
- -
-

Arguments

-
object
-

ggplot2 object to summarise

- - -
...
-

other arguments ignored (for compatibility with generic)

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(mpg, wt)) +
-  geom_point()
-summary(p)
-#> data: mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb [32x11]
-#> mapping:  x = mpg, y = wt
-#> faceting: facet_null() 
-#> -----------------------------------
-#> geom_point: na.rm = FALSE
-#> stat_identity: na.rm = FALSE
-#> position_identity 
-#> 
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/switch_axes.html b/docs/reference/switch_axes.html deleted file mode 100644 index 71d94ae6a..000000000 --- a/docs/reference/switch_axes.html +++ /dev/null @@ -1,98 +0,0 @@ - -Flip axes in case of coord_flip -Switches column names. Eg. xmin to ymin, yntercept to xintercept etc. — switch_axes • animint2 - Skip to contents - - -
-
-
- -
-

Flip axes in case of coord_flip -Switches column names. Eg. xmin to ymin, yntercept to xintercept etc.

-
- -
-

Usage

-
switch_axes(col.names)
-
- -
-

Arguments

-
col.names
-

Column names which need to be switched

- -
-
-

Value

- - -

Column names with x and y axes switched

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/theme-1.png b/docs/reference/theme-1.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/theme-1.png and /dev/null differ diff --git a/docs/reference/theme-10.png b/docs/reference/theme-10.png deleted file mode 100644 index 7178fc208..000000000 Binary files a/docs/reference/theme-10.png and /dev/null differ diff --git a/docs/reference/theme-11.png b/docs/reference/theme-11.png deleted file mode 100644 index 3e27ca279..000000000 Binary files a/docs/reference/theme-11.png and /dev/null differ diff --git a/docs/reference/theme-12.png b/docs/reference/theme-12.png deleted file mode 100644 index 7ff5a9b0b..000000000 Binary files a/docs/reference/theme-12.png and /dev/null differ diff --git a/docs/reference/theme-13.png b/docs/reference/theme-13.png deleted file mode 100644 index 5dd49bb72..000000000 Binary files a/docs/reference/theme-13.png and /dev/null differ diff --git a/docs/reference/theme-14.png b/docs/reference/theme-14.png deleted file mode 100644 index 7ff5a9b0b..000000000 Binary files a/docs/reference/theme-14.png and /dev/null differ diff --git a/docs/reference/theme-15.png b/docs/reference/theme-15.png deleted file mode 100644 index 94db4d89f..000000000 Binary files a/docs/reference/theme-15.png and /dev/null differ diff --git a/docs/reference/theme-16.png b/docs/reference/theme-16.png deleted file mode 100644 index 372536711..000000000 Binary files a/docs/reference/theme-16.png and /dev/null differ diff --git a/docs/reference/theme-17.png b/docs/reference/theme-17.png deleted file mode 100644 index 98343a237..000000000 Binary files a/docs/reference/theme-17.png and /dev/null differ diff --git a/docs/reference/theme-18.png b/docs/reference/theme-18.png deleted file mode 100644 index 43554075a..000000000 Binary files a/docs/reference/theme-18.png and /dev/null differ diff --git a/docs/reference/theme-19.png b/docs/reference/theme-19.png deleted file mode 100644 index b0744cbdb..000000000 Binary files a/docs/reference/theme-19.png and /dev/null differ diff --git a/docs/reference/theme-2.png b/docs/reference/theme-2.png deleted file mode 100644 index 222cf771d..000000000 Binary files a/docs/reference/theme-2.png and /dev/null differ diff --git a/docs/reference/theme-20.png b/docs/reference/theme-20.png deleted file mode 100644 index 9e3c4a2bb..000000000 Binary files a/docs/reference/theme-20.png and /dev/null differ diff --git a/docs/reference/theme-21.png b/docs/reference/theme-21.png deleted file mode 100644 index 1ec47d4db..000000000 Binary files a/docs/reference/theme-21.png and /dev/null differ diff --git a/docs/reference/theme-22.png b/docs/reference/theme-22.png deleted file mode 100644 index 107782b25..000000000 Binary files a/docs/reference/theme-22.png and /dev/null differ diff --git a/docs/reference/theme-23.png b/docs/reference/theme-23.png deleted file mode 100644 index 8324bf4c5..000000000 Binary files a/docs/reference/theme-23.png and /dev/null differ diff --git a/docs/reference/theme-24.png b/docs/reference/theme-24.png deleted file mode 100644 index 03ceaa854..000000000 Binary files a/docs/reference/theme-24.png and /dev/null differ diff --git a/docs/reference/theme-25.png b/docs/reference/theme-25.png deleted file mode 100644 index 9b4a3c743..000000000 Binary files a/docs/reference/theme-25.png and /dev/null differ diff --git a/docs/reference/theme-26.png b/docs/reference/theme-26.png deleted file mode 100644 index 0abf3e663..000000000 Binary files a/docs/reference/theme-26.png and /dev/null differ diff --git a/docs/reference/theme-27.png b/docs/reference/theme-27.png deleted file mode 100644 index e461bd0a0..000000000 Binary files a/docs/reference/theme-27.png and /dev/null differ diff --git a/docs/reference/theme-28.png b/docs/reference/theme-28.png deleted file mode 100644 index 0e0f49033..000000000 Binary files a/docs/reference/theme-28.png and /dev/null differ diff --git a/docs/reference/theme-29.png b/docs/reference/theme-29.png deleted file mode 100644 index 7d700b112..000000000 Binary files a/docs/reference/theme-29.png and /dev/null differ diff --git a/docs/reference/theme-3.png b/docs/reference/theme-3.png deleted file mode 100644 index 63e4ef296..000000000 Binary files a/docs/reference/theme-3.png and /dev/null differ diff --git a/docs/reference/theme-30.png b/docs/reference/theme-30.png deleted file mode 100644 index afe2c1db1..000000000 Binary files a/docs/reference/theme-30.png and /dev/null differ diff --git a/docs/reference/theme-31.png b/docs/reference/theme-31.png deleted file mode 100644 index ce5fbd4bd..000000000 Binary files a/docs/reference/theme-31.png and /dev/null differ diff --git a/docs/reference/theme-32.png b/docs/reference/theme-32.png deleted file mode 100644 index 486ccc964..000000000 Binary files a/docs/reference/theme-32.png and /dev/null differ diff --git a/docs/reference/theme-33.png b/docs/reference/theme-33.png deleted file mode 100644 index f286aed18..000000000 Binary files a/docs/reference/theme-33.png and /dev/null differ diff --git a/docs/reference/theme-34.png b/docs/reference/theme-34.png deleted file mode 100644 index d54d9a54a..000000000 Binary files a/docs/reference/theme-34.png and /dev/null differ diff --git a/docs/reference/theme-35.png b/docs/reference/theme-35.png deleted file mode 100644 index ace383ec6..000000000 Binary files a/docs/reference/theme-35.png and /dev/null differ diff --git a/docs/reference/theme-36.png b/docs/reference/theme-36.png deleted file mode 100644 index 1272850e2..000000000 Binary files a/docs/reference/theme-36.png and /dev/null differ diff --git a/docs/reference/theme-37.png b/docs/reference/theme-37.png deleted file mode 100644 index d7202357a..000000000 Binary files a/docs/reference/theme-37.png and /dev/null differ diff --git a/docs/reference/theme-38.png b/docs/reference/theme-38.png deleted file mode 100644 index a08cf8587..000000000 Binary files a/docs/reference/theme-38.png and /dev/null differ diff --git a/docs/reference/theme-39.png b/docs/reference/theme-39.png deleted file mode 100644 index 474e3bb2e..000000000 Binary files a/docs/reference/theme-39.png and /dev/null differ diff --git a/docs/reference/theme-4.png b/docs/reference/theme-4.png deleted file mode 100644 index 4edbfb613..000000000 Binary files a/docs/reference/theme-4.png and /dev/null differ diff --git a/docs/reference/theme-40.png b/docs/reference/theme-40.png deleted file mode 100644 index 4cf8f3b60..000000000 Binary files a/docs/reference/theme-40.png and /dev/null differ diff --git a/docs/reference/theme-41.png b/docs/reference/theme-41.png deleted file mode 100644 index 1ec47d4db..000000000 Binary files a/docs/reference/theme-41.png and /dev/null differ diff --git a/docs/reference/theme-42.png b/docs/reference/theme-42.png deleted file mode 100644 index a19be37e6..000000000 Binary files a/docs/reference/theme-42.png and /dev/null differ diff --git a/docs/reference/theme-43.png b/docs/reference/theme-43.png deleted file mode 100644 index 1dd834564..000000000 Binary files a/docs/reference/theme-43.png and /dev/null differ diff --git a/docs/reference/theme-44.png b/docs/reference/theme-44.png deleted file mode 100644 index 4366c2f8b..000000000 Binary files a/docs/reference/theme-44.png and /dev/null differ diff --git a/docs/reference/theme-45.png b/docs/reference/theme-45.png deleted file mode 100644 index a628ab740..000000000 Binary files a/docs/reference/theme-45.png and /dev/null differ diff --git a/docs/reference/theme-46.png b/docs/reference/theme-46.png deleted file mode 100644 index 63bc6cb42..000000000 Binary files a/docs/reference/theme-46.png and /dev/null differ diff --git a/docs/reference/theme-47.png b/docs/reference/theme-47.png deleted file mode 100644 index 2d77dc7f0..000000000 Binary files a/docs/reference/theme-47.png and /dev/null differ diff --git a/docs/reference/theme-48.png b/docs/reference/theme-48.png deleted file mode 100644 index fbf6a7d06..000000000 Binary files a/docs/reference/theme-48.png and /dev/null differ diff --git a/docs/reference/theme-5.png b/docs/reference/theme-5.png deleted file mode 100644 index 087d1f308..000000000 Binary files a/docs/reference/theme-5.png and /dev/null differ diff --git a/docs/reference/theme-6.png b/docs/reference/theme-6.png deleted file mode 100644 index 09f0d00f5..000000000 Binary files a/docs/reference/theme-6.png and /dev/null differ diff --git a/docs/reference/theme-7.png b/docs/reference/theme-7.png deleted file mode 100644 index 0e0a002ca..000000000 Binary files a/docs/reference/theme-7.png and /dev/null differ diff --git a/docs/reference/theme-8.png b/docs/reference/theme-8.png deleted file mode 100644 index 0e0a002ca..000000000 Binary files a/docs/reference/theme-8.png and /dev/null differ diff --git a/docs/reference/theme-9.png b/docs/reference/theme-9.png deleted file mode 100644 index 26f783933..000000000 Binary files a/docs/reference/theme-9.png and /dev/null differ diff --git a/docs/reference/theme.html b/docs/reference/theme.html deleted file mode 100644 index d1b627b3c..000000000 --- a/docs/reference/theme.html +++ /dev/null @@ -1,376 +0,0 @@ - -Set theme elements — theme • animint2 - Skip to contents - - -
-
-
- -
-

Use this function to modify theme settings.

-
- -
-

Usage

-
theme(..., complete = FALSE, validate = TRUE)
-
- -
-

Arguments

-
...
-

a list of element name, element pairings that modify the -existing theme.

- - -
complete
-

set this to TRUE if this is a complete theme, such as -the one returned by theme_grey(). Complete themes behave -differently when added to a ggplot object.

- - -
validate
-

TRUE to run validate_element, FALSE to bypass checks.

- -
-
-

Details

-

Theme elements can inherit properties from other theme elements. -For example, axis.title.x inherits from axis.title, -which in turn inherits from text. All text elements inherit -directly or indirectly from text; all lines inherit from -line, and all rectangular objects inherit from rect.

-

For more examples of modifying properties using inheritance, -%+replace%.

-

To see a graphical representation of the inheritance tree, see the -last example below.

-
-
-

Theme elements

- - -

The individual theme elements are:

-
lineall line elements - (element_line)
rectall rectangular elements - (element_rect)
textall text elements - (element_text)
titleall title elements: plot, axes, legends - (element_text; inherits from text)
aspect.ratioaspect ratio of the panel
axis.titlelabel of axes - (element_text; inherits from text)
axis.title.xx axis label - (element_text; inherits from axis.title)
axis.title.yy axis label - (element_text; inherits from axis.title)
axis.texttick labels along axes - (element_text; inherits from text)
axis.text.xx axis tick labels - (element_text; inherits from axis.text)
axis.text.yy axis tick labels - (element_text; inherits from axis.text)
axis.tickstick marks along axes - (element_line; inherits from line)
axis.ticks.xx axis tick marks - (element_line; inherits from axis.ticks)
axis.ticks.yy axis tick marks - (element_line; inherits from axis.ticks)
axis.ticks.lengthlength of tick marks - (unit)
axis.linelines along axes - (element_line; inherits from line)
axis.line.xline along x axis - (element_line; inherits from axis.line)
axis.line.yline along y axis - (element_line; inherits from axis.line)
legend.backgroundbackground of legend - (element_rect; inherits from rect)
legend.marginextra space added around legend - (unit)
legend.keybackground underneath legend keys - (element_rect; inherits from rect)
legend.key.sizesize of legend keys - (unit; inherits from legend.key.size)
legend.key.heightkey background height - (unit; inherits from legend.key.size)
legend.key.widthkey background width - (unit; inherits from legend.key.size)
legend.textlegend item labels - (element_text; inherits from text)
legend.text.alignalignment of legend labels - (number from 0 (left) to 1 (right))
legend.titletitle of legend - (element_text; inherits from title)
legend.title.alignalignment of legend title - (number from 0 (left) to 1 (right))
legend.positionthe position of legends - ("none", "left", "right", "bottom", "top", or two-element - numeric vector)
legend.directionlayout of items in legends - ("horizontal" or "vertical")
legend.justificationanchor point for positioning legend inside plot - ("center" or two-element numeric vector)
legend.boxarrangement of multiple legends - ("horizontal" or "vertical")
legend.box.justjustification of each legend within the overall - bounding box, when there are multiple legends - ("top", "bottom", "left", or "right")
panel.backgroundbackground of plotting area, drawn underneath plot - (element_rect; inherits from rect)
panel.borderborder around plotting area, drawn on top of plot - so that it covers tick marks and grid lines. This should - be used with fill=NA - (element_rect; inherits from rect)
panel.marginmargin around facet panels - (unit)
panel.margin.xhorizontal margin around facet panels - (unit; inherits from panel.margin)
panel.margin.yvertical margin around facet panels - (unit; inherits from panel.margin)
panel.gridgrid lines - (element_line; inherits from line)
panel.grid.majormajor grid lines - (element_line; inherits from panel.grid)
panel.grid.minorminor grid lines - (element_line; inherits from panel.grid)
panel.grid.major.xvertical major grid lines - (element_line; inherits from panel.grid.major)
panel.grid.major.yhorizontal major grid lines - (element_line; inherits from panel.grid.major)
panel.grid.minor.xvertical minor grid lines - (element_line; inherits from panel.grid.minor)
panel.grid.minor.yhorizontal minor grid lines - (element_line; inherits from panel.grid.minor)
panel.ontopoption to place the panel (background, gridlines) - over the data layers. Usually used with a transparent - or blank panel.background. (logical)
plot.backgroundbackground of the entire plot - (element_rect; inherits from rect)
plot.titleplot title (text appearance) - (element_text; inherits from title) - left-aligned by default
plot.subtitleplot subtitle (text appearance) - (element_text; inherits from title) - left-aligned by default
plot.captioncaption below the plot (text appearance) - (element_text; inherits from title) - right-aligned by default
plot.marginmargin around entire plot - (unit with the sizes of the top, right, bottom, and - left margins)
strip.backgroundbackground of facet labels - (element_rect; inherits from rect)
strip.textfacet labels - (element_text; inherits from text)
strip.text.xfacet labels along horizontal direction - (element_text; inherits from strip.text)
strip.text.yfacet labels along vertical direction - (element_text; inherits from strip.text)
strip.switch.pad.gridspace between strips and axes when strips are switched - (unit)
strip.switch.pad.wrapspace between strips and axes when strips are switched - (unit)
- - -
-

Examples

-
# \donttest{
-p <- ggplot(mtcars, aes(mpg, wt)) +
-  geom_point()
-p
-
-p + theme(panel.background = element_rect(colour = "pink"))
-
-p + theme_bw()
-
-
-# Scatter plot of gas mileage by vehicle weight
-p <- ggplot(mtcars, aes(wt, mpg)) +
-  geom_point()
-# Calculate slope and intercept of line of best fit
-coef(lm(mpg ~ wt, data = mtcars))
-#> (Intercept)          wt 
-#>   37.285126   -5.344472 
-p + geom_abline(intercept = 37, slope = -5)
-
-# Calculate correlation coefficient
-with(mtcars, cor(wt, mpg, use = "everything", method = "pearson"))
-#> [1] -0.8676594
-#annotate the plot
-p + geom_abline(intercept = 37, slope = -5) +
-geom_text(data = data.frame(), aes(4.5, 30, label = "Pearson-R = -.87"))
-
-
-# Change the axis labels
-# Original plot
-p
-
-p + labs(x = "Vehicle Weight", y = "Miles per Gallon")
-
-# Or
-p + labs(x = "Vehicle Weight", y = "Miles per Gallon")
-
-
-# Change title appearance
-p <- p + labs(title = "Vehicle Weight-Gas Mileage Relationship")
-# Set title to twice the base font size
-p + theme(plot.title = element_text(size = rel(2)))
-
-p + theme(plot.title = element_text(size = rel(2), colour = "blue"))
-
-
-# Add a subtitle and adjust bottom margin
-p + labs(title = "Vehicle Weight-Gas Mileage Relationship",
-         subtitle = "You need to wrap long subtitleson manually") +
-    theme(plot.subtitle = element_text(margin = margin(b = 20)))
-
-
-# Changing plot look with themes
-DF <- data.frame(x = rnorm(400))
-m <- ggplot(DF, aes(x = x)) +
-  geom_histogram()
-# Default is theme_grey()
-m
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-# Compare with
-m + theme_bw()
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-
-# Manipulate Axis Attributes
-m + theme(axis.line = element_line(size = 3, colour = "red", linetype = "dotted"))
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-m + theme(axis.text = element_text(colour = "blue"))
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-m + theme(axis.text.y = element_blank())
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-m + theme(axis.ticks = element_line(size = 2))
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-m + theme(axis.title.y = element_text(size = rel(1.5), angle = 90))
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-m + theme(axis.title.x = element_blank())
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-m + theme(axis.ticks.length = unit(.85, "cm"))
-#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
-
-
-# Legend Attributes
-z <- ggplot(mtcars, aes(wt, mpg)) +
-  geom_point(aes(colour = factor(cyl)))
-z
-
-z + theme(legend.position = "none")
-
-z + theme(legend.position = "bottom")
-
-# Or use relative coordinates between 0 and 1
-z + theme(legend.position = c(.5, .5))
-
-# Add a border to the whole legend
-z + theme(legend.background = element_rect(colour = "black"))
-
-# Legend margin controls extra space around outside of legend:
-z + theme(legend.background = element_rect(),
-          legend.margin = unit(1, "cm"))
-
-z + theme(legend.background = element_rect(),
-          legend.margin = unit(0, "cm"))
-
-# Or to just the keys
-z + theme(legend.key = element_rect(colour = "black"))
-
-z + theme(legend.key = element_rect(fill = "yellow"))
-
-z + theme(legend.key.size = unit(2.5, "cm"))
-
-z + theme(legend.text = element_text(size = 20, colour = "red", angle = 45))
-
-z + theme(legend.title = element_text(face = "italic"))
-
-
-# To change the title of the legend use the name argument
-# in one of the scale options
-z + scale_colour_brewer(name = "My Legend")
-
-z + scale_colour_grey(name = "Number of \nCylinders")
-
-
-# Panel and Plot Attributes
-z + theme(panel.background = element_rect(fill = "black"))
-
-z + theme(panel.border = element_rect(linetype = "dashed", colour = "black"))
-
-z + theme(panel.grid.major = element_line(colour = "blue"))
-
-z + theme(panel.grid.minor = element_line(colour = "red", linetype = "dotted"))
-
-z + theme(panel.grid.major = element_line(size = 2))
-
-z + theme(panel.grid.major.y = element_blank(),
-          panel.grid.minor.y = element_blank())
-
-z + theme(plot.background = element_rect())
-
-z + theme(plot.background = element_rect(fill = "green"))
-
-
-# Faceting Attributes
-set.seed(4940)
-dsmall <- diamonds[sample(nrow(diamonds), 1000), ]
-k <- ggplot(dsmall, aes(carat, ..density..)) +
-  geom_histogram(binwidth = 0.2) +
-  facet_grid(. ~ cut)
-k + theme(strip.background = element_rect(colour = "purple", fill = "pink",
-                                          size = 3, linetype = "dashed"))
-
-k + theme(strip.text.x = element_text(colour = "red", angle = 45, size = 10,
-                                      hjust = 0.5, vjust = 0.5))
-
-k + theme(panel.margin = unit(5, "lines"))
-
-k + theme(panel.margin.y = unit(0, "lines"))
-
-
-# Put gridlines on top
-meanprice <- tapply(diamonds$price, diamonds$cut, mean)
-cut <- factor(levels(diamonds$cut), levels = levels(diamonds$cut))
-df <- data.frame(meanprice, cut)
-g <- ggplot(df, aes(cut, meanprice)) + geom_bar(stat = "identity")
-g + geom_bar(stat = "identity") +
-    theme(panel.background = element_blank(),
-          panel.grid.major.x = element_blank(),
-          panel.grid.minor.x = element_blank(),
-          panel.grid.minor.y = element_blank(),
-          panel.ontop = TRUE)
-
-
-# Modify a theme and save it
-mytheme <- theme_grey() + theme(plot.title = element_text(colour = "red"))
-p + mytheme
-
-
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/theme_animint.html b/docs/reference/theme_animint.html deleted file mode 100644 index 1f2dee2ce..000000000 --- a/docs/reference/theme_animint.html +++ /dev/null @@ -1,120 +0,0 @@ - -theme for passing animint specific params — theme_animint • animint2 - Skip to contents - - -
-
-
- -
-

Theme without checks. This allows us to write -theme_animint(width=500), instead of theme(animint.width=500) -which gives an error in ggplot2 because users should be informed -if they mis-type standard theme element -names. https://github.com/hadley/ggplot2/issues/938

-
- -
-

Usage

-
theme_animint(...)
-
- -
-

Arguments

-
...
-

theme options such as width. Use update_axes=c("x", "y") to update the axes of plots. Works for single selection variables.

- -
-
-

Value

- - -

ggplot theme list with names such as animint.width.

-
-
-

Author

-

Toby Dylan Hocking

-
- -
-

Examples

-
mtcars$cyl <- as.factor(mtcars$cyl)
-p <- ggplot() +
-  geom_point(aes(x=wt, y=mpg, colour=cyl),
-             data=mtcars) +
-  ## set width and height values and update both axes
-  theme_animint(width=600, height=600, update_axes=c("x", "y"))
-viz <- list(plot=p, selector.types=list(cyl="single"))
-animint2dir(viz)
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/theme_update-1.png b/docs/reference/theme_update-1.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/theme_update-1.png and /dev/null differ diff --git a/docs/reference/theme_update-2.png b/docs/reference/theme_update-2.png deleted file mode 100644 index 63e4ef296..000000000 Binary files a/docs/reference/theme_update-2.png and /dev/null differ diff --git a/docs/reference/theme_update-3.png b/docs/reference/theme_update-3.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/theme_update-3.png and /dev/null differ diff --git a/docs/reference/theme_update-4.png b/docs/reference/theme_update-4.png deleted file mode 100644 index af0746814..000000000 Binary files a/docs/reference/theme_update-4.png and /dev/null differ diff --git a/docs/reference/theme_update-5.png b/docs/reference/theme_update-5.png deleted file mode 100644 index 222cf771d..000000000 Binary files a/docs/reference/theme_update-5.png and /dev/null differ diff --git a/docs/reference/theme_update-6.png b/docs/reference/theme_update-6.png deleted file mode 100644 index 7446ba7a0..000000000 Binary files a/docs/reference/theme_update-6.png and /dev/null differ diff --git a/docs/reference/theme_update-7.png b/docs/reference/theme_update-7.png deleted file mode 100644 index 65877edae..000000000 Binary files a/docs/reference/theme_update-7.png and /dev/null differ diff --git a/docs/reference/theme_update.html b/docs/reference/theme_update.html deleted file mode 100644 index 52b68de1b..000000000 --- a/docs/reference/theme_update.html +++ /dev/null @@ -1,458 +0,0 @@ - -Get, set and update themes. — theme_update • animint2 - Skip to contents - - -
-
-
- -
-

Use theme_get to get the current theme, and theme_set to -completely override it. theme_update and theme_replace are -shorthands for changing individual elements in the current theme. -theme_update uses the + operator, so that any unspecified -values in the theme element will default to the values they are set in the -theme. theme_replace will completely replace the element, so any -unspecified values will overwrite the current value in the theme with NULLs.

-
- -
-

Usage

-
theme_update(...)
-
-theme_replace(...)
-
-theme_get()
-
-theme_set(new)
-
- -
-

Arguments

-
...
-

named list of theme settings

- - -
new
-

new theme (a list of theme elements)

- -
-
-

See also

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(mpg, wt)) +
-  geom_point()
-p
-
-old <- theme_set(theme_bw())
-p
-
-theme_set(old)
-p
-
-
-#theme_replace NULLs out the fill attribute of panel.background,
-#resulting in a white background:
-theme_get()$panel.background
-#> List of 4
-#>  $ fill    : chr "grey92"
-#>  $ colour  : logi NA
-#>  $ size    : NULL
-#>  $ linetype: NULL
-#>  - attr(*, "class")= chr [1:2] "element_rect" "element"
-old <- theme_replace(panel.background = element_rect(colour = "pink"))
-theme_get()$panel.background
-#> List of 4
-#>  $ fill    : NULL
-#>  $ colour  : chr "pink"
-#>  $ size    : NULL
-#>  $ linetype: NULL
-#>  - attr(*, "class")= chr [1:2] "element_rect" "element"
-p
-
-theme_set(old)
-
-#theme_update only changes the colour attribute, leaving the others intact:
-old <- theme_update(panel.background = element_rect(colour = "pink"))
-theme_get()$panel.background
-#> List of 4
-#>  $ fill    : chr "grey92"
-#>  $ colour  : chr "pink"
-#>  $ size    : NULL
-#>  $ linetype: NULL
-#>  - attr(*, "class")= chr [1:2] "element_rect" "element"
-p
-
-theme_set(old)
-
-theme_get()
-#> List of 46
-#>  $ line                 :List of 4
-#>   ..$ colour  : chr "black"
-#>   ..$ size    : num 0.5
-#>   ..$ linetype: num 1
-#>   ..$ lineend : chr "butt"
-#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
-#>  $ rect                 :List of 4
-#>   ..$ fill    : chr "white"
-#>   ..$ colour  : chr "black"
-#>   ..$ size    : num 0.5
-#>   ..$ linetype: num 1
-#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
-#>  $ text                 :List of 10
-#>   ..$ family    : chr ""
-#>   ..$ face      : chr "plain"
-#>   ..$ colour    : chr "black"
-#>   ..$ size      : num 11
-#>   ..$ hjust     : num 0.5
-#>   ..$ vjust     : num 0.5
-#>   ..$ angle     : num 0
-#>   ..$ lineheight: num 0.9
-#>   ..$ margin    : 'margin' num [1:4] 0points 0points 0points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : logi FALSE
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ axis.line            :List of 4
-#>   ..$ colour  : NULL
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..$ lineend : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
-#>  $ axis.line.x          : list()
-#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
-#>  $ axis.line.y          : list()
-#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
-#>  $ axis.text            :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : chr "grey30"
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : NULL
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ axis.text.x          :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : num 1
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 2.2points 0points 0points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ axis.text.y          :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : num 1
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 0points 2.2points 0points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ axis.ticks           :List of 4
-#>   ..$ colour  : chr "grey20"
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..$ lineend : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
-#>  $ axis.ticks.length    : 'simpleUnit' num 2.75points
-#>   ..- attr(*, "unit")= int 8
-#>  $ axis.title.x         :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 4.4points 0points 2.2points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ axis.title.y         :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : num 90
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 0points 4.4points 0points 2.2points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ legend.background    :List of 4
-#>   ..$ fill    : NULL
-#>   ..$ colour  : logi NA
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
-#>  $ legend.margin        : 'simpleUnit' num 0.2cm
-#>   ..- attr(*, "unit")= int 1
-#>  $ legend.key           :List of 4
-#>   ..$ fill    : chr "grey95"
-#>   ..$ colour  : chr "white"
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
-#>  $ legend.key.size      : 'simpleUnit' num 1.2lines
-#>   ..- attr(*, "unit")= int 3
-#>  $ legend.key.height    : NULL
-#>  $ legend.key.width     : NULL
-#>  $ legend.text          :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : 'rel' num 0.8
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : NULL
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ legend.text.align    : NULL
-#>  $ legend.title         :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : num 0
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : NULL
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ legend.title.align   : NULL
-#>  $ legend.position      : chr "right"
-#>  $ legend.direction     : NULL
-#>  $ legend.justification : chr "center"
-#>  $ legend.box           : NULL
-#>  $ panel.background     :List of 4
-#>   ..$ fill    : chr "grey92"
-#>   ..$ colour  : logi NA
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
-#>  $ panel.border         : list()
-#>   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
-#>  $ panel.grid.major     :List of 4
-#>   ..$ colour  : chr "white"
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..$ lineend : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
-#>  $ panel.grid.minor     :List of 4
-#>   ..$ colour  : chr "white"
-#>   ..$ size    : num 0.25
-#>   ..$ linetype: NULL
-#>   ..$ lineend : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_line" "element"
-#>  $ panel.margin         : 'simpleUnit' num 5.5points
-#>   ..- attr(*, "unit")= int 8
-#>  $ panel.margin.x       : NULL
-#>  $ panel.margin.y       : NULL
-#>  $ panel.ontop          : logi FALSE
-#>  $ strip.background     :List of 4
-#>   ..$ fill    : chr "grey85"
-#>   ..$ colour  : logi NA
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
-#>  $ strip.text           :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : chr "grey10"
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : NULL
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ strip.text.x         :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 5.5points 0points 5.5points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ strip.text.y         :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : NULL
-#>   ..$ hjust     : NULL
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : num -90
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 0points 5.5points 0points 5.5points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ strip.switch.pad.grid: 'simpleUnit' num 0.1cm
-#>   ..- attr(*, "unit")= int 1
-#>  $ strip.switch.pad.wrap: 'simpleUnit' num 0.1cm
-#>   ..- attr(*, "unit")= int 1
-#>  $ plot.background      :List of 4
-#>   ..$ fill    : NULL
-#>   ..$ colour  : chr "white"
-#>   ..$ size    : NULL
-#>   ..$ linetype: NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
-#>  $ plot.title           :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : 'rel' num 1.2
-#>   ..$ hjust     : num 0
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 0points 0points 6.6points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ plot.subtitle        :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : 'rel' num 0.9
-#>   ..$ hjust     : num 0
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 0points 0points 4.95points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ plot.caption         :List of 10
-#>   ..$ family    : NULL
-#>   ..$ face      : NULL
-#>   ..$ colour    : NULL
-#>   ..$ size      : 'rel' num 0.9
-#>   ..$ hjust     : num 1
-#>   ..$ vjust     : NULL
-#>   ..$ angle     : NULL
-#>   ..$ lineheight: NULL
-#>   ..$ margin    : 'margin' num [1:4] 0points 0points 4.95points 0points
-#>   .. ..- attr(*, "unit")= int 8
-#>   ..$ debug     : NULL
-#>   ..- attr(*, "class")= chr [1:2] "element_text" "element"
-#>  $ plot.margin          : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
-#>   ..- attr(*, "unit")= int 8
-#>  - attr(*, "class")= chr [1:2] "theme" "gganimint"
-#>  - attr(*, "complete")= logi TRUE
-#>  - attr(*, "validate")= logi TRUE
-
-
-ggplot(mtcars, aes(mpg, wt)) +
-  geom_point(aes(color = mpg)) +
-  theme(legend.position = c(0.95, 0.95),
-        legend.justification = c(1, 1))
-
-last_plot() +
- theme(legend.background = element_rect(fill = "white", colour = "white", size = 3))
-
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/toRGB.html b/docs/reference/toRGB.html deleted file mode 100644 index 998485bfa..000000000 --- a/docs/reference/toRGB.html +++ /dev/null @@ -1,92 +0,0 @@ - -Convert R colors to RGB hexadecimal color values — toRGB • animint2 - Skip to contents - - -
-
-
- -
-

Convert R colors to RGB hexadecimal color values

-
- -
-

Usage

-
toRGB(x)
-
- -
-

Arguments

-
x
-

character

- -
-
-

Value

- - -

hexadecimal color value or "transparent" if is.na

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/train_position.html b/docs/reference/train_position.html deleted file mode 100644 index 6bf6a1b0c..000000000 --- a/docs/reference/train_position.html +++ /dev/null @@ -1,101 +0,0 @@ - -Train position scales with data — train_position • animint2 - Skip to contents - - -
-
-
- -
-

If panel-specific scales are not already present, will clone from -the scales provided in the parameter

-
- -
-

Usage

-
train_position(panel, data, x_scale, y_scale)
-
- -
-

Arguments

-
panel
-

the panel object to train

- - -
data
-

a list of data frames (one for each layer)

- - -
x_scale
-

x scale for the plot

- - -
y_scale
-

y scale for the plot

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/transform_position.html b/docs/reference/transform_position.html deleted file mode 100644 index a0c3ca93d..000000000 --- a/docs/reference/transform_position.html +++ /dev/null @@ -1,91 +0,0 @@ - -Convenience function to transform all position variables. — transform_position • animint2 - Skip to contents - - -
-
-
- -
-

Convenience function to transform all position variables.

-
- -
-

Usage

-
transform_position(df, trans_x = NULL, trans_y = NULL, ...)
-
- -
-

Arguments

-
trans_x, trans_y
-

Transformation functions for x and y aesthetics. -(will transform x, xmin, xmax, xend etc)

- - -
...
-

Additional arguments passed to trans_x and trans_y.

- -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/transform_shape.html b/docs/reference/transform_shape.html deleted file mode 100644 index cdbc0d43a..000000000 --- a/docs/reference/transform_shape.html +++ /dev/null @@ -1,92 +0,0 @@ - -Function to transform R shapes into d3 shapes... — transform_shape • animint2 - Skip to contents - - -
-
-
- -
-

Function to transform R shapes into d3 shapes...

-
- -
-

Usage

-
transform_shape(dframe)
-
- -
-

Arguments

-
dframe
-

Data frame with columns shape, fill, colour.

- -
-
-

Value

- - -

Data frame transformed so that shape corresponds to d3 shape. Also includes Rshape column for debugging.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/translate_qplot_ggplot.html b/docs/reference/translate_qplot_ggplot.html deleted file mode 100644 index 6bad575e9..000000000 --- a/docs/reference/translate_qplot_ggplot.html +++ /dev/null @@ -1,165 +0,0 @@ - -Translating between qplot and ggplot — translate_qplot_ggplot • animint2 - Skip to contents - - -
-
-
- -
-

Within ggplot2, there are two basic methods to create plots, with qplot() -and ggplot(). qplot() is designed primarily for interactive use: it makes -a number of assumptions that speed most cases, but when designing multilayered -plots with different data sources it can get in the way. This section -describes what those defaults are, and how they map to the fuller ggplot() -syntax.

-
- - - -
-

Examples

-

-# By default, qplot() assumes that you want a scatterplot,
-# i.e., you want to use geom_point()
-# qplot(x, y, data = data)
-# ggplot(data, aes(x, y)) + geom_point()
-
-# Using Aesthetics
-
-# If you map additional aesthetics, these will be added to the defaults. With
-# qplot() there is no way to use different aesthetic mappings (or data) in
-# different layers
-# qplot(x, y, data = data, shape = shape, colour = colour)
-# ggplot(data, aes(x, y, shape = shape, colour = colour)) + geom_point()
-#
-# Aesthetic parameters in qplot() always try to map the aesthetic to a
-# variable. If the argument is not a variable but a value, effectively a new column
-# is added to the original dataset with that value. To set an aesthetic to a
-# value and override the default appearance, you surround the value with I() in
-# qplot(), or pass it as a parameter to the layer.
-# qplot(x, y, data = data, colour = I("red"))
-# ggplot(data, aes(x, y)) + geom_point(colour = "red")
-
-# Changing the geom parameter changes the geom added to the plot
-# qplot(x, y, data = data, geom = "line")
-# ggplot(data, aes(x, y)) + geom_line()
-
-# Not all geoms require both x and y, e.g., geom_bar() and geom_histogram().
-# For these two geoms, if the y aesthetic is not supplied, both qplot and
-# ggplot commands default to "count" on the y-axis
-# ggplot(data, aes(x)) + geom_bar()
-# qplot(x, data = data, geom = "bar")
-
-# If a vector of multiple geom names is supplied to the geom argument, each
-# geom will be added in turn
-# qplot(x, y, data = data, geom = c("point", "smooth"))
-# ggplot(data, aes(x, y)) + geom_point() + geom_smooth()
-
-# Unlike the rest of ggplot2, stats and geoms are independent
-# qplot(x, y, data = data, stat = "bin")
-# ggplot(data, aes(x, y)) + geom_point(stat = "bin")
-#
-# Any layer parameters will be passed on to all layers. Most layers will ignore
-# parameters that they don't need
-# qplot(x, y, data = data, geom = c("point", "smooth"), method = "lm")
-# ggplot(data, aes(x, y)) + geom_point(method = "lm") + geom_smooth(method = "lm")
-
-# Scales and axes
-
-# You can control basic properties of the x and y scales with the xlim, ylim,
-# xlab and ylab arguments
-# qplot(x, y, data = data, xlim = c(1, 5), xlab = "my label")
-# ggplot(data, aes(x, y)) + geom_point() +
-# scale_x_continuous("my label", limits = c(1, 5))
-
-# qplot(x, y, data = data, xlim = c(1, 5), ylim = c(10, 20))
-# ggplot(data, aes(x, y)) + geom_point() +
-# scale_x_continuous(limits = c(1, 5)) + scale_y_continuous(limits = c(10, 20))
-
-# Like plot(), qplot() has a convenient way of log transforming the axes.
-# qplot(x, y, data = data, log = "xy")
-# ggplot(data, aes(x, y)) + geom_point() + scale_x_log10() + scale_y_log10()
-# There are many other possible transformations, but not all are
-# accessible from within qplot(), see ?scale_continuous for more
-
-# Plot options
-
-# qplot() recognises the same options as plot does, and converts them to their
-# ggplot2 equivalents. See ?theme for more on ggplot options
-# qplot(x, y, data = data, main="title", asp = 1)
-# ggplot(data, aes(x, y)) + geom_point() + labs(title = "title") + theme(aspect.ratio = 1)
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/translate_qplot_lattice-1.png b/docs/reference/translate_qplot_lattice-1.png deleted file mode 100644 index c1ac9c827..000000000 Binary files a/docs/reference/translate_qplot_lattice-1.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-10.png b/docs/reference/translate_qplot_lattice-10.png deleted file mode 100644 index e6dc5a33d..000000000 Binary files a/docs/reference/translate_qplot_lattice-10.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-11.png b/docs/reference/translate_qplot_lattice-11.png deleted file mode 100644 index a22ce35b1..000000000 Binary files a/docs/reference/translate_qplot_lattice-11.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-12.png b/docs/reference/translate_qplot_lattice-12.png deleted file mode 100644 index 9e414fe5f..000000000 Binary files a/docs/reference/translate_qplot_lattice-12.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-13.png b/docs/reference/translate_qplot_lattice-13.png deleted file mode 100644 index 94452dd08..000000000 Binary files a/docs/reference/translate_qplot_lattice-13.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-14.png b/docs/reference/translate_qplot_lattice-14.png deleted file mode 100644 index eb131fee6..000000000 Binary files a/docs/reference/translate_qplot_lattice-14.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-15.png b/docs/reference/translate_qplot_lattice-15.png deleted file mode 100644 index d7147415b..000000000 Binary files a/docs/reference/translate_qplot_lattice-15.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-2.png b/docs/reference/translate_qplot_lattice-2.png deleted file mode 100644 index 064ae3d46..000000000 Binary files a/docs/reference/translate_qplot_lattice-2.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-3.png b/docs/reference/translate_qplot_lattice-3.png deleted file mode 100644 index b0fbc5f32..000000000 Binary files a/docs/reference/translate_qplot_lattice-3.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-4.png b/docs/reference/translate_qplot_lattice-4.png deleted file mode 100644 index b2db82052..000000000 Binary files a/docs/reference/translate_qplot_lattice-4.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-5.png b/docs/reference/translate_qplot_lattice-5.png deleted file mode 100644 index 9479690f9..000000000 Binary files a/docs/reference/translate_qplot_lattice-5.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-6.png b/docs/reference/translate_qplot_lattice-6.png deleted file mode 100644 index 285283c12..000000000 Binary files a/docs/reference/translate_qplot_lattice-6.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-7.png b/docs/reference/translate_qplot_lattice-7.png deleted file mode 100644 index d12022e41..000000000 Binary files a/docs/reference/translate_qplot_lattice-7.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-8.png b/docs/reference/translate_qplot_lattice-8.png deleted file mode 100644 index 24fe49e3d..000000000 Binary files a/docs/reference/translate_qplot_lattice-8.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice-9.png b/docs/reference/translate_qplot_lattice-9.png deleted file mode 100644 index aab142318..000000000 Binary files a/docs/reference/translate_qplot_lattice-9.png and /dev/null differ diff --git a/docs/reference/translate_qplot_lattice.html b/docs/reference/translate_qplot_lattice.html deleted file mode 100644 index 8bf3ee5ca..000000000 --- a/docs/reference/translate_qplot_lattice.html +++ /dev/null @@ -1,165 +0,0 @@ - -Translating between qplot and lattice — translate_qplot_lattice • animint2 - Skip to contents - - -
-
-
- -
-

The major difference between lattice and ggplot2 is that lattice uses a -formula based interface. ggplot2 does not because the formula does not -generalise well to more complicated situations.

-
- - - -
-

Examples

-
# \donttest{
-library(lattice)
-
-if (require("ggplot2movies")) {
-xyplot(rating ~ year, data=movies)
-qplot(year, rating, data=movies)
-
-xyplot(rating ~ year | Comedy + Action, data = movies)
-qplot(year, rating, data = movies, facets = ~ Comedy + Action)
-# Or maybe
-qplot(year, rating, data = movies, facets = Comedy ~ Action)
-
-# While lattice has many different functions to produce different types of
-# graphics (which are all basically equivalent to setting the panel argument),
-# ggplot2 has qplot().
-
-stripplot(~ rating, data = movies, jitter.data = TRUE)
-qplot(rating, 1, data = movies, geom = "jitter")
-
-histogram(~ rating, data = movies)
-qplot(rating, data = movies, geom = "histogram")
-
-xyplot(wt ~ mpg, mtcars, type = c("p","smooth"))
-qplot(mpg, wt, data = mtcars, geom = c("point","smooth"))
-}
-
-
-# The capabilities for scale manipulations are similar in both ggplot2 and
-# lattice, although the syntax is a little different.
-
-xyplot(wt ~ mpg | cyl, mtcars, scales = list(y = list(relation = "free")))
-
-qplot(mpg, wt, data = mtcars) + facet_wrap(~ cyl, scales = "free")
-
-
-xyplot(wt ~ mpg | cyl, mtcars, scales = list(log = 10))
-
-qplot(mpg, wt, data = mtcars, log = "xy")
-
-
-xyplot(wt ~ mpg | cyl, mtcars, scales = list(log = 2))
-
-qplot(mpg, wt, data = mtcars) +
-  scale_x_continuous(trans = scales::log2_trans()) +
-  scale_y_continuous(trans = scales::log2_trans())
-
-
-xyplot(wt ~ mpg, mtcars, group = cyl, auto.key = TRUE)
-
-# Map directly to an aesthetic like colour, size, or shape.
-qplot(mpg, wt, data = mtcars, colour = cyl)
-
-
-xyplot(wt ~ mpg, mtcars, xlim = c(20,30))
-
-# Works like lattice, except you can't specify a different limit
-# for each panel/facet
-qplot(mpg, wt, data = mtcars, xlim = c(20,30))
-#> Warning: Removed 22 rows containing missing values (geom_point).
-
-
-# Both lattice and ggplot2 have similar options for controlling labels on the plot.
-
-xyplot(wt ~ mpg, mtcars, xlab = "Miles per gallon", ylab = "Weight",
-  main = "Weight-efficiency tradeoff")
-
-qplot(mpg, wt, data = mtcars, xlab = "Miles per gallon", ylab = "Weight",
-  main = "Weight-efficiency tradeoff")
-
-
-xyplot(wt ~ mpg, mtcars, aspect = 1)
-
-qplot(mpg, wt, data = mtcars, asp = 1)
-
-
-# par.settings() is equivalent to + theme() and trellis.options.set()
-# and trellis.par.get() to theme_set() and theme_get().
-# More complicated lattice formulas are equivalent to rearranging the data
-# before using ggplot2.
-# }
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/txhousing.html b/docs/reference/txhousing.html deleted file mode 100644 index 9ff1b385b..000000000 --- a/docs/reference/txhousing.html +++ /dev/null @@ -1,94 +0,0 @@ - -Housing sales in TX. — txhousing • animint2 - Skip to contents - - -
-
-
- -
-

Information about the housing market in Texas provided by the TAMU -real estate center, https://www.recenter.tamu.edu/.

-
- -
-

Usage

-
txhousing
-
- -
-

Format

-

A data frame with 8602 observations and 9 variables:

  • cityName of MLS area

  • -
  • year,month,dateDate

  • -
  • salesNumber of sales

  • -
  • volumeTotal value of sales

  • -
  • medianMedian sale price

  • -
  • listingsTotal active listings

  • -
  • inventory"Months inventory": amount of time it would take to sell - all current listings at current pace of sales.

  • -
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/update_defaults-1.png b/docs/reference/update_defaults-1.png deleted file mode 100644 index f0341cfb3..000000000 Binary files a/docs/reference/update_defaults-1.png and /dev/null differ diff --git a/docs/reference/update_defaults.html b/docs/reference/update_defaults.html deleted file mode 100644 index 5bc3472a2..000000000 --- a/docs/reference/update_defaults.html +++ /dev/null @@ -1,102 +0,0 @@ - -Modify geom/stat aesthetic defaults for future plots — update_geom_defaults • animint2 - Skip to contents - - -
-
-
- -
-

Modify geom/stat aesthetic defaults for future plots

-
- -
-

Usage

-
update_geom_defaults(geom, new)
-
-update_stat_defaults(stat, new)
-
- -
-

Arguments

-
new
-

Named list of aesthetics.

- - -
stat, geom
-

Name of geom/stat to modify (like "point" or -"bin"), or a Geom/Stat object (like GeomPoint or -StatBin).

- -
- -
-

Examples

-
update_geom_defaults("point", list(colour = "darkblue"))
-ggplot(mtcars, aes(mpg, wt)) + geom_point()
-
-update_geom_defaults("point", list(colour = "black"))
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/update_labels-1.png b/docs/reference/update_labels-1.png deleted file mode 100644 index 60f79d4cd..000000000 Binary files a/docs/reference/update_labels-1.png and /dev/null differ diff --git a/docs/reference/update_labels-2.png b/docs/reference/update_labels-2.png deleted file mode 100644 index 8c2ab702f..000000000 Binary files a/docs/reference/update_labels-2.png and /dev/null differ diff --git a/docs/reference/update_labels-3.png b/docs/reference/update_labels-3.png deleted file mode 100644 index 062df842d..000000000 Binary files a/docs/reference/update_labels-3.png and /dev/null differ diff --git a/docs/reference/update_labels-4.png b/docs/reference/update_labels-4.png deleted file mode 100644 index 4d7d7673d..000000000 Binary files a/docs/reference/update_labels-4.png and /dev/null differ diff --git a/docs/reference/update_labels.html b/docs/reference/update_labels.html deleted file mode 100644 index 6ab096e10..000000000 --- a/docs/reference/update_labels.html +++ /dev/null @@ -1,103 +0,0 @@ - -Update axis/legend labels — update_labels • animint2 - Skip to contents - - -
-
-
- -
-

Update axis/legend labels

-
- -
-

Usage

-
update_labels(p, labels)
-
- -
-

Arguments

-
p
-

plot to modify

- - -
labels
-

named list of new labels

- -
- -
-

Examples

-
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
-update_labels(p, list(x = "New x"))
-
-update_labels(p, list(x = expression(x / y ^ 2)))
-
-update_labels(p, list(x = "New x", y = "New Y"))
-
-update_labels(p, list(colour = "Fail silently"))
-
-
-
-
- - -
- - - -
- - - - - - - diff --git a/docs/reference/varied.chunk.html b/docs/reference/varied.chunk.html deleted file mode 100644 index 0afb9d97c..000000000 --- a/docs/reference/varied.chunk.html +++ /dev/null @@ -1,96 +0,0 @@ - -Extract subset for each data.frame in a list of data.frame — varied.chunk • animint2 - Skip to contents - - -
-
-
- -
-

Extract subset for each data.frame in a list of data.frame

-
- -
-

Usage

-
varied.chunk(dt.or.list, cols)
-
- -
-

Arguments

-
dt.or.list
-

a data.table or a list of data.table.

- - -
cols
-

cols that each data.frame would keep.

- -
-
-

Value

- - -

list of data.frame.

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/vervet.html b/docs/reference/vervet.html deleted file mode 100644 index 9a54f47fb..000000000 --- a/docs/reference/vervet.html +++ /dev/null @@ -1,112 +0,0 @@ - -Vervet monkey intestinal microbiome — vervet • animint2 - Skip to contents - - -
-
-
- -
-

DNA sequences (55mers) of bacteria in the gastrointestinal tract of 23 -vervet (African green) monkeys from Wake Forest University Primate -Center Vervet Research Colony. Some monkeys were measured in several -locations, so there are a total of 64 samples. The goal in analyzing -these data was to determine whether or not similar bacteria are detected -in nearby locations, assuming that each 55mer uniquely identifies a -bacterium.

-
- -
-

Usage

-
data(vervet)
-
- -
-

Format

-

The format is a named list of data.frames: samples contains 64 rows - with sample-specific info, counts contains 1190208 rows with counts of - 55mers observed in each sample, and monkeys contains 23 rows with - monkey-specific information.

-
-
-

Source

-

DNA sequencing was funded by Genome Quebec and generated at the McGill - Innovation Center. More info about the Vervet Microbiome project - http://www.genomequebec.mcgill.ca/compgen/vervet_research/ - http://genome.wustl.edu/projects/detail/vervet-microbiome/

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/waiver.html b/docs/reference/waiver.html deleted file mode 100644 index 1ae24e357..000000000 --- a/docs/reference/waiver.html +++ /dev/null @@ -1,88 +0,0 @@ - -A waiver object. — waiver • animint2 - Skip to contents - - -
-
-
- -
-

A waiver is a "flag" object, similar to NULL, that indicates the -calling function should just use the default value. It is used in certain -functions to distinguish between displaying nothing (NULL) and -displaying a default value calculated elsewhere (waiver())

-
- -
-

Usage

-
waiver()
-
- - -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/worldPop.html b/docs/reference/worldPop.html deleted file mode 100644 index a8b87c1eb..000000000 --- a/docs/reference/worldPop.html +++ /dev/null @@ -1,104 +0,0 @@ - -World population by subcontinent — worldPop • animint2 - Skip to contents - - -
-
-
- -
-

World population data are used as a simple example on the polychart.js -website, and so these data can be used to recreate that example using animint.

-
- -
-

Usage

-
data(worldPop)
-
- -
-

Format

-

A data frame with 294 observations on the following 4 variables.

subcontinent
-

factor: the subcontinent name

- -
year
-

integer: year of measurement

- -
population
-

integer: number of people in that - subcontinent during that year

- -
type
-

factor with levels actual estimate

- - -
-
-

Source

-

https://github.com/Polychart/polychart2/blob/master/example/population.coffee

-
- -
- - -
- - - -
- - - - - - - diff --git a/docs/reference/zeroGrob.html b/docs/reference/zeroGrob.html deleted file mode 100644 index e172a83d2..000000000 --- a/docs/reference/zeroGrob.html +++ /dev/null @@ -1,79 +0,0 @@ - -The zero grob draws nothing and has zero size. — zeroGrob • animint2 - Skip to contents - - -
-
-
- -
-

The zero grob draws nothing and has zero size.

-
- -
-

Usage

-
zeroGrob()
-
- - -
- - -
- - - -
- - - - - - - diff --git a/docs/search.json b/docs/search.json deleted file mode 100644 index 1753b4d5f..000000000 --- a/docs/search.json +++ /dev/null @@ -1 +0,0 @@ -[{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Animint2 Quick Start Guide","text":"Welcome quick start guide. goal introduce animint2 way brief easy understand. assume nothing except basic familiarity R, data visualizations, little bit statistics. familiarity ggplot2 package helpful unnecessary. reading , ’ll leave sense animint2 works. ’ll also know make interactive data visualizations, sometimes referred animints. basic animints, quick start guide ’ll need. learn make sophisticated animints, take look animint2 Manual. may also want take look animint gallery, showcases sophisticated powerful animints can .","code":""},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"datasets","dir":"Articles","previous_headings":"","what":"Datasets","title":"Animint2 Quick Start Guide","text":"readers may want follow along interactively. animint2 R datasets may use. Access dataset list data(). Alternatively, may already dataset ’d like use experiment animint2. use custom dataset guide, ’ve named meowtrics. data dataset simulated, fancy way saying forced computer make . data ten different housecats ’re perceived time.’s glimpse:","code":"head(meowtrics) ## Day Cat Coolness Cuteness Kind ## 1 1 Clifford 0.16 4.50 Domestic Shorthair ## 2 1 Junebug 0.36 3.70 Domestic Longhair ## 3 1 Muffin 0.41 0.47 Cornish Rex ## 4 1 Teddy Bear 0.47 5.10 Domestic Shorthair ## 5 1 Diana 0.61 9.60 Domestic Shorthair ## 6 1 Bello 0.71 1.90 Domestic Shorthair"},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"anatomy-of-a-data-visualization","dir":"Articles","previous_headings":"","what":"Anatomy of a Data Visualization","title":"Animint2 Quick Start Guide","text":"Data visualizations commonplace, good reason. Large tables data difficult parse. good data visualization can illuminate patterns otherwise hard spot. contrast, poor (deliberately misleading) data visualization can obscure even obvious patterns. design good data visualizations avoiding bad ones? start understanding data visualizations made ’re arranged. arrangement often called grammar graphics.ii quick start guide won’t teach grammar, don’t need know get started animint2. know syntax animint2—, way code written—modelled grammar. Let’s see example. Say want visualize people rate cat cuteness time. want y-axis depict cuteness ratings, x-axis days. also want scatterplot. ? First, haven’t already, need install animint2: load animint2: Next, search functions ’ll need put together. First, need ggplot(), like blank sheet paper (computer screen) program draws make graph.iii make scatterplot, ’ll use either geom_point() geom_jitter(). Finally, axes, ’ll need aes(). name graph put together: ’re unfamiliar syntax, code can get confusing.iv Let’s go code block line line: name data visualization. Since ’s scatterplot cat cuteness, name cute_plot. can name data visualizations whatever like, ’s best name something make sense future self. Next, call ggplot() function, since ’m making data visualization. call geom_point(), ’m making scatterplot. want use meowtrics dataset draw points scatterplot, set data = meowtrics. aes() controls aesthetics data visualization, including axes. place inside geom_point() tell program Day Cuteness variables x- y-axes, respectively. repeat name data visualization, tells program display graph. Look plot. can see ’s lot variance data, seems upward trend cat cuteness ratings. graph better. animint2 gives us tools improve . Take look slightly modified data visualization: cat differentiated one another color, ’s now legend. Codewise, ’s changed? data visualization different name. two plots name, one override . ’ve added new arguments aes(): ’ve grouped points scatterplot cat, ’ve also differentiated cats’ data points color.v Using labs(), ’ve given graph title. new graph communicates information, ’s also somewhat overwhelming. move data way? compare subset cat cuteness ratings instead seeing everything ? Reader, good news.","code":"install.packages(\"animint2\") library(animint2) cute_plot <- #1 ggplot() + #2 geom_point( #3 data = meowtrics, #4 aes(x = Day, y = Cuteness)) #5 cute_plot #6 cute_plot_colored <- #1 ggplot() + geom_point( data = meowtrics, aes(x = Day, y = Cuteness, group = Cat, color = Cat)) + #2 labs(title = \"Cat Cuteness Ratings Over Time\") #3 cute_plot_colored"},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"making-animints","dir":"Articles","previous_headings":"","what":"Making Animints","title":"Animint2 Quick Start Guide","text":"good news : animint2 makes easy render static data visualization interactive. Just use animint() function previous plot argument: animint second static data visualization. clicking legend using selection menu, can control subjects data graphed, well many.vi allows explore data without needing facet possible cat combinations. exploratory data analysis, level control may need. cases, may want control. Say want emphasize Archibald Muffin’s cuteness ratings time. animint2, use first argument specify cats present: useful situations ’re showcasing presenting animint. Pay attention syntax: first argument accepts list()s. specified cats must character vector. ’s ’re c() function.","code":"animint(cute_plot_colored) cute_present <- animint(cute_plot_colored, first = list( #1 Cat = c( #2 \"Archibald\", \"Muffin\"))) cute_present"},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"using-showselected","dir":"Articles","previous_headings":"","what":"Using showSelected","title":"Animint2 Quick Start Guide","text":"animint2 Firefox interact strangely. animints seem cause webpage scroll . get around , either: Click “Hide selection menus” button see present; Click “Show animation control” button hit pause. current animints use three variables: Day, Cuteness, Cat. want explore present fourth?vii static data visualization, require multiple graphs addition unwieldy third dimension. Luckily, animints subject restrictions. animint(), can use showSelected time arguments show Coolness Cuteness variables interact day--day. First, let’s look animint showSelected variable: showSelected = \"Day\" lets adjust day selection menu. real-world datasets missing values. key accounts transitioning different days. can use selection menu see different associations cuteness coolness ratings per day.viii Next, let’s see animint time duration options applied: duration specifies quickly points move old location new location.ix shorter duration, quicker movement. takes list uses milliseconds unit measurement. time also takes list. contrast duration, time = list(ms) specifies long points stay place. also uses milliseconds unit measurement. can also click “Show animation controls” button manually adjust time duration. Try .","code":"associations <- ggplot() + geom_point( data = meowtrics, showSelected = \"Day\", #1 aes(x = Coolness, y = Cuteness, color = Cat, group = Cat, key = Cat)) + #2 labs(title = \"Associations Between Cuteness and Coolness\") animint(associations) animated_associations <- animint(associations, duration = list(Day = 1000), #1 time = list( #2 variable = \"Day\", ms = 1000)) #3 animated_associations"},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"using-clickselects","dir":"Articles","previous_headings":"","what":"Using clickSelects","title":"Animint2 Quick Start Guide","text":"far, ’ve interacting animints clicking legend using selection menus animation controls. interact animint directly? Using clickSelects, can just . Let’s return data visualization depicting cuteness ratings time, time animint: clickSelects takes variable quotations. variable clickSelects group : ’re Cat. Hover click data points. ’ll notice effect clicking legend: removes data animint. Now, let’s interact similar animint: ’ve swapped Cat Kind. Now variables clickSelects group different. useful way adding another variable data visualizations. interact animint, ’ll notice three differences: Hover animints. , ’ll notice hover box appear. first animint, hover box repeats cat’s name. second, hover box describes kind cat . second animint, additional variable selection menu. can use highlight data points depicting certain kind cat. click data point, doesn’t disappear. Instead, like selection menu, highlights data points depicting certain kinds cats.","code":"cute_colored_again <- ggplot() + geom_point( data = meowtrics, clickSelects = \"Cat\", #1 aes(x = Day, y = Cuteness, group = Cat, color = Cat)) animint(cute_colored_again) cute_plot_kind <- ggplot() + geom_point( data = meowtrics, clickSelects = \"Kind\", #1 aes(x = Day, y = Cuteness, group = Cat, color = Cat)) animint(cute_plot_kind)"},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"linked-plots","dir":"Articles","previous_headings":"","what":"Linked Plots","title":"Animint2 Quick Start Guide","text":"animint2 also allows us link multiple plots together one animint. two plots linked, change one plot can cause changes another. Let’s return two interactive data visualizations ’ve already looked : associations coolness cuteness, cuteness ratings time. ’s first data visualization , lightly altered: want link plot cuteness ratings time. way, can see coolness ratings change time, . linking process little involved usual: ’m taking Day column meowtrics (meowtrics$Day), stripping redundant days viaunique(), renaming , making data.frame(). Now dataframe 30 days meowtrics. geom_tallrect(), ’ll use later. take associations_2 make animint. duration controls long takes data points move one part animint another. mentioned, ’s optional. take previously-created animint attach new animints . name list animint overtime. geom_tallrect() function. creates vertical bar allows manipulate time variables clicking plot. geom_tallrect() requires new dataset contains time variable. ’s using dataset constructed earlier. xmin xmax control wide tallrect , affects appearance selected time variable. case, controls much day takes tallrect. clickSelects necessary , since need able select day plot. alpha controls transparency tallrect. Lower numbers increase transparency. Using +, attach tallrect plot cuteness ratings time. ’re back using meowtrics dataset. Finally, intitate animint. Try . adjust day bottom plot, top plot also readjusts. click legend top plot, bottom plot also affected. linked plots can get much complex. examples, see animint gallery.","code":"associations_again <- ggplot() + geom_point( data = meowtrics, showSelected = \"Day\", clickSelects = \"Kind\", aes(x = Coolness, y = Cuteness, color = Cat, group = Cat, key = Cat)) md <- data.frame(Day = unique(meowtrics$Day)) #1 linked <- animint(associations_again, #2 duration = list(Day = 1000)) #3 linked$overtime <- #4 ggplot() + geom_tallrect( #5 data = md, #6 aes(xmin = Day-0.5, xmax = Day+0.5), #7 clickSelects = \"Day\", #8 alpha = 0.5 #9 ) + #10 geom_point( data = meowtrics, #11 clickSelects = \"Cat\", aes(x = Day, y = Cuteness, group = Cat, color = Cat)) linked #12"},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"conclusion","dir":"Articles","previous_headings":"","what":"Conclusion","title":"Animint2 Quick Start Guide","text":"’s . ’re now reasonably competent animint2 user. like learn , please read animint2 Manual—especially chapters 1 4, go material greater depth. Feel free post questions GitHub issues. Thanks reading!","code":""},{"path":"https://animint.github.io/animint2/articles/animint2.html","id":"footnotes","dir":"Articles","previous_headings":"","what":"Footnotes","title":"Animint2 Quick Start Guide","text":"Fun science fact: Cats objectively best animal. ’re interested learning grammar want get right primary source, see Leland Wilkinson’s Grammar Graphics. data visualizations use ggplot(). Notice also ggplot() geom_point() functions held together + symbol. words: begin blank data visualization add scatterplot atop . functions animint2 held together +. ’ll using lot. ’s possible differentiate data points different manner. example, instead different colors, used different shapes. Play around animint. See can can’t interact . Recall meowtrics dataset Coolness variable haven’t looked yet. Play around see can . Fun fact: duration argument optional. decide use duration set 0 milliseconds, points teleport one location another.","code":""},{"path":"https://animint.github.io/animint2/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Toby Hocking. Author, maintainer. Original animint code Hadley Wickham. Author. Forked ggplot2 code Winston Chang. Author. Forked ggplot2 code RStudio. Copyright holder. Forked ggplot2 code Nicholas Lewin-Koh. Author. hexGrob Martin Maechler. Author. hexGrob Randall Prium. Author. cut_width Susan VanderPlas. Author. Animint GSOC 2013 Carson Sievert. Author. Animint GSOC 2014 Kevin Ferris. Author. Animint GSOC 2015 Jun Cai. Author. Animint GSOC 2015 Faizan Khan. Author. Animint GSOC 2016-2017 Vivek Kumar. Author. Animint GSOC 2018 Himanshu Singh. Author. Animint2 GSoC 2020 Yufan Fei. Author. Animint2 GSoC 2022 Jocelyne Chen. Author. Animint2 GSoC 2023","code":""},{"path":"https://animint.github.io/animint2/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Hocking T, Wickham H, Chang W, Lewin-Koh N, Maechler M, Prium R, VanderPlas S, Sievert C, Ferris K, Cai J, Khan F, Kumar V, Singh H, Fei Y, Chen J (2023). animint2: Animated Interactive Grammar Graphics. R package version 2023.6.11, https://animint.github.io/animint2/.","code":"@Manual{, title = {animint2: Animated Interactive Grammar of Graphics}, author = {Toby Hocking and Hadley Wickham and Winston Chang and Nicholas Lewin-Koh and Martin Maechler and Randall Prium and Susan VanderPlas and Carson Sievert and Kevin Ferris and Jun Cai and Faizan Khan and Vivek Kumar and Himanshu Singh and Yufan Fei and Jocelyne Chen}, year = {2023}, note = {R package version 2023.6.11}, url = {https://animint.github.io/animint2/}, }"},{"path":[]},{"path":"https://animint.github.io/animint2/index.html","id":"about","dir":"","previous_headings":"","what":"About","title":"Animated Interactive Grammar of Graphics","text":"Animint2 R package generating sharing interactive data visualizations, sometimes referred animints. fork , uses similar syntax , ggplot2. Animint2 especially useful large datasets, smaller datasets can made interactive, . also capable generating static data visualizations. Play around interactive data visualization data World Bank. examples, go animint gallery. learn generate interactive data visualizations, go official Animint2 Manual. encounter problems, please see animint2 wiki report .","code":""},{"path":"https://animint.github.io/animint2/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Animated Interactive Grammar of Graphics","text":"","code":"# Install the official package from CRAN. # This is the option most people should choose: install.packages(\"animint2\") # If you want to install the development version: devtools::install_github(\"animint/animint2\")"},{"path":"https://animint.github.io/animint2/index.html","id":"use","dir":"","previous_headings":"","what":"Use","title":"Animated Interactive Grammar of Graphics","text":"Animint2 uses implementation ggplot2’s grammar graphics—additions. ’re familiar ggplot2, using animint2 easy. ’re , worries. get started, see brief Animint2 Quick Start Guide read first chapters Animint2 Manual. animint2 renders animates data visualizations. can neither manipulate datasets give generate data.","code":""},{"path":"https://animint.github.io/animint2/index.html","id":"similar-packages","dir":"","previous_headings":"","what":"Similar Packages","title":"Animated Interactive Grammar of Graphics","text":"animint2 isn’t R package can create animated interactive data visualizations. animation gganimate can animate changes variables time. loon package specializes exploratory data analysis. plotly probably similar animint2 terms functionality. comparisons aforementioned packages animint2, see differences wiki page.","code":""},{"path":"https://animint.github.io/animint2/index.html","id":"problems","dir":"","previous_headings":"","what":"Problems?","title":"Animated Interactive Grammar of Graphics","text":"animint2 package work progress. spot bugs unexpected behaviors, please let us know reporting issue GitHub. Thanks! great day.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/readme_website.html","id":"about","dir":"","previous_headings":"","what":"About","title":"Maintaining & Debugging the Animint2 Website","text":"First written 2023-06-28. Last revised 2023-08-22. internal document intended animint2 contributors. explains maintain debug animint2 reference website gives reasons might need . Feel free add edit document. Maintaining site neither hard annoying, ’s also automatic. time, can leave website alone. circumstances need maintain update website: added new function animint2. ’re getting errors GitHub access token PAT. made changes quick start guide. wanna change reference website’s URL. wanna change reference website’s typeface font. website messed stopped working way. made changes file animint2 repository effect website. Examples include NEWS.md, _pkgdown.yml, pkgdown/extra.css.","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"have-you-tried-re-building-it","dir":"","previous_headings":"","what":"Have You Tried Re-Building It?","title":"Maintaining & Debugging the Animint2 Website","text":"can solve lot maintenance problems running following: takes minutes re-builds site. push changes animint2 repository. lot problems, ’s . (substantial) changes aren’t showing , doesn’t fix bug, ’ll need read .","code":"cd whatever/your/path/is/animint/animint2 pkgdown::build_site()"},{"path":"https://animint.github.io/animint2/readme_website.html","id":"adding-a-function","dir":"","previous_headings":"","what":"Adding a Function","title":"Maintaining & Debugging the Animint2 Website","text":"added new function animint2 package. Congratulations! probably lot work. now need show website. process straightforward. First, everything “Tried Re-Building ?” section. new function starts “animint,” “make,” “get,” new function appear website. work needed. doesn’t, probably doesn’t start prefixes, ’ll work. First, open _pkgdown.yml, scroll references:, find section new function categorized. guess ’d fall ’d know best. Next, slot - contents:. run code “Tried Re-Building ?” section push changes animint2 repo.","code":"- subtitle: \"Animint Helpers\""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"refreshing-the-github-access-token","dir":"","previous_headings":"","what":"Refreshing the GitHub Access Token","title":"Maintaining & Debugging the Animint2 Website","text":"’re getting errors GitHub access tokens PATs, means either expired, changed, destroyed, run follow instructions.","code":"cd whatever/your/path/is/animint/animint2 usethis::create_github_token() gitcreds::gitcreds_set()"},{"path":"https://animint.github.io/animint2/readme_website.html","id":"changes-to-the-quick-start-guide","dir":"","previous_headings":"","what":"Changes to the Quick Start Guide","title":"Maintaining & Debugging the Animint2 Website","text":"First, everything “Tried Re-Building ?” section. new content hasn’t added, ’s probably used animint2, renders animints vignettes/ instead docs/. ’ll need cut/paste rendered directories drop docs/articles/. run code “Tried Re-Building ?” section push changes animint2 repo. might possible use animint2::animint2dir() automate . Unfortunately, haven’t figured way use way ’s elegant maintainable cut/paste solution. figure , feel free implement .","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"changes-to-the-url","dir":"","previous_headings":"","what":"Changes to the URL","title":"Maintaining & Debugging the Animint2 Website","text":"wanna change URL: go _pkgdown.yml, edit url: add another, everything “Tried Re-Building ?” section.","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"changes-to-the-typeface-or-font","dir":"","previous_headings":"","what":"Changes to the Typeface or Font","title":"Maintaining & Debugging the Animint2 Website","text":"wanna change typeface (often referred font): go _pkgdown.yml, bslib:. ’ll see: base_font, controls default typeface, heading_font, controls typeface titles headings, code_font, controls font codeblocks -line code. Swap current font ones choice, everything “Tried Re-Building ?” section.","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"the-website-is-messed-up","dir":"","previous_headings":"","what":"The Website is Messed Up","title":"Maintaining & Debugging the Animint2 Website","text":"website messed pushed commits animint2 repository? Revert commits git revert $SHA something. debug find happened. website messed cuz changes made via GitHub API via GitHub website, ’ll need figure exactly changed ’s affect website. Good luck.","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"changes-to-other-animint2-files","dir":"","previous_headings":"","what":"Changes to Other Animint2 Files","title":"Maintaining & Debugging the Animint2 Website","text":"change repository meant affect animint2’s CRAN page, ’ll also need update website, . everything “Tried Re-Building ?” section. changes repository meant affect animint2’s reference website. ’s case, everything “Tried Re-Building ?” section.","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"why-dont-you-just-use-github-actions","dir":"","previous_headings":"","what":"Why Don’t You Just Use GitHub Actions?","title":"Maintaining & Debugging the Animint2 Website","text":"Using GitHub Actions automate many parts maintaining site, though ’d leave parts untouched (e.g. refreshing access token). main reason haven’t done cuz dunno ! Feel free set site via GitHub Actions. ’d great.","code":""},{"path":"https://animint.github.io/animint2/readme_website.html","id":"see-also","dir":"","previous_headings":"","what":"See Also","title":"Maintaining & Debugging the Animint2 Website","text":"Documentation may helpful: Managing GitHub Credentials pkgdown Documentation Information usethis::use_pkgdown GitHub-flavored Markdown Specification","code":""},{"path":"https://animint.github.io/animint2/reference/absoluteGrob.html","id":null,"dir":"Reference","previous_headings":"","what":"Absolute grob — absoluteGrob","title":"Absolute grob — absoluteGrob","text":"grob fixed dimensions position.","code":""},{"path":"https://animint.github.io/animint2/reference/absoluteGrob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Absolute grob — absoluteGrob","text":"","code":"absoluteGrob( grob, width = NULL, height = NULL, xmin = NULL, ymin = NULL, vp = NULL )"},{"path":"https://animint.github.io/animint2/reference/absoluteGrob.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Absolute grob — absoluteGrob","text":"still experimental","code":""},{"path":"https://animint.github.io/animint2/reference/addShowSelectedForLegend.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a showSelected aesthetic if legend is specified — addShowSelectedForLegend","title":"Add a showSelected aesthetic if legend is specified — addShowSelectedForLegend","text":"Add showSelected aesthetic legend specified","code":""},{"path":"https://animint.github.io/animint2/reference/addShowSelectedForLegend.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a showSelected aesthetic if legend is specified — addShowSelectedForLegend","text":"","code":"addShowSelectedForLegend(meta, legend, L)"},{"path":"https://animint.github.io/animint2/reference/addShowSelectedForLegend.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a showSelected aesthetic if legend is specified — addShowSelectedForLegend","text":"meta meta object information legend legend scan showSelected L layer plot","code":""},{"path":"https://animint.github.io/animint2/reference/addShowSelectedForLegend.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a showSelected aesthetic if legend is specified — addShowSelectedForLegend","text":"L : Layer additional mapping new aesthetic","code":""},{"path":"https://animint.github.io/animint2/reference/addSSandCSasAesthetics.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics","title":"Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics","text":"Add showSelected/clickSelects params aesthetics mapping","code":""},{"path":"https://animint.github.io/animint2/reference/addSSandCSasAesthetics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics","text":"","code":"addSSandCSasAesthetics(aesthetics, extra_params)"},{"path":"https://animint.github.io/animint2/reference/addSSandCSasAesthetics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics","text":"aesthetics list. Original aesthetics mapping layer extra_params named list containing details showSelected clickSelects values layer","code":""},{"path":"https://animint.github.io/animint2/reference/addSSandCSasAesthetics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics","text":"Modified aesthetics list showSelected/clickSelects params added","code":""},{"path":"https://animint.github.io/animint2/reference/addSSandCSasAesthetics.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add the showSelected/clickSelects params to the aesthetics mapping — addSSandCSasAesthetics","text":"Used calling ggplot_build parsePlot checking animint extensions raise error","code":""},{"path":"https://animint.github.io/animint2/reference/add_theme.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify properties of an element in a theme object — add_theme","title":"Modify properties of an element in a theme object — add_theme","text":"Modify properties element theme object","code":""},{"path":"https://animint.github.io/animint2/reference/add_theme.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify properties of an element in a theme object — add_theme","text":"","code":"add_theme(t1, t2, t2name)"},{"path":"https://animint.github.io/animint2/reference/add_theme.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify properties of an element in a theme object — add_theme","text":"t1 theme object t2 theme object added t1 t2name name t2 object. used printing informative error messages.","code":""},{"path":"https://animint.github.io/animint2/reference/aes.html","id":null,"dir":"Reference","previous_headings":"","what":"Define aesthetic mappings. — aes","title":"Define aesthetic mappings. — aes","text":"Generate aesthetic mappings describe variables data mapped visual properties (aesthetics) geoms. function also standardise aesthetic names performs partial name matching, converting color colour, old style R names ggplot names (eg. pch shape, cex size)","code":""},{"path":"https://animint.github.io/animint2/reference/aes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Define aesthetic mappings. — aes","text":"","code":"aes(x, y, ...)"},{"path":"https://animint.github.io/animint2/reference/aes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Define aesthetic mappings. — aes","text":"x, y, ... List name value pairs giving aesthetics map variables. names x y aesthetics can omitted (common); aesthetics must named.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/aes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Define aesthetic mappings. — aes","text":"","code":"aes(x = mpg, y = wt) #> * x -> mpg #> * y -> wt aes(mpg, wt) #> * x -> mpg #> * y -> wt # You can also map aesthetics to functions of variables aes(x = mpg ^ 2, y = wt / cyl) #> * x -> mpg^2 #> * y -> wt/cyl # Aesthetic names are automatically standardised aes(col = x) #> * colour -> x aes(fg = x) #> * colour -> x aes(color = x) #> * colour -> x aes(colour = x) #> * colour -> x # aes is almost always used with ggplot() or a layer ggplot(mpg, aes(displ, hwy)) + geom_point() ggplot(mpg) + geom_point(aes(displ, hwy)) # Aesthetics supplied to ggplot() are used as defaults for every layer # you can override them, or supply different aesthetics for each layer"},{"path":"https://animint.github.io/animint2/reference/aes_.html","id":null,"dir":"Reference","previous_headings":"","what":"Define aesthetic mappings from strings, or quoted calls and formulas. — aes_","title":"Define aesthetic mappings from strings, or quoted calls and formulas. — aes_","text":"Aesthetic mappings describe variables data mapped visual properties (aesthetics) geoms. aes uses non-standard evaluation capture variable names. aes_ aes_string require explicitly quote inputs either \"\" aes_string(), quote ~ aes_(). (aes_q alias aes_)","code":""},{"path":"https://animint.github.io/animint2/reference/aes_.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Define aesthetic mappings from strings, or quoted calls and formulas. — aes_","text":"","code":"aes_(x, y, ...) aes_string(x, y, ...) aes_q(x, y, ...)"},{"path":"https://animint.github.io/animint2/reference/aes_.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Define aesthetic mappings from strings, or quoted calls and formulas. — aes_","text":"x, y, ... List name value pairs. Elements must either quoted calls, strings, one-sided formulas constants.","code":""},{"path":"https://animint.github.io/animint2/reference/aes_.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Define aesthetic mappings from strings, or quoted calls and formulas. — aes_","text":"better use aes_q(), easy way create equivalent aes(colour = \"colour\") aes{x = `X$1`} aes_string(). aes_string aes_ particularly useful writing functions create plots can use strings quoted names/calls define aesthetic mappings, rather use substitute generate call aes().","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/aes_.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Define aesthetic mappings from strings, or quoted calls and formulas. — aes_","text":"","code":"# Three ways of generating the same aesthetics aes(mpg, wt, col = cyl) #> * x -> mpg #> * y -> wt #> * colour -> cyl aes_(quote(mpg), quote(wt), col = quote(cyl)) #> * colour -> cyl #> * x -> mpg #> * y -> wt aes_(~mpg, ~wt, col = ~cyl) #> * colour -> cyl #> * x -> mpg #> * y -> wt aes_string(\"mpg\", \"wt\", col = \"cyl\") #> * colour -> cyl #> * x -> mpg #> * y -> wt # You can't easily mimic these calls with aes_string aes(`$100`, colour = \"smooth\") #> * x -> `$100` #> * colour -> \"smooth\" aes_(~ `$100`, colour = \"smooth\") #> * colour -> \"smooth\" #> * x -> `$100` # Ok, you can, but it requires a _lot_ of quotes aes_string(\"`$100`\", colour = '\"smooth\"') #> * colour -> \"smooth\" #> * x -> `$100` # Convert strings to names with as.name var <- \"cyl\" aes(col = x) #> * colour -> x aes_(col = as.name(var)) #> * colour -> cyl"},{"path":"https://animint.github.io/animint2/reference/aes_all.html","id":null,"dir":"Reference","previous_headings":"","what":"Given a character vector, create a set of identity mappings — aes_all","title":"Given a character vector, create a set of identity mappings — aes_all","text":"Given character vector, create set identity mappings","code":""},{"path":"https://animint.github.io/animint2/reference/aes_all.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Given a character vector, create a set of identity mappings — aes_all","text":"","code":"aes_all(vars)"},{"path":"https://animint.github.io/animint2/reference/aes_all.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Given a character vector, create a set of identity mappings — aes_all","text":"vars vector variable names","code":""},{"path":"https://animint.github.io/animint2/reference/aes_all.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Given a character vector, create a set of identity mappings — aes_all","text":"","code":"aes_all(names(mtcars)) #> * mpg -> mpg #> * cyl -> cyl #> * disp -> disp #> * hp -> hp #> * drat -> drat #> * wt -> wt #> * qsec -> qsec #> * vs -> vs #> * am -> am #> * gear -> gear #> * carb -> carb aes_all(c(\"x\", \"y\", \"col\", \"pch\")) #> * x -> x #> * y -> y #> * colour -> col #> * shape -> pch"},{"path":"https://animint.github.io/animint2/reference/aes_auto.html","id":null,"dir":"Reference","previous_headings":"","what":"Automatic aesthetic mapping — aes_auto","title":"Automatic aesthetic mapping — aes_auto","text":"Automatic aesthetic mapping","code":""},{"path":"https://animint.github.io/animint2/reference/aes_auto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Automatic aesthetic mapping — aes_auto","text":"","code":"aes_auto(data = NULL, ...)"},{"path":"https://animint.github.io/animint2/reference/aes_auto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Automatic aesthetic mapping — aes_auto","text":"data data.frame names variables ... aesthetics need explicitly mapped.","code":""},{"path":"https://animint.github.io/animint2/reference/aes_colour_fill_alpha.html","id":null,"dir":"Reference","previous_headings":"","what":"Colour related aesthetics: colour, fill and alpha — aes_colour_fill_alpha","title":"Colour related aesthetics: colour, fill and alpha — aes_colour_fill_alpha","text":"page demonstrates usage sub-group aesthetics; colour, fill alpha.","code":""},{"path":"https://animint.github.io/animint2/reference/aes_colour_fill_alpha.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Colour related aesthetics: colour, fill and alpha — aes_colour_fill_alpha","text":"","code":"# \\donttest{ # Bar chart example c <- ggplot(mtcars, aes(factor(cyl))) # Default plotting c + geom_bar() # To change the interior colouring use fill aesthetic c + geom_bar(fill = \"red\") # Compare with the colour aesthetic which changes just the bar outline c + geom_bar(colour = \"red\") # Combining both, you can see the changes more clearly c + geom_bar(fill = \"white\", colour = \"red\") # The aesthetic fill also takes different colouring scales # setting fill equal to a factor variable uses a discrete colour scale k <- ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) k + geom_bar() # Fill aesthetic can also be used with a continuous variable m <- ggplot(faithfuld, aes(waiting, eruptions)) m + geom_raster() m + geom_raster(aes(fill = density)) # Some geoms don't use both aesthetics (i.e. geom_point or geom_line) b <- ggplot(economics, aes(x = date, y = unemploy)) b + geom_line() b + geom_line(colour = \"green\") b + geom_point() b + geom_point(colour = \"red\") # For large datasets with overplotting the alpha # aesthetic will make the points more transparent df <- data.frame(x = rnorm(5000), y = rnorm(5000)) h <- ggplot(df, aes(x,y)) h + geom_point() h + geom_point(alpha = 0.5) h + geom_point(alpha = 1/10) # Alpha can also be used to add shading j <- b + geom_line() j yrng <- range(economics$unemploy) j <- j + geom_rect(aes(NULL, NULL, xmin = start, xmax = end, fill = party), ymin = yrng[1], ymax = yrng[2], data = presidential) j j + scale_fill_manual(values = alpha(c(\"blue\", \"red\"), .3)) # }"},{"path":"https://animint.github.io/animint2/reference/aes_linetype_size_shape.html","id":null,"dir":"Reference","previous_headings":"","what":"Differentiation related aesthetics: linetype, size, shape — aes_linetype_size_shape","title":"Differentiation related aesthetics: linetype, size, shape — aes_linetype_size_shape","text":"page demonstrates usage sub-group aesthetics; linetype, size shape.","code":""},{"path":"https://animint.github.io/animint2/reference/aes_linetype_size_shape.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Differentiation related aesthetics: linetype, size, shape — aes_linetype_size_shape","text":"","code":"# Line types should be specified with either an integer, a name, or with a string of # an even number (up to eight) of hexadecimal digits which give the lengths in # consecutive positions in the string. # 0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash # Data df <- data.frame(x = 1:10 , y = 1:10) f <- ggplot(df, aes(x, y)) f + geom_line(linetype = 2) f + geom_line(linetype = \"dotdash\") # An example with hex strings, the string \"33\" specifies three units on followed # by three off and \"3313\" specifies three units on followed by three off followed # by one on and finally three off. f + geom_line(linetype = \"3313\") # Mapping line type from a variable ggplot(economics_long, aes(date, value01)) + geom_line(aes(linetype = variable)) # Size examples # Should be specified with a numerical value (in millimetres), # or from a variable source p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(size = 4) p + geom_point(aes(size = qsec)) p + geom_point(size = 2.5) + geom_hline(yintercept = 25, size = 3.5) # Shape examples # Shape takes four types of values: an integer in [0, 25], # a single character-- which uses that character as the plotting symbol, # a . to draw the smallest rectangle that is visible (i.e., about one pixel) # an NA to draw nothing p + geom_point() p + geom_point(shape = 5) p + geom_point(shape = \"k\", size = 3) p + geom_point(shape = \".\") p + geom_point(shape = NA) #> Warning: Removed 32 rows containing missing values (geom_point). # Shape can also be mapped from a variable p + geom_point(aes(shape = factor(cyl))) # A look at all 25 symbols df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25) s <- ggplot(df2, aes(x, y)) s + geom_point(aes(shape = z), size = 4) + scale_shape_identity() # While all symbols have a foreground colour, symbols 19-25 also take a # background colour (fill) s + geom_point(aes(shape = z), size = 4, colour = \"Red\") + scale_shape_identity() s + geom_point(aes(shape = z), size = 4, colour = \"Red\", fill = \"Black\") + scale_shape_identity()"},{"path":"https://animint.github.io/animint2/reference/aes_position.html","id":null,"dir":"Reference","previous_headings":"","what":"Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend — aes_position","title":"Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend — aes_position","text":"page demonstrates usage sub-group aesthetics; x, y, xmin, xmax, ymin, ymax, xend, yend.","code":""},{"path":"https://animint.github.io/animint2/reference/aes_position.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend — aes_position","text":"","code":"# Generate data: means and standard errors of means for prices # for each type of cut dmod <- lm(price ~ cut, data = diamonds) cuts <- data.frame(cut = unique(diamonds$cut), predict(dmod, data.frame(cut = unique(diamonds$cut)), se = TRUE)[c(\"fit\", \"se.fit\")]) se <- ggplot(cuts, aes(x = cut, y = fit, ymin = fit - se.fit, ymax = fit + se.fit, colour = cut)) se + geom_pointrange() # Using annotate p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() p + annotate(\"rect\", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25, fill = \"dark grey\", alpha = .5) # Geom_segment examples p + geom_segment(aes(x = 2, y = 15, xend = 2, yend = 25), arrow = arrow(length = unit(0.5, \"cm\"))) p + geom_segment(aes(x = 2, y = 15, xend = 3, yend = 15), arrow = arrow(length = unit(0.5, \"cm\"))) p + geom_segment(aes(x = 5, y = 30, xend = 3.5, yend = 25), arrow = arrow(length = unit(0.5, \"cm\"))) # You can also use geom_segment to recreate plot(type = \"h\") : counts <- as.data.frame(table(x = rpois(100, 5))) counts$x <- as.numeric(as.character(counts$x)) with(counts, plot(x, Freq, type = \"h\", lwd = 10)) ggplot(counts, aes(x, Freq)) + geom_segment(aes(yend = 0, xend = x), size = 10)"},{"path":"https://animint.github.io/animint2/reference/animint.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an animint — animint","title":"Create an animint — animint","text":"Create animated, interactive data visualization. easiest way get started reading Animint2 Manual, https://rcdata.nau.edu/genomic-ml/animint2-manual/Ch02-ggplot2.html","code":""},{"path":"https://animint.github.io/animint2/reference/animint.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an animint — animint","text":"","code":"animint(...)"},{"path":"https://animint.github.io/animint2/reference/animint.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an animint — animint","text":"... ggplots options","code":""},{"path":"https://animint.github.io/animint2/reference/animint.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an animint — animint","text":"list class animint","code":""},{"path":"https://animint.github.io/animint2/reference/animint.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an animint — animint","text":"function creates list items ... attaches animint class. also provides default names un-named ggplots. list contain ggplots options. geom can made interactive using showSelected clickSelects parameters; character vector selection variable names. example geom_line(clickSelects=\"country\") means clicking line changes value \"country\" selection variable; geom_point(showSelected=\"year\") means show subset data currently selected year.","code":""},{"path":"https://animint.github.io/animint2/reference/animint.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create an animint — animint","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/animint.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an animint — animint","text":"","code":"if(require('data.table'))setDTthreads(1)#for CRAN. #> Loading required package: data.table library(animint2) data(WorldBank, package=\"animint2\") years <- unique(WorldBank[, \"year\", drop=FALSE]) y1960 <- subset(WorldBank, year==1960) animint( title=\"Linked scatterplot and time series\", #web page title. time=list(variable=\"year\",ms=3000), #variable and time delay used for animation. duration=list(year=1000), #smooth transition duration in milliseconds. selector.types=list(country=\"multiple\"), #single/multiple selection for each variable. first=list( #selected values to show when viz is first rendered. country=c(\"Canada\", \"Japan\"), year=1970), ## ggplots are rendered together for an interactive data viz. ts=ggplot()+ theme_animint(width=500)+ make_tallrect(WorldBank, \"year\")+ geom_text(aes( year, life.expectancy, label=country), showSelected=\"country\", clickSelects=\"country\", hjust=1, data=y1960)+ scale_x_continuous(limits=c(1950, NA))+ geom_line(aes( year, life.expectancy, group=country, color=region), clickSelects=\"country\", data=WorldBank, size=4, alpha=0.55), scatter=ggplot()+ geom_point(aes( fertility.rate, life.expectancy, key=country, colour=region, size=population), showSelected=\"year\", clickSelects=\"country\", data=WorldBank)+ geom_text(aes( fertility.rate, life.expectancy, key=country, label=country), showSelected=c(\"country\", \"year\"), data=WorldBank)+ geom_text(aes( 5, 80, key=1, label=paste(\"year =\", year)), showSelected=\"year\", data=years)+ scale_size_animint(pixel.range=c(2,20), breaks=10^(4:9))) #> Saving animint in temporary directory; specify output directory using animint(out.dir=\"path/to/directory\")"},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":null,"dir":"Reference","previous_headings":"","what":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"creating new geom, stat, position, scale another package, need extend animint2::Geom, animint2::Stat, animint2::Position, animint2::Scale.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"","code":"a_scales_list() ScalesList"},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"object class ScalesList (inherits gganimintproto) length 9.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"geoms","dir":"Reference","previous_headings":"","what":"Geoms","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"geom_* functions (like geom_point) return layer contains Geom* object (like GeomPoint). Geom* object responsible rendering data plot. Geom* objects gganimintproto object, descended top-level Geom, implements various methods fields. create new type Geom object, typically want implement one following: Compared Stat Position, Geom little different execution setup compute functions split . setup_data runs position adjustments, draw_layer run render time, much later. means setup_params hard communicate changes. Override either draw_panel(self, data, panel_scales, coord) draw_group(self, data, panel_scales, coord). draw_panel called per panel, draw_group called per group. Use draw_panel row data represents single element. Use draw_group group represents element (e.g. smooth, violin). data data frame scaled aesthetics. panel_scales list containing information scales current panel. coord coordinate specification. need call coord$transform(data, panel_scales) work non-Cartesian coords. work non-linear coordinate systems, typically need convert primitive geom (e.g. point, path polygon), pass corresponding draw method munching. Must return grob. Use zeroGrob nothing draw. draw_key: Renders single legend key. required_aes: character vector aesthetics needed render geom. default_aes: list (generated aes() default values aesthetics. reparameterise: Converts width height xmin xmax, ymin ymax values. can potentially set values well.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"coordinate-systems","dir":"Reference","previous_headings":"","what":"Coordinate systems","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"coord_* functions (like coord_trans) return Coord* object (like CoordTrans). Coord* object responsible adjusting position overlapping geoms. way coord_* functions work slightly different geom_* stat_* functions, coord_* function actually \"instantiates\" Coord* object creating descendant, returns . Coord* objects gganimintproto object, descended top-level Coord. create new type Coord object, typically want implement one following: aspect: Returns desired aspect ratio plot. labels: Returns list containing labels x y. render_fg: Renders foreground elements. render_bg: Renders background elements. render_axis_h: Renders horizontal axis. render_axis_v: Renders vertical axis. range: Returns x y ranges train: Return trained scale ranges. transform: Transforms x y coordinates. distance: Calculates distance. is_linear: Returns TRUE coordinate system linear; FALSE otherwise.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"stats","dir":"Reference","previous_headings":"","what":"Stats","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"stat_* functions (like stat_bin) return layer contains Stat* object (like StatBin). Stat* object responsible rendering data plot. Stat* objects gganimintproto object, descended top-level Stat, implements various methods fields. create new type Stat object, typically want implement one following: Override one : compute_layer(self, data, scales, ...), compute_panel(self, data, scales, ...), compute_group(self, data, scales, ...). compute_layer() called per layer, compute_panel_() called per panel, compute_group() called per group. must return data frame. usually best start overriding compute_group: find substantial performance optimisations, override higher . need read source code default methods see else . data data frame containing variables named according aesthetics mapped . scales list containing x y scales. functions called facets trained, global scales, local individual panels.... contains parameters returned setup_params(). setup_params(data, params): called layer. Used setup defaults need complete dataset, inform user important choices. return list parameters. setup_data(data, params): called layer, setp_params(). return modified data. Default methods removes rows containing missing value required aesthetics (warning !na.rm). required_aes: character vector aesthetics needed render geom. default_aes: list (generated aes() default values aesthetics.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"positions","dir":"Reference","previous_headings":"","what":"Positions","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"position_* functions (like position_dodge) return Position* object (like PositionDodge). Position* object responsible adjusting position overlapping geoms. way position_* functions work slightly different geom_* stat_* functions, position_* function actually \"instantiates\" Position* object creating descendant, returns . Position* objects gganimintproto object, descended top-level Position, implements following methods: compute_layer(self, data, params, panel) called per layer. panel currently internal data structure, method overriden. compute_panel(self, data, params, panel) called per panel return modified data frame. data data frame containing variables named according aesthetics mapped . scales list containing x y scales. functions called facets trained, global scales, local individual panels. params contains parameters returned setup_params(). setup_params(data, params): called layer. Used setup defaults need complete dataset, inform user important choices. return list parameters. setup_data(data, params): called layer, setp_params(). return modified data. Default checks required aesthetics present. following fields required_aes: character vector giving aesthetics must present position adjustment work.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2-gganimintproto.html","id":"scales","dir":"Reference","previous_headings":"","what":"Scales","title":"Base gganimintproto classes for ggplot2 — animint2-gganimintproto","text":"scale_* functions (like scale_x_continuous) return Scale* object (like ScaleContinuous). Scale* object represents single scale. Scale* objects gganimintproto object, descended top-level Scale.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/animint2dir.html","id":null,"dir":"Reference","previous_headings":"","what":"Compile and render an animint in a local directory. — animint2dir","title":"Compile and render an animint in a local directory. — animint2dir","text":"function converts animint plot.list directory files can used render interactive data visualization web browser.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2dir.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compile and render an animint in a local directory. — animint2dir","text":"","code":"animint2dir( plot.list, out.dir = NULL, json.file = \"plot.json\", open.browser = interactive(), css.file = \"\" )"},{"path":"https://animint.github.io/animint2/reference/animint2dir.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compile and render an animint in a local directory. — animint2dir","text":"plot.list named list ggplots option lists. .dir directory store html/js/csv files. exists already, removed writing new directory/files. json.file character string names JSON file metadata associated plot. open.browser R open browser? yes, sure configure browser allow access local files, browsers block default (e.g. chrome). css.file character string non-empty css file include. Provided file copied output directory styles.css","code":""},{"path":"https://animint.github.io/animint2/reference/animint2dir.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compile and render an animint in a local directory. — animint2dir","text":"invisible list ggplots list format.","code":""},{"path":"https://animint.github.io/animint2/reference/animint2dir.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compile and render an animint in a local directory. — animint2dir","text":"","code":"if(require('data.table'))setDTthreads(1)#for CRAN. ## Make a Gapminder plot (aka Google motion chart), which is actually ## just a scatterplot with size and color that moves over time. library(animint2) data(WorldBank) gapminder <- list( title=\"Linked scatterplot and time series\", ts=ggplot()+ make_tallrect(WorldBank, \"year\")+ geom_line(aes(year, life.expectancy, group=country, color=region), clickSelects=\"country\", data=WorldBank, size=4, alpha=3/5), time=list(variable=\"year\",ms=3000), duration=list(year=1000), scatter=ggplot()+ geom_point(aes(fertility.rate, life.expectancy, key=country, colour=region, size=population), showSelected=\"year\", clickSelects=\"country\", data=WorldBank)+ geom_text(aes(fertility.rate, life.expectancy, label=country), showSelected=c(\"country\", \"year\"), data=WorldBank)+ make_text(WorldBank, 5, 80, \"year\")+ scale_size_animint(pixel.range=c(2,20), breaks=10^(4:9))) animint2dir(gapminder) #> Warning: to ensure that smooth transitions are interpretable, aes(key) should be specifed for geoms with showSelected=year, problem: geom4_text_scatter data(worldPop) ## Linked bar and line plots of world population by subcontinent, ## inspired by polychartjs. popPlots <- list( bars=ggplot()+ geom_bar(aes(x=subcontinent, y=population), clickSelects=\"subcontinent\", showSelected=\"year\", data=worldPop, stat=\"identity\", position=\"identity\")+ ## This make_text creates a geom_text that shows the current ## selected value of the year variable. make_text(worldPop, 1, 3e6, \"year\")+ coord_flip(), lines=ggplot()+ ## This make_tallrect tiles the background of the lineplot with ## rects that can be clicked to select the year variable. make_tallrect(worldPop, \"year\")+ ## This geom_point does not have aes(clickSelects) so its alpha ## transparency behaves normally: all points have alpha=1/4. geom_point(aes(year, population, colour=type), data=worldPop, size=4, alpha=1/4)+ ## This geom_line DOES have aes(clickSelects) so only the ## selected line has the specified alpha=3/4. The other ## unselected lines have 0.5 less (alpha=1/4). geom_line(aes(year, population, group=subcontinent), clickSelects=\"subcontinent\", data=worldPop, size=4, alpha=3/4)) animint2dir(popPlots) ## Make it animated by specifying year as the variable to animate and ## an interval of 2000 milliseconds between animation frames. popAnim <- c(popPlots, list(time=list(variable=\"year\",ms=2000))) animint2dir(popAnim) ## Make the animation smooth by specifying a duration of 1000 ms for ## geoms with aes(showSelected=year). popSmooth <- c(popAnim, list(duration=list(year=1000))) animint2dir(popSmooth) #> Warning: to ensure that smooth transitions are interpretable, aes(key) should be specifed for geoms with showSelected=year, problem: geom1_bar_bars"},{"path":"https://animint.github.io/animint2/reference/animint2gist.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a list of ggplots to an interactive animation and post files as a gist — animint2gist","title":"Convert a list of ggplots to an interactive animation and post files as a gist — animint2gist","text":"using function set appropriate 'github.username' 'github.password' options","code":""},{"path":"https://animint.github.io/animint2/reference/animint2gist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a list of ggplots to an interactive animation and post files as a gist — animint2gist","text":"","code":"animint2gist(plot.list, description = plot.list$title, browse = TRUE, ...)"},{"path":"https://animint.github.io/animint2/reference/animint2gist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a list of ggplots to an interactive animation and post files as a gist — animint2gist","text":"plot.list named list ggplots option lists. description Brief description gist. becomes plot title bl.ocks/username page. browse logical. Prompt browser view viz bl.ocks.org ... options passed onto animint2dir gistr::gist_create","code":""},{"path":"https://animint.github.io/animint2/reference/animint2gist.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a list of ggplots to an interactive animation and post files as a gist — animint2gist","text":"","code":"if (FALSE) { library(animint) iris$id <- 1:nrow(iris) viz <- list(petal=ggplot()+ geom_point(aes(Petal.Width, Petal.Length, fill=Species, clickSelects=id), data=iris), sepal=ggplot()+ geom_point(aes(Sepal.Width, Sepal.Length, fill=Species, clickSelects=id), data=iris)) animint2gist(viz, description = \"My animint plot\") }"},{"path":"https://animint.github.io/animint2/reference/animintOutput.html","id":null,"dir":"Reference","previous_headings":"","what":"Shiny ui output function — animintOutput","title":"Shiny ui output function — animintOutput","text":"Shiny ui output function","code":""},{"path":"https://animint.github.io/animint2/reference/animintOutput.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Shiny ui output function — animintOutput","text":"","code":"animintOutput(outputId)"},{"path":"https://animint.github.io/animint2/reference/animintOutput.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Shiny ui output function — animintOutput","text":"outputId output variable read plot ","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/annotate.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an annotation layer. — annotate","title":"Create an annotation layer. — annotate","text":"function adds geoms plot. Unlike typical geom function, properties geoms mapped variables data frame, instead passed vectors. useful adding small annotations (text labels) data vectors, reason want put data frame.","code":""},{"path":"https://animint.github.io/animint2/reference/annotate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an annotation layer. — annotate","text":"","code":"annotate( geom, x = NULL, y = NULL, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, xend = NULL, yend = NULL, ..., na.rm = FALSE )"},{"path":"https://animint.github.io/animint2/reference/annotate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an annotation layer. — annotate","text":"geom name geom use annotation x, y, xmin, ymin, xmax, ymax, xend, yend positioning aesthetics - must specify least one . ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values.","code":""},{"path":"https://animint.github.io/animint2/reference/annotate.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an annotation layer. — annotate","text":"Note position aesthetics scaled (.e. expand limits plot visible), aesthetics set. means layers created function never affect legend.","code":""},{"path":"https://animint.github.io/animint2/reference/annotate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an annotation layer. — annotate","text":"","code":"p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() p + annotate(\"text\", x = 4, y = 25, label = \"Some text\") p + annotate(\"text\", x = 2:5, y = 25, label = \"Some text\") p + annotate(\"rect\", xmin = 3, xmax = 4.2, ymin = 12, ymax = 21, alpha = .2) p + annotate(\"segment\", x = 2.5, xend = 4, y = 15, yend = 25, colour = \"blue\") p + annotate(\"pointrange\", x = 3.5, y = 20, ymin = 12, ymax = 28, colour = \"red\", size = 1.5) p + annotate(\"text\", x = 2:3, y = 20:21, label = c(\"my label\", \"label 2\"))"},{"path":"https://animint.github.io/animint2/reference/annotation_custom.html","id":null,"dir":"Reference","previous_headings":"","what":"Annotation: Custom grob. — annotation_custom","title":"Annotation: Custom grob. — annotation_custom","text":"special geom intended use static annotations every panel. annotations affect scales (.e. x y axes grow cover range grob, grob modified ggplot settings mappings).","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_custom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annotation: Custom grob. — annotation_custom","text":"","code":"annotation_custom(grob, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)"},{"path":"https://animint.github.io/animint2/reference/annotation_custom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annotation: Custom grob. — annotation_custom","text":"grob grob display xmin, xmax x location (data coordinates) giving horizontal location raster ymin, ymax y location (data coordinates) giving vertical location raster","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_custom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Annotation: Custom grob. — annotation_custom","text":"useful adding tables, inset plots, grid-based decorations.","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_custom.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Annotation: Custom grob. — annotation_custom","text":"annotation_custom expects grob fill entire viewport defined xmin, xmax, ymin, ymax. Grobs different (absolute) size center-justified region. Inf values can used fill full plot panel (see examples).","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_custom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Annotation: Custom grob. — annotation_custom","text":"","code":"# Dummy plot df <- data.frame(x = 1:10, y = 1:10) base <- ggplot(df, aes(x, y)) + geom_blank() + theme_bw() # Full panel annotation base + annotation_custom( grob = grid::roundrectGrob(), xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf ) # Inset plot df2 <- data.frame(x = 1 , y = 1) g <- ggplotGrob(ggplot(df2, aes(x, y)) + geom_point() + theme(plot.background = element_rect(colour = \"black\"))) base + annotation_custom(grob = g, xmin = 1, xmax = 10, ymin = 8, ymax = 10)"},{"path":"https://animint.github.io/animint2/reference/annotation_logticks.html","id":null,"dir":"Reference","previous_headings":"","what":"Annotation: log tick marks — annotation_logticks","title":"Annotation: log tick marks — annotation_logticks","text":"annotation adds log tick marks diminishing spacing. tick marks probably make sense base 10.","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_logticks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annotation: log tick marks — annotation_logticks","text":"","code":"annotation_logticks( base = 10, sides = \"bl\", scaled = TRUE, short = unit(0.1, \"cm\"), mid = unit(0.2, \"cm\"), long = unit(0.3, \"cm\"), colour = \"black\", size = 0.5, linetype = 1, alpha = 1, color = NULL, ... )"},{"path":"https://animint.github.io/animint2/reference/annotation_logticks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annotation: log tick marks — annotation_logticks","text":"base base log (default 10) sides string controls sides plot log ticks appear . can set string containing \"trbl\", top, right, bottom, left. scaled data already log-scaled? TRUE (default) data already transformed log10() using scale_y_log10. FALSE using coord_trans(y = \"log10\"). short unit object specifying length short tick marks mid unit object specifying length middle tick marks. base 10, \"5\" ticks. long unit object specifying length long tick marks. base 10, \"1\" (\"10\") ticks. colour Colour tick marks. size Thickness tick marks, mm. linetype Linetype tick marks (solid, dashed, etc.) alpha transparency tick marks. color alias colour. ... parameters passed layer","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/annotation_logticks.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Annotation: log tick marks — annotation_logticks","text":"","code":"# Make a log-log plot (without log ticks) a <- ggplot(msleep, aes(bodywt, brainwt)) + geom_point(na.rm = TRUE) + scale_x_log10( breaks = scales::trans_breaks(\"log10\", function(x) 10^x), labels = scales::trans_format(\"log10\", scales::math_format(10^.x)) ) + scale_y_log10( breaks = scales::trans_breaks(\"log10\", function(x) 10^x), labels = scales::trans_format(\"log10\", scales::math_format(10^.x)) ) + theme_bw() a + annotation_logticks() # Default: log ticks on bottom and left a + annotation_logticks(sides = \"lr\") # Log ticks for y, on left and right a + annotation_logticks(sides = \"trbl\") # All four sides # Hide the minor grid lines because they don't align with the ticks a + annotation_logticks(sides = \"trbl\") + theme(panel.grid.minor = element_blank()) # Another way to get the same results as 'a' above: log-transform the data before # plotting it. Also hide the minor grid lines. b <- ggplot(msleep, aes(log10(bodywt), log10(brainwt))) + geom_point(na.rm = TRUE) + scale_x_continuous(name = \"body\", labels = scales::math_format(10^.x)) + scale_y_continuous(name = \"brain\", labels = scales::math_format(10^.x)) + theme_bw() + theme(panel.grid.minor = element_blank()) b + annotation_logticks() # Using a coordinate transform requires scaled = FALSE t <- ggplot(msleep, aes(bodywt, brainwt)) + geom_point() + coord_trans(x = \"log10\", y = \"log10\") + theme_bw() t + annotation_logticks(scaled = FALSE) #> Warning: Removed 27 rows containing missing values (geom_point). # Change the length of the ticks a + annotation_logticks( short = unit(.5,\"mm\"), mid = unit(3,\"mm\"), long = unit(4,\"mm\") )"},{"path":"https://animint.github.io/animint2/reference/annotation_map.html","id":null,"dir":"Reference","previous_headings":"","what":"Annotation: maps. — annotation_map","title":"Annotation: maps. — annotation_map","text":"Annotation: maps.","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_map.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annotation: maps. — annotation_map","text":"","code":"annotation_map(map, ...)"},{"path":"https://animint.github.io/animint2/reference/annotation_map.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annotation: maps. — annotation_map","text":"map data frame representing map. map objects can converted right format using fortify ... arguments used modify aesthetics","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_map.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Annotation: maps. — annotation_map","text":"","code":"if (require(\"maps\")) { usamap <- map_data(\"state\") seal.sub <- subset(seals, long > -130 & lat < 45 & lat > 40) ggplot(seal.sub, aes(x = long, y = lat)) + annotation_map(usamap, fill = \"NA\", colour = \"grey50\") + geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat)) seal2 <- transform(seal.sub, latr = cut(lat, 2), longr = cut(long, 2)) ggplot(seal2, aes(x = long, y = lat)) + annotation_map(usamap, fill = \"NA\", colour = \"grey50\") + geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat)) + facet_grid(latr ~ longr, scales = \"free\", space = \"free\") } #> Loading required package: maps"},{"path":"https://animint.github.io/animint2/reference/annotation_raster.html","id":null,"dir":"Reference","previous_headings":"","what":"Annotation: High-performance rectangular tiling. — annotation_raster","title":"Annotation: High-performance rectangular tiling. — annotation_raster","text":"special version geom_raster optimised static annotations every panel. annotations affect scales (.e. x y axes grow cover range raster, raster must already colours).","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_raster.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Annotation: High-performance rectangular tiling. — annotation_raster","text":"","code":"annotation_raster(raster, xmin, xmax, ymin, ymax, interpolate = FALSE)"},{"path":"https://animint.github.io/animint2/reference/annotation_raster.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Annotation: High-performance rectangular tiling. — annotation_raster","text":"raster raster object display xmin, xmax x location (data coordinates) giving horizontal location raster ymin, ymax y location (data coordinates) giving vertical location raster interpolate TRUE interpolate linearly, FALSE (default) interpolate.","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_raster.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Annotation: High-performance rectangular tiling. — annotation_raster","text":"useful adding bitmap images.","code":""},{"path":"https://animint.github.io/animint2/reference/annotation_raster.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Annotation: High-performance rectangular tiling. — annotation_raster","text":"","code":"# Generate data rainbow <- matrix(hcl(seq(0, 360, length.out = 50 * 50), 80, 70), nrow = 50) ggplot(mtcars, aes(mpg, wt)) + geom_point() + annotation_raster(rainbow, 15, 20, 3, 4) # To fill up whole plot ggplot(mtcars, aes(mpg, wt)) + annotation_raster(rainbow, -Inf, Inf, -Inf, Inf) + geom_point() rainbow2 <- matrix(hcl(seq(0, 360, length.out = 10), 80, 70), nrow = 1) ggplot(mtcars, aes(mpg, wt)) + annotation_raster(rainbow2, -Inf, Inf, -Inf, Inf) + geom_point() rainbow2 <- matrix(hcl(seq(0, 360, length.out = 10), 80, 70), nrow = 1) ggplot(mtcars, aes(mpg, wt)) + annotation_raster(rainbow2, -Inf, Inf, -Inf, Inf, interpolate = TRUE) + geom_point()"},{"path":"https://animint.github.io/animint2/reference/as.list.gganimintproto.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a gganimintproto object to a list — as.list.gganimintproto","title":"Convert a gganimintproto object to a list — as.list.gganimintproto","text":"include object's super member.","code":""},{"path":"https://animint.github.io/animint2/reference/as.list.gganimintproto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a gganimintproto object to a list — as.list.gganimintproto","text":"","code":"# S3 method for gganimintproto as.list(x, inherit = TRUE, ...)"},{"path":"https://animint.github.io/animint2/reference/as.list.gganimintproto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a gganimintproto object to a list — as.list.gganimintproto","text":"x gganimintproto object convert list. inherit TRUE (default), flatten inherited items returned list. FALSE, include inherited items. ... arguments pass .list.environment.","code":""},{"path":"https://animint.github.io/animint2/reference/as_labeller.html","id":null,"dir":"Reference","previous_headings":"","what":"Coerce to labeller function — as_labeller","title":"Coerce to labeller function — as_labeller","text":"transforms objects labeller functions. Used internally labeller().","code":""},{"path":"https://animint.github.io/animint2/reference/as_labeller.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coerce to labeller function — as_labeller","text":"","code":"as_labeller(x, default = label_value, multi_line = TRUE)"},{"path":"https://animint.github.io/animint2/reference/as_labeller.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coerce to labeller function — as_labeller","text":"x Object coerce labeller function. named character vector, used lookup table passed default. non-labeller function, assumed takes returns character vectors applied labels. labeller, simply applied labels. default Default labeller process labels produced lookup tables modified non-labeller functions. multi_line Whether display labels multiple factors separate lines. passed labeller function.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/as_labeller.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coerce to labeller function — as_labeller","text":"","code":"p <- ggplot(mtcars, aes(disp, drat)) + geom_point() p + facet_wrap(~am) # Rename labels on the fly with a lookup character vector to_string <- as_labeller(c(`0` = \"Zero\", `1` = \"One\")) p + facet_wrap(~am, labeller = to_string) # Quickly transform a function operating on character vectors to a # labeller function: appender <- function(string, suffix = \"-foo\") paste0(string, suffix) p + facet_wrap(~am, labeller = as_labeller(appender)) # If you have more than one facetting variable, be sure to dispatch # your labeller to the right variable with labeller() p + facet_grid(cyl ~ am, labeller = labeller(am = to_string))"},{"path":"https://animint.github.io/animint2/reference/autoplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a complete ggplot appropriate to a particular data type — autoplot","title":"Create a complete ggplot appropriate to a particular data type — autoplot","text":"autoplot uses ggplot2 draw particular plot object particular class single command. defines S3 generic classes packages can extend.","code":""},{"path":"https://animint.github.io/animint2/reference/autoplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a complete ggplot appropriate to a particular data type — autoplot","text":"","code":"autoplot(object, ...)"},{"path":"https://animint.github.io/animint2/reference/autoplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a complete ggplot appropriate to a particular data type — autoplot","text":"object object, whose class determine behaviour autoplot ... arguments passed specific methods","code":""},{"path":"https://animint.github.io/animint2/reference/autoplot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a complete ggplot appropriate to a particular data type — autoplot","text":"ggplot object","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/benchplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Benchmark plot creation time.\r\nBroken down into construct, build, render and draw times. — benchplot","title":"Benchmark plot creation time.\r\nBroken down into construct, build, render and draw times. — benchplot","text":"Benchmark plot creation time. Broken construct, build, render draw times.","code":""},{"path":"https://animint.github.io/animint2/reference/benchplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Benchmark plot creation time.\r\nBroken down into construct, build, render and draw times. — benchplot","text":"","code":"benchplot(x)"},{"path":"https://animint.github.io/animint2/reference/benchplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Benchmark plot creation time.\r\nBroken down into construct, build, render and draw times. — benchplot","text":"x code create ggplot2 plot","code":""},{"path":"https://animint.github.io/animint2/reference/benchplot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Benchmark plot creation time.\r\nBroken down into construct, build, render and draw times. — benchplot","text":"","code":"benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point()) #> step user.self sys.self elapsed #> 1 construct 0.00 0 0.00 #> 2 build 0.00 0 0.00 #> 3 render 0.02 0 0.01 #> 4 draw 0.03 0 0.03 #> 5 TOTAL 0.05 0 0.04 benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl)) #> step user.self sys.self elapsed #> 1 construct 0.00 0 0.00 #> 2 build 0.02 0 0.01 #> 3 render 0.03 0 0.03 #> 4 draw 0.04 0 0.05 #> 5 TOTAL 0.09 0 0.09"},{"path":"https://animint.github.io/animint2/reference/borders.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a layer of map borders. — borders","title":"Create a layer of map borders. — borders","text":"Create layer map borders.","code":""},{"path":"https://animint.github.io/animint2/reference/borders.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a layer of map borders. — borders","text":"","code":"borders( database = \"world\", regions = \".\", fill = NA, colour = \"grey50\", xlim = NULL, ylim = NULL, ... )"},{"path":"https://animint.github.io/animint2/reference/borders.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a layer of map borders. — borders","text":"database map data, see map details regions map region fill fill colour colour border colour xlim, ylim latitudinal logitudinal range extracting map polygons, see map details. ... arguments passed onto geom_polygon","code":""},{"path":"https://animint.github.io/animint2/reference/borders.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a layer of map borders. — borders","text":"","code":"if (require(\"maps\")) { ia <- map_data(\"county\", \"iowa\") mid_range <- function(x) mean(range(x)) seats <- plyr::ddply(ia, \"subregion\", plyr::colwise(mid_range, c(\"lat\", \"long\"))) ggplot(ia, aes(long, lat)) + geom_polygon(aes(group = group), fill = NA, colour = \"grey60\") + geom_text(aes(label = subregion), data = seats, size = 2, angle = 45) data(us.cities) capitals <- subset(us.cities, capital == 2) ggplot(capitals, aes(long, lat)) + borders(\"state\") + geom_point(aes(size = pop)) + scale_size_area() + coord_quickmap() # Same map, with some world context ggplot(capitals, aes(long, lat)) + borders(\"world\", xlim = c(-130, -60), ylim = c(20, 50)) + geom_point(aes(size = pop)) + scale_size_area() + coord_quickmap() }"},{"path":"https://animint.github.io/animint2/reference/breakpoints.html","id":null,"dir":"Reference","previous_headings":"","what":"The breakpointError of simulated signals — breakpoints","title":"The breakpointError of simulated signals — breakpoints","text":"Two noisy signals sampled latent signal known breakpoints, used measure error estimated models 1,...,20 segments.","code":""},{"path":"https://animint.github.io/animint2/reference/breakpoints.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The breakpointError of simulated signals — breakpoints","text":"","code":"data(breakpoints)"},{"path":"https://animint.github.io/animint2/reference/breakpoints.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"The breakpointError of simulated signals — breakpoints","text":"list 5 data.frames: error contains breakpointError estimated models, signals contains noisy signals, breaks contains breakpoints estimated signals, segments contains estimated segments, imprecision contains normalized imprecision curves used evaluate error.","code":""},{"path":"https://animint.github.io/animint2/reference/breakpoints.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"The breakpointError of simulated signals — breakpoints","text":"breakpointError package used measure model error, see etc/breakpoints.R.","code":""},{"path":"https://animint.github.io/animint2/reference/calc_element.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate the element properties, by inheriting properties from its parents — calc_element","title":"Calculate the element properties, by inheriting properties from its parents — calc_element","text":"Calculate element properties, inheriting properties parents","code":""},{"path":"https://animint.github.io/animint2/reference/calc_element.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate the element properties, by inheriting properties from its parents — calc_element","text":"","code":"calc_element(element, theme, verbose = FALSE)"},{"path":"https://animint.github.io/animint2/reference/calc_element.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate the element properties, by inheriting properties from its parents — calc_element","text":"element name theme element calculate theme theme object (like theme_grey()) verbose TRUE, print elements one inherits ","code":""},{"path":"https://animint.github.io/animint2/reference/calc_element.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate the element properties, by inheriting properties from its parents — calc_element","text":"","code":"t <- theme_grey() calc_element('text', t) #> List of 10 #> $ family : chr \"\" #> $ face : chr \"plain\" #> $ colour : chr \"black\" #> $ size : num 11 #> $ hjust : num 0.5 #> $ vjust : num 0.5 #> $ angle : num 0 #> $ lineheight: num 0.9 #> $ margin : 'margin' num [1:4] 0points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" # Compare the \"raw\" element definition to the element with calculated inheritance t$axis.text.x #> List of 10 #> $ family : NULL #> $ face : NULL #> $ colour : NULL #> $ size : NULL #> $ hjust : NULL #> $ vjust : num 1 #> $ angle : NULL #> $ lineheight: NULL #> $ margin : 'margin' num [1:4] 2.2points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : NULL #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" calc_element('axis.text.x', t, verbose = TRUE) #> axis.text.x --> #> axis.text #> axis.text --> #> text #> text --> #> nothing (top level) #> List of 10 #> $ family : chr \"\" #> $ face : chr \"plain\" #> $ colour : chr \"grey30\" #> $ size : num 11 #> $ hjust : num 0.5 #> $ vjust : num 1 #> $ angle : num 0 #> $ lineheight: num 0.9 #> $ margin : 'margin' num [1:4] 2.2points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" # This reports that axis.text.x inherits from axis.text, # which inherits from text. You can view each of them with: t$axis.text.x #> List of 10 #> $ family : NULL #> $ face : NULL #> $ colour : NULL #> $ size : NULL #> $ hjust : NULL #> $ vjust : num 1 #> $ angle : NULL #> $ lineheight: NULL #> $ margin : 'margin' num [1:4] 2.2points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : NULL #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" t$axis.text #> List of 10 #> $ family : NULL #> $ face : NULL #> $ colour : chr \"grey30\" #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight: NULL #> $ margin : NULL #> $ debug : NULL #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" t$text #> List of 10 #> $ family : chr \"\" #> $ face : chr \"plain\" #> $ colour : chr \"black\" #> $ size : num 11 #> $ hjust : num 0.5 #> $ vjust : num 0.5 #> $ angle : num 0 #> $ lineheight: num 0.9 #> $ margin : 'margin' num [1:4] 0points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\""},{"path":"https://animint.github.io/animint2/reference/change.html","id":null,"dir":"Reference","previous_headings":"","what":"Graphical model structure change — change","title":"Graphical model structure change — change","text":"model detecting graphical model structure changes applied simulated data know real changes.","code":""},{"path":"https://animint.github.io/animint2/reference/change.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Graphical model structure change — change","text":"","code":"data(change)"},{"path":"https://animint.github.io/animint2/reference/change.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Graphical model structure change — change","text":"List 4 data.frames: coefs contains coefficients every variable every point regularization path, truth contains information variables real changes, likelihood contains train test likelihood, position contains positions laying graphical model nodes 2D plane.","code":""},{"path":"https://animint.github.io/animint2/reference/change.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Graphical model structure change — change","text":"Song Liu, personal communication.","code":""},{"path":"https://animint.github.io/animint2/reference/change.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Graphical model structure change — change","text":"Liu S, Quinn JA, Gutmann MU, Sugiyama M. Direct Learning Sparse Changes Markov Networks Density Ratio Estimation. ECML/PKDD 2013.","code":""},{"path":"https://animint.github.io/animint2/reference/checkAnimationTimeVar.html","id":null,"dir":"Reference","previous_headings":"","what":"Check animation variable for errors — checkAnimationTimeVar","title":"Check animation variable for errors — checkAnimationTimeVar","text":"Check animation variable errors","code":""},{"path":"https://animint.github.io/animint2/reference/checkAnimationTimeVar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check animation variable for errors — checkAnimationTimeVar","text":"","code":"checkAnimationTimeVar(timeVarList)"},{"path":"https://animint.github.io/animint2/reference/checkAnimationTimeVar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check animation variable for errors — checkAnimationTimeVar","text":"timeVarList plot.list$time animint2dir check errors","code":""},{"path":"https://animint.github.io/animint2/reference/checkAnimationTimeVar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check animation variable for errors — checkAnimationTimeVar","text":"NULL :Stops error invalid input","code":""},{"path":"https://animint.github.io/animint2/reference/checkExtraParams.html","id":null,"dir":"Reference","previous_headings":"","what":"Check extra_params argument for duplicates, non-named list — checkExtraParams","title":"Check extra_params argument for duplicates, non-named list — checkExtraParams","text":"Check extra_params argument duplicates, non-named list","code":""},{"path":"https://animint.github.io/animint2/reference/checkExtraParams.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check extra_params argument for duplicates, non-named list — checkExtraParams","text":"","code":"checkExtraParams(extra_params, aes_mapping)"},{"path":"https://animint.github.io/animint2/reference/checkExtraParams.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check extra_params argument for duplicates, non-named list — checkExtraParams","text":"extra_params named list containing details showSelected clickSelects values layer aes_mapping aesthetics mapping layer","code":""},{"path":"https://animint.github.io/animint2/reference/checkExtraParams.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check extra_params argument for duplicates, non-named list — checkExtraParams","text":"Modified extra_params list","code":""},{"path":"https://animint.github.io/animint2/reference/checkForSSandCSasAesthetics.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if showSelected and clickSelects have been used as aesthetics\r\nas in old syntax. If yes, raise error — checkForSSandCSasAesthetics","title":"Check if showSelected and clickSelects have been used as aesthetics\r\nas in old syntax. If yes, raise error — checkForSSandCSasAesthetics","text":"Check showSelected clickSelects used aesthetics old syntax. yes, raise error","code":""},{"path":"https://animint.github.io/animint2/reference/checkForSSandCSasAesthetics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if showSelected and clickSelects have been used as aesthetics\r\nas in old syntax. If yes, raise error — checkForSSandCSasAesthetics","text":"","code":"checkForSSandCSasAesthetics(aesthetics, plot_name)"},{"path":"https://animint.github.io/animint2/reference/checkForSSandCSasAesthetics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if showSelected and clickSelects have been used as aesthetics\r\nas in old syntax. If yes, raise error — checkForSSandCSasAesthetics","text":"aesthetics list. aesthetics mapping layer plot_name character vector plot layer belongs ","code":""},{"path":"https://animint.github.io/animint2/reference/checkForSSandCSasAesthetics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if showSelected and clickSelects have been used as aesthetics\r\nas in old syntax. If yes, raise error — checkForSSandCSasAesthetics","text":"NULL Throws error used aesthetics","code":""},{"path":"https://animint.github.io/animint2/reference/checkPlotForAnimintExtensions.html","id":null,"dir":"Reference","previous_headings":"","what":"Performs error checking on the plot for animint extensions — checkPlotForAnimintExtensions","title":"Performs error checking on the plot for animint extensions — checkPlotForAnimintExtensions","text":"Performs error checking plot animint extensions","code":""},{"path":"https://animint.github.io/animint2/reference/checkPlotForAnimintExtensions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Performs error checking on the plot for animint extensions — checkPlotForAnimintExtensions","text":"","code":"checkPlotForAnimintExtensions(p, plot_name)"},{"path":"https://animint.github.io/animint2/reference/checkPlotForAnimintExtensions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Performs error checking on the plot for animint extensions — checkPlotForAnimintExtensions","text":"p plot plot.list check errors plot_name plot name error check. alphanumeric begin alphabet","code":""},{"path":"https://animint.github.io/animint2/reference/checkPlotForAnimintExtensions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Performs error checking on the plot for animint extensions — checkPlotForAnimintExtensions","text":"NULL :Stops error invalid input","code":""},{"path":"https://animint.github.io/animint2/reference/checkPlotList.html","id":null,"dir":"Reference","previous_headings":"","what":"Check plot.list for errors — checkPlotList","title":"Check plot.list for errors — checkPlotList","text":"Check plot.list list every element named","code":""},{"path":"https://animint.github.io/animint2/reference/checkPlotList.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check plot.list for errors — checkPlotList","text":"","code":"checkPlotList(plot.list)"},{"path":"https://animint.github.io/animint2/reference/checkPlotList.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check plot.list for errors — checkPlotList","text":"plot.list animint2dir check errors","code":""},{"path":"https://animint.github.io/animint2/reference/checkPlotList.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check plot.list for errors — checkPlotList","text":"Throws error invalid values","code":""},{"path":"https://animint.github.io/animint2/reference/checkSingleShowSelectedValue.html","id":null,"dir":"Reference","previous_headings":"","what":"Issue warnings for non interactive plots where there is only one\r\nshowSelected value — checkSingleShowSelectedValue","title":"Issue warnings for non interactive plots where there is only one\r\nshowSelected value — checkSingleShowSelectedValue","text":"Issue warnings non interactive plots one showSelected value","code":""},{"path":"https://animint.github.io/animint2/reference/checkSingleShowSelectedValue.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Issue warnings for non interactive plots where there is only one\r\nshowSelected value — checkSingleShowSelectedValue","text":"","code":"checkSingleShowSelectedValue(selectors)"},{"path":"https://animint.github.io/animint2/reference/checkSingleShowSelectedValue.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Issue warnings for non interactive plots where there is only one\r\nshowSelected value — checkSingleShowSelectedValue","text":"selectors selectors check warnings","code":""},{"path":"https://animint.github.io/animint2/reference/checkSingleShowSelectedValue.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Issue warnings for non interactive plots where there is only one\r\nshowSelected value — checkSingleShowSelectedValue","text":"NULL","code":""},{"path":"https://animint.github.io/animint2/reference/ChromHMMiterations.html","id":null,"dir":"Reference","previous_headings":"","what":"ChromHMM iterations — ChromHMMiterations","title":"ChromHMM iterations — ChromHMMiterations","text":"ChromHMM run one iPS sample 100 iterations convergence metrics parameter values saved iteration.","code":""},{"path":"https://animint.github.io/animint2/reference/ChromHMMiterations.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ChromHMM iterations — ChromHMMiterations","text":"","code":"data(\"ChromHMMiterations\")"},{"path":"https://animint.github.io/animint2/reference/ChromHMMiterations.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"ChromHMM iterations — ChromHMMiterations","text":"Named list 3 data.frames: metrics, transition, emission.","code":""},{"path":"https://animint.github.io/animint2/reference/ChromHMMiterations.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"ChromHMM iterations — ChromHMMiterations","text":"https://github.com/tdhock/ChromHMM-viz/blob/master/iterations.R","code":""},{"path":"https://animint.github.io/animint2/reference/climate.html","id":null,"dir":"Reference","previous_headings":"","what":"Climate data in central America from 1995 to 2000 — climate","title":"Climate data in central America from 1995 to 2000 — climate","text":"Monthly observations atmospheric variables 1995-2000, 113.75W-56.25W, 21.25S-36.25N 2.5 degree grid spacing. Variables: pressure, temperature, ozone low, medium, high cloud cover. Temperatures given degrees celsius (original data Kelvin).","code":""},{"path":"https://animint.github.io/animint2/reference/climate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Climate data in central America from 1995 to 2000 — climate","text":"","code":"data(climate)"},{"path":"https://animint.github.io/animint2/reference/climate.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Climate data in central America from 1995 to 2000 — climate","text":"data frame 41472 observations following 16 variables. time numeric vector y numeric vector x numeric vector lat numeric vector long numeric vector date POSIXct cloudhigh numeric vector cloudlow numeric vector cloudmid numeric vector ozone numeric vector pressure numeric vector surftemp numeric vector temperature numeric vector id character vector month numeric vector year numeric vector","code":""},{"path":"https://animint.github.io/animint2/reference/climate.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Climate data in central America from 1995 to 2000 — climate","text":"NASA Goddard Institute Space Studies (GISS) subset monthly climatology International Satellite Cloud Climatology Project (ISCCP)","code":""},{"path":"https://animint.github.io/animint2/reference/colsNotToCopy.html","id":null,"dir":"Reference","previous_headings":"","what":"Filter out columns that do not need to be copied — colsNotToCopy","title":"Filter out columns that do not need to be copied — colsNotToCopy","text":"Filter columns need copied","code":""},{"path":"https://animint.github.io/animint2/reference/colsNotToCopy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Filter out columns that do not need to be copied — colsNotToCopy","text":"","code":"colsNotToCopy(g, s.aes)"},{"path":"https://animint.github.io/animint2/reference/colsNotToCopy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Filter out columns that do not need to be copied — colsNotToCopy","text":"g Geom columns s.aes Selector aesthetics","code":""},{"path":"https://animint.github.io/animint2/reference/colsNotToCopy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Filter out columns that do not need to be copied — colsNotToCopy","text":"Character vector columns copied","code":""},{"path":"https://animint.github.io/animint2/reference/compare.html","id":null,"dir":"Reference","previous_headings":"","what":"Testing rank and compare SVM on simulated patterns — compare","title":"Testing rank and compare SVM on simulated patterns — compare","text":"50, ..., 800 labeled pairs generated according squared L1, L2, Linf norms, input features [-3, 3]. Labels -1 significant difference ranks Xt Xtp, 1 rank Xtp significantly higher rank Xt. SVMrank ignores pairs labeled -1, SVMcompare uses learn accurate predictive model, shown test error level curves learned functions.","code":""},{"path":"https://animint.github.io/animint2/reference/compare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Testing rank and compare SVM on simulated patterns — compare","text":"","code":"data(compare)"},{"path":"https://animint.github.io/animint2/reference/compare.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Testing rank and compare SVM on simulated patterns — compare","text":"List 4 data.frames: error contains test error learned models, bayes contains Bayes classification error latent ranking function applied test data, rank contains ranking functions evaluated grid input points, train.pairs contains data used train algorithms.","code":""},{"path":"https://animint.github.io/animint2/reference/compare.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Testing rank and compare SVM on simulated patterns — compare","text":"Hocking TD, Spanurattana S, Sugiyama M. Support vector comparison machines (2013).","code":""},{"path":"https://animint.github.io/animint2/reference/continuous_scale.html","id":null,"dir":"Reference","previous_headings":"","what":"Continuous scale constructor. — continuous_scale","title":"Continuous scale constructor. — continuous_scale","text":"Continuous scale constructor.","code":""},{"path":"https://animint.github.io/animint2/reference/continuous_scale.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Continuous scale constructor. — continuous_scale","text":"","code":"continuous_scale( aesthetics, scale_name, palette, name = waiver(), breaks = waiver(), minor_breaks = waiver(), labels = waiver(), limits = NULL, rescaler = rescale, oob = censor, expand = waiver(), na.value = NA_real_, trans = \"identity\", guide = \"legend\" )"},{"path":"https://animint.github.io/animint2/reference/continuous_scale.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Continuous scale constructor. — continuous_scale","text":"aesthetics names aesthetics scale works scale_name name scale palette palette function called single integer argument (number levels scale) returns values take name name scale. Used axis legend title. NULL, default, name scale taken first mapping used aesthetic. breaks One : NULL breaks waiver() default breaks computed transformation object numeric vector positions function takes limits input returns breaks output minor_breaks One : NULL minor breaks waiver() default breaks (one minor break major break) numeric vector positions function given limits returns vector minor breaks. labels One : NULL labels waiver() default labels computed transformation object character vector giving labels (must length breaks) function takes breaks input returns labels output limits numeric vector length two providing limits scale. Use NA refer existing minimum maximum. rescaler Used diverging n colour gradients (.e. scale_colour_gradient2, scale_colour_gradientn). function used scale input values range [0, 1]. oob Function handles limits outside scale limits (bounds). default replaces bounds values NA. expand numeric vector length two giving multiplicative additive expansion constants. constants ensure data placed distance away axes. defaults c(0.05, 0) continuous variables, c(0, 0.6) discrete variables. na.value Missing values replaced value. trans Either name transformation object, object . Built-transformations include \"asn\", \"atanh\", \"boxcox\", \"exp\", \"identity\", \"log\", \"log10\", \"log1p\", \"log2\", \"logit\", \"probability\", \"probit\", \"reciprocal\", \"reverse\" \"sqrt\". transformation object bundles together transform, inverse, methods generating breaks labels. Transformation objects defined scales package, called name_trans, e.g. boxcox_trans. can create transformation trans_new. guide Name guide object, object .","code":""},{"path":"https://animint.github.io/animint2/reference/coord_cartesian.html","id":null,"dir":"Reference","previous_headings":"","what":"Cartesian coordinates. — coord_cartesian","title":"Cartesian coordinates. — coord_cartesian","text":"Cartesian coordinate system familiar, common, type coordinate system. Setting limits coordinate system zoom plot (like looking magnifying glass), change underlying data like setting limits scale .","code":""},{"path":"https://animint.github.io/animint2/reference/coord_cartesian.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cartesian coordinates. — coord_cartesian","text":"","code":"coord_cartesian(xlim = NULL, ylim = NULL, expand = TRUE)"},{"path":"https://animint.github.io/animint2/reference/coord_cartesian.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cartesian coordinates. — coord_cartesian","text":"xlim, ylim Limits x y axes. expand TRUE, default, adds small expansion factor limits ensure data axes overlap. FALSE, limits taken exactly data xlim/ylim.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_cartesian.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cartesian coordinates. — coord_cartesian","text":"","code":"# There are two ways of zooming the plot display: with scales or # with coordinate systems. They work in two rather different ways. p <- ggplot(mtcars, aes(disp, wt)) + geom_point() + geom_smooth() p # Setting the limits on a scale converts all values outside the range to NA. p + scale_x_continuous(limits = c(325, 500)) #> Warning: Removed 24 rows containing non-finite values (stat_smooth). #> Warning: Removed 24 rows containing missing values (geom_point). # Setting the limits on the coordinate system performs a visual zoom. # The data is unchanged, and we just view a small portion of the original # plot. Note how smooth continues past the points visible on this plot. p + coord_cartesian(xlim = c(325, 500)) # By default, the same expansion factor is applied as when setting scale # limits. You can set the limits precisely by setting expand = FALSE p + coord_cartesian(xlim = c(325, 500), expand = FALSE) # Simiarly, we can use expand = FALSE to turn off expansion with the # default limits p + coord_cartesian(expand = FALSE) # You can see the same thing with this 2d histogram d <- ggplot(diamonds, aes(carat, price)) + stat_bin2d(bins = 25, colour = \"white\") d # When zooming the scale, the we get 25 new bins that are the same # size on the plot, but represent smaller regions of the data space d + scale_x_continuous(limits = c(0, 1)) #> Warning: Removed 17502 rows containing non-finite values (stat_bin2d). # When zooming the coordinate system, we see a subset of original 50 bins, # displayed bigger d + coord_cartesian(xlim = c(0, 1))"},{"path":"https://animint.github.io/animint2/reference/coord_fixed.html","id":null,"dir":"Reference","previous_headings":"","what":"Cartesian coordinates with fixed relationship between x and y scales. — coord_fixed","title":"Cartesian coordinates with fixed relationship between x and y scales. — coord_fixed","text":"fixed scale coordinate system forces specified ratio physical representation data units axes. ratio represents number units y-axis equivalent one unit x-axis. default, ratio = 1, ensures one unit x-axis length one unit y-axis. Ratios higher one make units y axis longer units x-axis, vice versa. similar eqscplot, works types graphics.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_fixed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cartesian coordinates with fixed relationship between x and y scales. — coord_fixed","text":"","code":"coord_fixed(ratio = 1, xlim = NULL, ylim = NULL, expand = TRUE)"},{"path":"https://animint.github.io/animint2/reference/coord_fixed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cartesian coordinates with fixed relationship between x and y scales. — coord_fixed","text":"ratio aspect ratio, expressed y / x xlim, ylim Limits x y axes. expand TRUE, default, adds small expansion factor limits ensure data axes overlap. FALSE, limits taken exactly data xlim/ylim.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_fixed.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cartesian coordinates with fixed relationship between x and y scales. — coord_fixed","text":"","code":"# ensures that the ranges of axes are equal to the specified ratio by # adjusting the plot aspect ratio p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p + coord_fixed(ratio = 1) p + coord_fixed(ratio = 5) p + coord_fixed(ratio = 1/5) # Resize the plot to see that the specified aspect ratio is maintained"},{"path":"https://animint.github.io/animint2/reference/coord_flip.html","id":null,"dir":"Reference","previous_headings":"","what":"Flipped cartesian coordinates. — coord_flip","title":"Flipped cartesian coordinates. — coord_flip","text":"Flipped cartesian coordinates horizontal becomes vertical, vertical, horizontal. primarily useful converting geoms statistics display y conditional x, x conditional y.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_flip.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flipped cartesian coordinates. — coord_flip","text":"","code":"coord_flip(xlim = NULL, ylim = NULL, expand = TRUE)"},{"path":"https://animint.github.io/animint2/reference/coord_flip.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flipped cartesian coordinates. — coord_flip","text":"xlim, ylim Limits x y axes. expand TRUE, default, adds small expansion factor limits ensure data axes overlap. FALSE, limits taken exactly data xlim/ylim.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_flip.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Flipped cartesian coordinates. — coord_flip","text":"","code":"h <- ggplot(diamonds, aes(carat)) + geom_histogram() h #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. h + coord_flip() #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. h + coord_flip() + scale_x_reverse() #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. # You can also use it to flip line and area plots: df <- data.frame(x = 1:5, y = (1:5) ^ 2) ggplot(df, aes(x, y)) + geom_area() last_plot() + coord_flip()"},{"path":"https://animint.github.io/animint2/reference/coord_map.html","id":null,"dir":"Reference","previous_headings":"","what":"Map projections. — coord_map","title":"Map projections. — coord_map","text":"representation portion earth, approximately spherical, onto flat 2D plane requires projection. coord_map . projections account fact actual length (km) one degree longitude varies equator pole. Near equator, ratio lengths one degree latitude one degree longitude approximately 1. Near pole, tends towards infinity length one degree longitude tends towards 0. regions span degrees close poles, setting aspect ratio plot appropriate lat/lon ratio approximates usual mercator projection. coord_quickmap . coord_map elements graphic projected case . coord_quickmap advantage much faster, particular complex plots using geom_tile, expense correctness projection. coordinate system provides full range map projections available mapproj package.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_map.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Map projections. — coord_map","text":"","code":"coord_map( projection = \"mercator\", ..., orientation = NULL, xlim = NULL, ylim = NULL ) coord_quickmap(xlim = NULL, ylim = NULL, expand = TRUE)"},{"path":"https://animint.github.io/animint2/reference/coord_map.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Map projections. — coord_map","text":"projection projection use, see mapproject list ... arguments passed mapproject orientation projection orientation, defaults c(90, 0, mean(range(x))). optimal many projections, supply . See mapproject information. xlim manually specific x limits (degrees longitude) ylim manually specific y limits (degrees latitude) expand TRUE, default, adds small expansion factor limits ensure data axes overlap. FALSE, limits taken exactly data xlim/ylim.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_map.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Map projections. — coord_map","text":"","code":"if (require(\"maps\")) { nz <- map_data(\"nz\") # Prepare a map of NZ nzmap <- ggplot(nz, aes(x = long, y = lat, group = group)) + geom_polygon(fill = \"white\", colour = \"black\") # Plot it in cartesian coordinates nzmap # With correct mercator projection nzmap + coord_map() # With the aspect ratio approximation nzmap + coord_quickmap() # Other projections nzmap + coord_map(\"cylindrical\") nzmap + coord_map(\"azequalarea\", orientation = c(-36.92,174.6,0)) states <- map_data(\"state\") usamap <- ggplot(states, aes(long, lat, group = group)) + geom_polygon(fill = \"white\", colour = \"black\") # Use cartesian coordinates usamap # With mercator projection usamap + coord_map() usamap + coord_quickmap() # See ?mapproject for coordinate systems and their parameters usamap + coord_map(\"gilbert\") usamap + coord_map(\"lagrange\") # For most projections, you'll need to set the orientation yourself # as the automatic selection done by mapproject is not available to # ggplot usamap + coord_map(\"orthographic\") usamap + coord_map(\"stereographic\") usamap + coord_map(\"conic\", lat0 = 30) usamap + coord_map(\"bonne\", lat0 = 50) # World map, using geom_path instead of geom_polygon world <- map_data(\"world\") worldmap <- ggplot(world, aes(x = long, y = lat, group = group)) + geom_path() + scale_y_continuous(breaks = (-2:2) * 30) + scale_x_continuous(breaks = (-4:4) * 45) # Orthographic projection with default orientation (looking down at North pole) worldmap + coord_map(\"ortho\") # Looking up up at South Pole worldmap + coord_map(\"ortho\", orientation = c(-90, 0, 0)) # Centered on New York (currently has issues with closing polygons) worldmap + coord_map(\"ortho\", orientation = c(41, -74, 0)) }"},{"path":"https://animint.github.io/animint2/reference/coord_munch.html","id":null,"dir":"Reference","previous_headings":"","what":"Munch coordinates data — coord_munch","title":"Munch coordinates data — coord_munch","text":"function \"munches\" lines, dividing line many small pieces can transformed independently. Used inside geom functions.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_munch.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Munch coordinates data — coord_munch","text":"","code":"coord_munch(coord, data, range, segment_length = 0.01)"},{"path":"https://animint.github.io/animint2/reference/coord_munch.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Munch coordinates data — coord_munch","text":"coord Coordinate system definition. data Data set transform - variables x y chopped small pieces (defined group). variables duplicated needed. range Panel range specification. segment_length Target segment length","code":""},{"path":"https://animint.github.io/animint2/reference/coord_polar.html","id":null,"dir":"Reference","previous_headings":"","what":"Polar coordinates. — coord_polar","title":"Polar coordinates. — coord_polar","text":"polar coordinate system commonly used pie charts, stacked bar chart polar coordinates.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_polar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Polar coordinates. — coord_polar","text":"","code":"coord_polar(theta = \"x\", start = 0, direction = 1)"},{"path":"https://animint.github.io/animint2/reference/coord_polar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Polar coordinates. — coord_polar","text":"theta variable map angle (x y) start offset starting point 12 o'clock radians direction 1, clockwise; -1, anticlockwise","code":""},{"path":"https://animint.github.io/animint2/reference/coord_polar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Polar coordinates. — coord_polar","text":"","code":"# NOTE: Use these plots with caution - polar coordinates has # major perceptual problems. The main point of these examples is # to demonstrate how these common plots can be described in the # grammar. Use with EXTREME caution. #' # A pie chart = stacked bar chart + polar coordinates pie <- ggplot(mtcars, aes(x = factor(1), fill = factor(cyl))) + geom_bar(width = 1) pie + coord_polar(theta = \"y\") # \\donttest{ # A coxcomb plot = bar chart + polar coordinates cxc <- ggplot(mtcars, aes(x = factor(cyl))) + geom_bar(width = 1, colour = \"black\") cxc + coord_polar() # A new type of plot? cxc + coord_polar(theta = \"y\") # The bullseye chart pie + coord_polar() # Hadley's favourite pie chart df <- data.frame( variable = c(\"does not resemble\", \"resembles\"), value = c(20, 80) ) ggplot(df, aes(x = \"\", y = value, fill = variable)) + geom_bar(width = 1, stat = \"identity\") + scale_fill_manual(values = c(\"red\", \"yellow\")) + coord_polar(\"y\", start = pi / 3) + labs(title = \"Pac man\") # Windrose + doughnut plot if (require(\"ggplot2movies\")) { movies$rrating <- cut_interval(movies$rating, length = 1) movies$budgetq <- cut_number(movies$budget, 4) doh <- ggplot(movies, aes(x = rrating, fill = budgetq)) # Wind rose doh + geom_bar(width = 1) + coord_polar() # Race track plot doh + geom_bar(width = 0.9, position = \"fill\") + coord_polar(theta = \"y\") } #> Loading required package: ggplot2movies # }"},{"path":"https://animint.github.io/animint2/reference/coord_trans.html","id":null,"dir":"Reference","previous_headings":"","what":"Transformed cartesian coordinate system. — coord_trans","title":"Transformed cartesian coordinate system. — coord_trans","text":"coord_trans different scale transformations occurs statistical transformation affect visual appearance geoms - guarantee straight lines continue straight.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_trans.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Transformed cartesian coordinate system. — coord_trans","text":"","code":"coord_trans( x = \"identity\", y = \"identity\", limx = NULL, limy = NULL, xtrans, ytrans )"},{"path":"https://animint.github.io/animint2/reference/coord_trans.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Transformed cartesian coordinate system. — coord_trans","text":"x, y transformers x y axes limx, limy limits x y axes. (Named backward compatibility) xtrans, ytrans Deprecated; use x y instead.","code":""},{"path":"https://animint.github.io/animint2/reference/coord_trans.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Transformed cartesian coordinate system. — coord_trans","text":"current transformations work continuous values - see trans_new list transformations, instructions create .","code":""},{"path":"https://animint.github.io/animint2/reference/coord_trans.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Transformed cartesian coordinate system. — coord_trans","text":"","code":"# \\donttest{ # Three ways of doing transformation in ggplot: # * by transforming the data ggplot(diamonds, aes(log10(carat), log10(price))) + geom_point() # * by transforming the scales ggplot(diamonds, aes(carat, price)) + geom_point() + scale_x_log10() + scale_y_log10() # * by transforming the coordinate system: ggplot(diamonds, aes(carat, price)) + geom_point() + coord_trans(x = \"log10\", y = \"log10\") # The difference between transforming the scales and # transforming the coordinate system is that scale # transformation occurs BEFORE statistics, and coordinate # transformation afterwards. Coordinate transformation also # changes the shape of geoms: d <- subset(diamonds, carat > 0.5) ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = \"lm\") + scale_x_log10() + scale_y_log10() ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = \"lm\") + coord_trans(x = \"log10\", y = \"log10\") # Here I used a subset of diamonds so that the smoothed line didn't # drop below zero, which obviously causes problems on the log-transformed # scale # With a combination of scale and coordinate transformation, it's # possible to do back-transformations: ggplot(diamonds, aes(carat, price)) + geom_point() + geom_smooth(method = \"lm\") + scale_x_log10() + scale_y_log10() + coord_trans(x = scales::exp_trans(10), y = scales::exp_trans(10)) # cf. ggplot(diamonds, aes(carat, price)) + geom_point() + geom_smooth(method = \"lm\") # Also works with discrete scales df <- data.frame(a = abs(rnorm(26)),letters) plot <- ggplot(df,aes(a,letters)) + geom_point() plot + coord_trans(x = \"log10\") plot + coord_trans(x = \"sqrt\") # }"},{"path":"https://animint.github.io/animint2/reference/cut_interval.html","id":null,"dir":"Reference","previous_headings":"","what":"Cut up numeric vector into useful groups. — cut_interval","title":"Cut up numeric vector into useful groups. — cut_interval","text":"cut_interval makes n groups equal range, cut_number makes n groups (approximately) equal numbers observations; cut_width makes groups width width.","code":""},{"path":"https://animint.github.io/animint2/reference/cut_interval.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cut up numeric vector into useful groups. — cut_interval","text":"","code":"cut_interval(x, n = NULL, length = NULL, ...) cut_number(x, n = NULL, ...) cut_width( x, width, center = NULL, boundary = NULL, closed = c(\"right\", \"left\") )"},{"path":"https://animint.github.io/animint2/reference/cut_interval.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cut up numeric vector into useful groups. — cut_interval","text":"x numeric vector n number intervals create, length length interval ... arguments passed cut width bin width. center, boundary Specify either position edge center bin. Since bins aligned, specifying position single bin (need range data) affects location bins. specified, uses \"tile layers algorithm\", sets boundary half binwidth. center integers, width = 1 center = 0. boundary = 0.5. closed One \"right\" \"left\" indicating whether right left edges bins included bin.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/cut_interval.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Cut up numeric vector into useful groups. — cut_interval","text":"Randall Prium contributed implementation cut_width.","code":""},{"path":"https://animint.github.io/animint2/reference/cut_interval.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cut up numeric vector into useful groups. — cut_interval","text":"","code":"table(cut_interval(1:100, 10)) #> #> [1,10.9] (10.9,20.8] (20.8,30.7] (30.7,40.6] (40.6,50.5] (50.5,60.4] #> 10 10 10 10 10 10 #> (60.4,70.3] (70.3,80.2] (80.2,90.1] (90.1,100] #> 10 10 10 10 table(cut_interval(1:100, 11)) #> #> [1,10] (10,19] (19,28] (28,37] (37,46] (46,55] (55,64] (64,73] #> 10 9 9 9 9 9 9 9 #> (73,82] (82,91] (91,100] #> 9 9 9 table(cut_number(runif(1000), 10)) #> #> [0.00155,0.119] (0.119,0.216] (0.216,0.297] (0.297,0.392] (0.392,0.482] #> 100 100 100 100 100 #> (0.482,0.588] (0.588,0.697] (0.697,0.794] (0.794,0.897] (0.897,1] #> 100 100 100 100 100 table(cut_width(runif(1000), 0.1)) #> #> [-0.05,0.05] (0.05,0.15] (0.15,0.25] (0.25,0.35] (0.35,0.45] (0.45,0.55] #> 40 95 107 96 114 105 #> (0.55,0.65] (0.65,0.75] (0.75,0.85] (0.85,0.95] (0.95,1.05] #> 103 97 106 96 41 table(cut_width(runif(1000), 0.1, boundary = 0)) #> #> [0,0.1] (0.1,0.2] (0.2,0.3] (0.3,0.4] (0.4,0.5] (0.5,0.6] (0.6,0.7] (0.7,0.8] #> 99 106 107 93 91 89 108 113 #> (0.8,0.9] (0.9,1] #> 88 106 table(cut_width(runif(1000), 0.1, center = 0)) #> #> [-0.05,0.05] (0.05,0.15] (0.15,0.25] (0.25,0.35] (0.35,0.45] (0.45,0.55] #> 47 104 106 107 85 121 #> (0.55,0.65] (0.65,0.75] (0.75,0.85] (0.85,0.95] (0.95,1.05] #> 106 99 99 80 46"},{"path":"https://animint.github.io/animint2/reference/diamonds.html","id":null,"dir":"Reference","previous_headings":"","what":"Prices of 50,000 round cut diamonds — diamonds","title":"Prices of 50,000 round cut diamonds — diamonds","text":"dataset containing prices attributes almost 54,000 diamonds. variables follows:","code":""},{"path":"https://animint.github.io/animint2/reference/diamonds.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Prices of 50,000 round cut diamonds — diamonds","text":"","code":"diamonds"},{"path":"https://animint.github.io/animint2/reference/diamonds.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Prices of 50,000 round cut diamonds — diamonds","text":"data frame 53940 rows 10 variables: price: price US dollars ($326--$18,823) carat: weight diamond (0.2--5.01) cut: quality cut (Fair, Good, Good, Premium, Ideal) color: diamond colour, J (worst) D (best) clarity: measurement clear diamond (I1 (worst), SI1, SI2, VS1, VS2, VVS1, VVS2, (best)) x: length mm (0--10.74) y: width mm (0--58.9) z: depth mm (0--31.8) depth: total depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79) table: width top diamond relative widest point (43--95)","code":""},{"path":"https://animint.github.io/animint2/reference/discrete_scale.html","id":null,"dir":"Reference","previous_headings":"","what":"Discrete scale constructor. — discrete_scale","title":"Discrete scale constructor. — discrete_scale","text":"Discrete scale constructor.","code":""},{"path":"https://animint.github.io/animint2/reference/discrete_scale.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Discrete scale constructor. — discrete_scale","text":"","code":"discrete_scale( aesthetics, scale_name, palette, name = waiver(), breaks = waiver(), labels = waiver(), limits = NULL, expand = waiver(), na.value = NA, drop = TRUE, guide = \"legend\" )"},{"path":"https://animint.github.io/animint2/reference/discrete_scale.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Discrete scale constructor. — discrete_scale","text":"aesthetics names aesthetics scale works scale_name name scale palette palette function called single integer argument (number levels scale) returns values take name name scale - used axis label legend title breaks control breaks guide. four possible types input: NULL: display breaks character vector giving breaks appear axis legend. waiver() use default break computation. function, called single argument, character vector giving limits scale, returns character vector specifying breaks display. parameter affect way data scaled - affects appearance legend. labels NULL labels, waiver() default labels (labels breaks), character vector length breaks, named character vector whose names used match replacement labels matching breaks. limits character vector specifying data range scale. default order display guides. expand numeric vector length two, giving multiplicative additive constant used expand range scales small gap data axes. defaults (0,0.6) discrete scales (0.05,0) continuous scales. na.value missing values displayed? drop unused factor levels omitted scale? default, TRUE, uses levels appear data; FALSE uses levels factor. guide name , actual function, used create guide. See guides info.","code":""},{"path":"https://animint.github.io/animint2/reference/draw_key.html","id":null,"dir":"Reference","previous_headings":"","what":"Key drawing functions — draw_key","title":"Key drawing functions — draw_key","text":"Geom associated function draws key geom needs displayed legend. options built ggplot2.","code":""},{"path":"https://animint.github.io/animint2/reference/draw_key.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Key drawing functions — draw_key","text":"","code":"draw_key_point(data, params, size) draw_key_abline(data, params, size) draw_key_rect(data, params, size) draw_key_polygon(data, params, size) draw_key_blank(data, params, size) draw_key_crossbar(data, params, size) draw_key_path(data, params, size) draw_key_vpath(data, params, size) draw_key_dotplot(data, params, size) draw_key_pointrange(data, params, size) draw_key_smooth(data, params, size) draw_key_text(data, params, size) draw_key_label(data, params, size) draw_key_vline(data, params, size)"},{"path":"https://animint.github.io/animint2/reference/draw_key.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Key drawing functions — draw_key","text":"data single row data frame containing scaled aesthetics display key params list additional parameters supplied geom. size Width height key mm.","code":""},{"path":"https://animint.github.io/animint2/reference/draw_key.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Key drawing functions — draw_key","text":"grid grob.","code":""},{"path":"https://animint.github.io/animint2/reference/economics.html","id":null,"dir":"Reference","previous_headings":"","what":"US economic time series. — economics","title":"US economic time series. — economics","text":"dataset produced US economic time series data available https://fred.stlouisfed.org/. economics \"wide\" format, economics_long \"long\" format.","code":""},{"path":"https://animint.github.io/animint2/reference/economics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"US economic time series. — economics","text":"","code":"economics economics_long"},{"path":"https://animint.github.io/animint2/reference/economics.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"US economic time series. — economics","text":"data frame 478 rows 6 variables date. Month data collection psavert, personal savings rate, pce, personal consumption expenditures, billions dollars, unemploy, number unemployed thousands, uempmed, median duration unemployment, week, pop, total population, thousands, object class data.frame 2870 rows 4 columns.","code":""},{"path":"https://animint.github.io/animint2/reference/element_blank.html","id":null,"dir":"Reference","previous_headings":"","what":"Theme element: blank.\r\nThis theme element draws nothing, and assigns no space — element_blank","title":"Theme element: blank.\r\nThis theme element draws nothing, and assigns no space — element_blank","text":"Theme element: blank. theme element draws nothing, assigns space","code":""},{"path":"https://animint.github.io/animint2/reference/element_blank.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Theme element: blank.\r\nThis theme element draws nothing, and assigns no space — element_blank","text":"","code":"element_blank()"},{"path":"https://animint.github.io/animint2/reference/element_grob.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate grid grob from theme element — element_grob","title":"Generate grid grob from theme element — element_grob","text":"Generate grid grob theme element","code":""},{"path":"https://animint.github.io/animint2/reference/element_grob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate grid grob from theme element — element_grob","text":"","code":"element_grob(element, ...)"},{"path":"https://animint.github.io/animint2/reference/element_grob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate grid grob from theme element — element_grob","text":"element Theme element, .e. element_rect similar. ... arguments control specific rendering. usually least position. See source code individual methods.","code":""},{"path":"https://animint.github.io/animint2/reference/element_line.html","id":null,"dir":"Reference","previous_headings":"","what":"Theme element: line. — element_line","title":"Theme element: line. — element_line","text":"Theme element: line.","code":""},{"path":"https://animint.github.io/animint2/reference/element_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Theme element: line. — element_line","text":"","code":"element_line( colour = NULL, size = NULL, linetype = NULL, lineend = NULL, color = NULL )"},{"path":"https://animint.github.io/animint2/reference/element_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Theme element: line. — element_line","text":"colour line colour size line size linetype line type lineend line end color alias colour","code":""},{"path":"https://animint.github.io/animint2/reference/element_rect.html","id":null,"dir":"Reference","previous_headings":"","what":"Theme element: rectangle. — element_rect","title":"Theme element: rectangle. — element_rect","text":"often used backgrounds borders.","code":""},{"path":"https://animint.github.io/animint2/reference/element_rect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Theme element: rectangle. — element_rect","text":"","code":"element_rect( fill = NULL, colour = NULL, size = NULL, linetype = NULL, color = NULL )"},{"path":"https://animint.github.io/animint2/reference/element_rect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Theme element: rectangle. — element_rect","text":"fill fill colour colour border colour size border size linetype border linetype color alias colour","code":""},{"path":"https://animint.github.io/animint2/reference/element_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Theme element: text. — element_text","title":"Theme element: text. — element_text","text":"Theme element: text.","code":""},{"path":"https://animint.github.io/animint2/reference/element_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Theme element: text. — element_text","text":"","code":"element_text( family = NULL, face = NULL, colour = NULL, size = NULL, hjust = NULL, vjust = NULL, angle = NULL, lineheight = NULL, color = NULL, margin = NULL, debug = NULL )"},{"path":"https://animint.github.io/animint2/reference/element_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Theme element: text. — element_text","text":"family font family face font face (\"plain\", \"italic\", \"bold\", \"bold.italic\") colour text colour size text size (pts) hjust horizontal justification ([0, 1]) vjust vertical justification ([0, 1]) angle angle ([0, 360]) lineheight line height color alias colour margin margins around text. See margin details. creating theme, margins placed side text facing towards center plot. debug TRUE, aids visual debugging drawing solid rectangle behind complete text area, point label anchored.","code":""},{"path":"https://animint.github.io/animint2/reference/expand_limits.html","id":null,"dir":"Reference","previous_headings":"","what":"Expand the plot limits with data. — expand_limits","title":"Expand the plot limits with data. — expand_limits","text":"panels plots. function thin wrapper around geom_blank makes easy add values.","code":""},{"path":"https://animint.github.io/animint2/reference/expand_limits.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Expand the plot limits with data. — expand_limits","text":"","code":"expand_limits(...)"},{"path":"https://animint.github.io/animint2/reference/expand_limits.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Expand the plot limits with data. — expand_limits","text":"... named list aesthetics specifying value (values) included scale.","code":""},{"path":"https://animint.github.io/animint2/reference/expand_limits.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Expand the plot limits with data. — expand_limits","text":"","code":"p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p + expand_limits(x = 0) p + expand_limits(y = c(1, 9)) p + expand_limits(x = 0, y = 0) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = cyl)) + expand_limits(colour = seq(2, 10, by = 2)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = factor(cyl))) + expand_limits(colour = factor(seq(2, 10, by = 2)))"},{"path":"https://animint.github.io/animint2/reference/facet.html","id":null,"dir":"Reference","previous_headings":"","what":"Facet specification. — facet","title":"Facet specification. — facet","text":"Create new facetting specification. internal use .","code":""},{"path":"https://animint.github.io/animint2/reference/facet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Facet specification. — facet","text":"","code":"facet(..., shrink = TRUE, subclass = c())"},{"path":"https://animint.github.io/animint2/reference/facet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Facet specification. — facet","text":"... object fields shrink shrink scales fit output statistics, raw data","code":""},{"path":"https://animint.github.io/animint2/reference/facet_grid.html","id":null,"dir":"Reference","previous_headings":"","what":"Lay out panels in a grid. — facet_grid","title":"Lay out panels in a grid. — facet_grid","text":"Lay panels grid.","code":""},{"path":"https://animint.github.io/animint2/reference/facet_grid.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lay out panels in a grid. — facet_grid","text":"","code":"facet_grid( facets, margins = FALSE, scales = \"fixed\", space = \"fixed\", shrink = TRUE, labeller = \"label_value\", as.table = TRUE, switch = NULL, drop = TRUE )"},{"path":"https://animint.github.io/animint2/reference/facet_grid.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Lay out panels in a grid. — facet_grid","text":"facets formula rows (tabular display) LHS columns (tabular display) RHS; dot formula used indicate faceting dimension (either row column). formula can also provided string instead classical formula object margins either logical value character vector. Margins additional facets contain data possible values faceting variables. FALSE, additional facets included (default). TRUE, margins included faceting variables. specified character vector, names variables margins created. scales scales shared across facets (default, \"fixed\"), vary across rows (\"free_x\"), columns (\"free_y\"), rows columns (\"free\") space \"fixed\", default, panels size. \"free_y\" height proportional length y scale; \"free_x\" width proportional length x scale; \"free\" height width vary. setting effect unless appropriate scales also vary. shrink TRUE, shrink scales fit output statistics, raw data. FALSE, range raw data statistical summary. labeller function takes one data frame labels returns list data frame character vectors. input column corresponds one factor. Thus one formulae type ~cyl + . output column gets displayed one separate line strip label. function inherit \"labeller\" S3 class compatibility labeller(). See label_value details pointers options. .table TRUE, default, facets laid like table highest values bottom-right. FALSE, facets laid like plot highest value top-right. switch default, labels displayed top right plot. \"x\", top labels displayed bottom. \"y\", right-hand side labels displayed left. Can also set \"\". drop TRUE, default, factor levels used data automatically dropped. FALSE, factor levels shown, regardless whether appear data.","code":""},{"path":"https://animint.github.io/animint2/reference/facet_grid.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Lay out panels in a grid. — facet_grid","text":"","code":"p <- ggplot(mpg, aes(displ, cty)) + geom_point() p + facet_grid(. ~ cyl) p + facet_grid(drv ~ .) p + facet_grid(drv ~ cyl) # To change plot order of facet grid, # change the order of variable levels with factor() # If you combine a facetted dataset with a dataset that lacks those # facetting variables, the data will be repeated across the missing # combinations: df <- data.frame(displ = mean(mpg$displ), cty = mean(mpg$cty)) p + facet_grid(. ~ cyl) + geom_point(data = df, colour = \"red\", size = 2) # Free scales ------------------------------------------------------- # You can also choose whether the scales should be constant # across all panels (the default), or whether they should be allowed # to vary mt <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) + geom_point() mt + facet_grid(. ~ cyl, scales = \"free\") # If scales and space are free, then the mapping between position # and values in the data will be the same across all panels. This # is particularly useful for categorical axes ggplot(mpg, aes(drv, model)) + geom_point() + facet_grid(manufacturer ~ ., scales = \"free\", space = \"free\") + theme(strip.text.y = element_text(angle = 0)) # Facet labels ------------------------------------------------------ p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() p # label_both() displays both variable name and value p + facet_grid(vs ~ cyl, labeller = label_both) # label_parsed() parses text into mathematical expressions, see ?plotmath mtcars$cyl2 <- factor(mtcars$cyl, labels = c(\"alpha\", \"beta\", \"sqrt(x, y)\")) ggplot(mtcars, aes(wt, mpg)) + geom_point() + facet_grid(. ~ cyl2, labeller = label_parsed) # label_bquote() makes it easy to construct math expressions p + facet_grid(. ~ vs, labeller = label_bquote(cols = alpha ^ .(vs))) # The facet strips can be displayed near the axes with switch data <- transform(mtcars, am = factor(am, levels = 0:1, c(\"Automatic\", \"Manual\")), gear = factor(gear, levels = 3:5, labels = c(\"Three\", \"Four\", \"Five\")) ) p <- ggplot(data, aes(mpg, disp)) + geom_point() p + facet_grid(am ~ gear, switch = \"both\") # It looks better without boxes around the strips p + facet_grid(am ~ gear, switch = \"both\") + theme(strip.background = element_blank()) # Margins ---------------------------------------------------------- # \\donttest{ # Margins can be specified by logically (all yes or all no) or by specific # variables as (character) variable names mg <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() mg + facet_grid(vs + am ~ gear) mg + facet_grid(vs + am ~ gear, margins = TRUE) mg + facet_grid(vs + am ~ gear, margins = \"am\") # when margins are made over \"vs\", since the facets for \"am\" vary # within the values of \"vs\", the marginal facet for \"vs\" is also # a margin over \"am\". mg + facet_grid(vs + am ~ gear, margins = \"vs\") mg + facet_grid(vs + am ~ gear, margins = \"gear\") mg + facet_grid(vs + am ~ gear, margins = c(\"gear\", \"am\")) # }"},{"path":"https://animint.github.io/animint2/reference/facet_null.html","id":null,"dir":"Reference","previous_headings":"","what":"Facet specification: a single panel. — facet_null","title":"Facet specification: a single panel. — facet_null","text":"Facet specification: single panel.","code":""},{"path":"https://animint.github.io/animint2/reference/facet_null.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Facet specification: a single panel. — facet_null","text":"","code":"facet_null(shrink = TRUE)"},{"path":"https://animint.github.io/animint2/reference/facet_null.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Facet specification: a single panel. — facet_null","text":"shrink TRUE, shrink scales fit output statistics, raw data. FALSE, range raw data statistical summary.","code":""},{"path":"https://animint.github.io/animint2/reference/facet_null.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Facet specification: a single panel. — facet_null","text":"","code":"# facet_null is the default facetting specification if you # don't override it with facet_grid or facet_wrap ggplot(mtcars, aes(mpg, wt)) + geom_point()"},{"path":"https://animint.github.io/animint2/reference/facet_wrap.html","id":null,"dir":"Reference","previous_headings":"","what":"Wrap a 1d ribbon of panels into 2d. — facet_wrap","title":"Wrap a 1d ribbon of panels into 2d. — facet_wrap","text":"displays roughly rectangular, categorical variable many levels, make sense try display one row (one column). solve dilemma, facet_wrap wraps 1d sequence panels 2d, making best use screen real estate.","code":""},{"path":"https://animint.github.io/animint2/reference/facet_wrap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wrap a 1d ribbon of panels into 2d. — facet_wrap","text":"","code":"facet_wrap( facets, nrow = NULL, ncol = NULL, scales = \"fixed\", shrink = TRUE, labeller = \"label_value\", as.table = TRUE, switch = NULL, drop = TRUE, dir = \"h\" )"},{"path":"https://animint.github.io/animint2/reference/facet_wrap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wrap a 1d ribbon of panels into 2d. — facet_wrap","text":"facets Either formula character vector. Use either one sided formula, ~+ b, character vector, c(\"\", \"b\"). nrow, ncol Number rows columns. scales Scales fixed (\"fixed\", default), free (\"free\"), free one dimension (\"free_x\", \"free_y\"). shrink TRUE, shrink scales fit output statistics, raw data. FALSE, range raw data statistical summary. labeller function takes one data frame labels returns list data frame character vectors. input column corresponds one factor. Thus one formulae type ~cyl + . output column gets displayed one separate line strip label. function inherit \"labeller\" S3 class compatibility labeller(). See label_value details pointers options. .table TRUE, default, facets laid like table highest values bottom-right. FALSE, facets laid like plot highest value top-right. switch default, labels displayed top plot. switch \"x\", displayed bottom. \"y\", displayed left, near y axis. drop TRUE, default, factor levels used data automatically dropped. FALSE, factor levels shown, regardless whether appear data. dir Direction: either \"h\" horizontal, default, \"v\", vertical.","code":""},{"path":"https://animint.github.io/animint2/reference/facet_wrap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wrap a 1d ribbon of panels into 2d. — facet_wrap","text":"","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~class) # Control the number of rows and columns with nrow and ncol ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~class, nrow = 4) # \\donttest{ # You can facet by multiple variables ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~ cyl + drv) # Or use a character vector: ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(c(\"cyl\", \"drv\")) # Use the `labeller` option to control how labels are printed: ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(c(\"cyl\", \"drv\"), labeller = \"label_both\") # To change the order in which the panels appear, change the levels # of the underlying factor. mpg$class2 <- reorder(mpg$class, mpg$displ) ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~class2) # By default, the same scales are used for all panels. You can allow # scales to vary across the panels with the `scales` argument. # Free scales make it easier to see patterns within each panel, but # harder to compare across panels. ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~class, scales = \"free\") # To repeat the same data in every panel, simply construct a data frame # that does not contain the facetting variable. ggplot(mpg, aes(displ, hwy)) + geom_point(data = transform(mpg, class = NULL), colour = \"grey85\") + geom_point() + facet_wrap(~class) # Use `switch` to display the facet labels near an axis, acting as # a subtitle for this axis. This is typically used with free scales # and a theme without boxes around strip labels. ggplot(economics_long, aes(date, value)) + geom_line() + facet_wrap(~variable, scales = \"free_y\", nrow = 2, switch = \"x\") + theme(strip.background = element_blank()) # }"},{"path":"https://animint.github.io/animint2/reference/faithfuld.html","id":null,"dir":"Reference","previous_headings":"","what":"2d density estimate of Old Faithful data — faithfuld","title":"2d density estimate of Old Faithful data — faithfuld","text":"2d density estimate waiting eruptions variables data faithful.","code":""},{"path":"https://animint.github.io/animint2/reference/faithfuld.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"2d density estimate of Old Faithful data — faithfuld","text":"","code":"faithfuld"},{"path":"https://animint.github.io/animint2/reference/faithfuld.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"2d density estimate of Old Faithful data — faithfuld","text":"data frame 5,625 observations 3 variables.","code":""},{"path":"https://animint.github.io/animint2/reference/FluView.html","id":null,"dir":"Reference","previous_headings":"","what":"FluView — FluView","title":"FluView — FluView","text":"Data Flu outbreaks.","code":""},{"path":"https://animint.github.io/animint2/reference/FluView.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"FluView — FluView","text":"","code":"data(\"FluView\")"},{"path":"https://animint.github.io/animint2/reference/FluView.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"FluView — FluView","text":"format named list two data.frames.","code":""},{"path":"https://animint.github.io/animint2/reference/format.gganimintproto.html","id":null,"dir":"Reference","previous_headings":"","what":"Format a gganimintproto object — format.gganimintproto","title":"Format a gganimintproto object — format.gganimintproto","text":"Format gganimintproto object","code":""},{"path":"https://animint.github.io/animint2/reference/format.gganimintproto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format a gganimintproto object — format.gganimintproto","text":"","code":"# S3 method for gganimintproto format(x, ..., flat = TRUE)"},{"path":"https://animint.github.io/animint2/reference/format.gganimintproto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format a gganimintproto object — format.gganimintproto","text":"x gganimintproto object print. ... gganimintproto object print method, arguments passed . Otherwise, arguments unused. flat TRUE (default), show flattened list local inherited members. FALSE, show inheritance hierarchy.","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.html","id":null,"dir":"Reference","previous_headings":"","what":"Fortify a model with data. — fortify","title":"Fortify a model with data. — fortify","text":"Rather using function, now recomend using broom package, implements much wider range methods. fortify may deprecated future.","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fortify a model with data. — fortify","text":"","code":"fortify(model, data, ...)"},{"path":"https://animint.github.io/animint2/reference/fortify.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fortify a model with data. — fortify","text":"model model R object convert data frame data original dataset, needed ... arguments passed methods","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/fortify.lm.html","id":null,"dir":"Reference","previous_headings":"","what":"Supplement the data fitted to a linear model with model fit statistics. — fortify.lm","title":"Supplement the data fitted to a linear model with model fit statistics. — fortify.lm","text":"missing values model data, may need refit model na.action = na.exclude.","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.lm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Supplement the data fitted to a linear model with model fit statistics. — fortify.lm","text":"","code":"# S3 method for lm fortify(model, data = model$model, ...)"},{"path":"https://animint.github.io/animint2/reference/fortify.lm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Supplement the data fitted to a linear model with model fit statistics. — fortify.lm","text":"model linear model data data set, defaults data used fit model ... used method","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.lm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Supplement the data fitted to a linear model with model fit statistics. — fortify.lm","text":"original data extra columns: .hat Diagonal hat matrix .sigma Estimate residual standard deviation corresponding observation dropped model .cooksd Cooks distance, cooks.distance .fitted Fitted values model .resid Residuals .stdresid Standardised residuals","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.lm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Supplement the data fitted to a linear model with model fit statistics. — fortify.lm","text":"","code":"mod <- lm(mpg ~ wt, data = mtcars) head(fortify(mod)) #> mpg wt .hat .sigma .cooksd .fitted #> Mazda RX4 21.0 2.620 0.04326896 3.067494 1.327407e-02 23.28261 #> Mazda RX4 Wag 21.0 2.875 0.03519677 3.093068 1.723963e-03 21.91977 #> Datsun 710 22.8 2.320 0.05837573 3.072127 1.543937e-02 24.88595 #> Hornet 4 Drive 21.4 3.215 0.03125017 3.088268 3.020558e-03 20.10265 #> Hornet Sportabout 18.7 3.440 0.03292182 3.097722 7.599578e-05 18.90014 #> Valiant 18.1 3.460 0.03323551 3.095184 9.210650e-04 18.79325 #> .resid .stdresid #> Mazda RX4 -2.2826106 -0.76616765 #> Mazda RX4 Wag -0.9197704 -0.30743051 #> Datsun 710 -2.0859521 -0.70575249 #> Hornet 4 Drive 1.2973499 0.43275114 #> Hornet Sportabout -0.2001440 -0.06681879 #> Valiant -0.6932545 -0.23148309 head(fortify(mod, mtcars)) #> mpg cyl disp hp drat wt qsec vs am gear carb .hat #> Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 0.04326896 #> Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 0.03519677 #> Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 0.05837573 #> Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 0.03125017 #> Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 0.03292182 #> Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1 0.03323551 #> .sigma .cooksd .fitted .resid .stdresid #> Mazda RX4 3.067494 1.327407e-02 23.28261 -2.2826106 -0.76616765 #> Mazda RX4 Wag 3.093068 1.723963e-03 21.91977 -0.9197704 -0.30743051 #> Datsun 710 3.072127 1.543937e-02 24.88595 -2.0859521 -0.70575249 #> Hornet 4 Drive 3.088268 3.020558e-03 20.10265 1.2973499 0.43275114 #> Hornet Sportabout 3.097722 7.599578e-05 18.90014 -0.2001440 -0.06681879 #> Valiant 3.095184 9.210650e-04 18.79325 -0.6932545 -0.23148309 plot(mod, which = 1) ggplot(mod, aes(.fitted, .resid)) + geom_point() + geom_hline(yintercept = 0) + geom_smooth(se = FALSE) ggplot(mod, aes(.fitted, .stdresid)) + geom_point() + geom_hline(yintercept = 0) + geom_smooth(se = FALSE) ggplot(fortify(mod, mtcars), aes(.fitted, .stdresid)) + geom_point(aes(colour = factor(cyl))) ggplot(fortify(mod, mtcars), aes(mpg, .stdresid)) + geom_point(aes(colour = factor(cyl))) plot(mod, which = 2) ggplot(mod) + stat_qq(aes(sample = .stdresid)) + geom_abline() plot(mod, which = 3) ggplot(mod, aes(.fitted, sqrt(abs(.stdresid)))) + geom_point() + geom_smooth(se = FALSE) plot(mod, which = 4) ggplot(mod, aes(seq_along(.cooksd), .cooksd)) + geom_bar(stat = \"identity\") plot(mod, which = 5) ggplot(mod, aes(.hat, .stdresid)) + geom_vline(size = 2, colour = \"white\", xintercept = 0) + geom_hline(size = 2, colour = \"white\", yintercept = 0) + geom_point() + geom_smooth(se = FALSE) ggplot(mod, aes(.hat, .stdresid)) + geom_point(aes(size = .cooksd)) + geom_smooth(se = FALSE, size = 0.5) plot(mod, which = 6) ggplot(mod, aes(.hat, .cooksd)) + geom_vline(xintercept = 0, colour = NA) + geom_abline(slope = seq(0, 3, by = 0.5), colour = \"white\") + geom_smooth(se = FALSE) + geom_point() ggplot(mod, aes(.hat, .cooksd)) + geom_point(aes(size = .cooksd / .hat)) + scale_size_area()"},{"path":"https://animint.github.io/animint2/reference/fortify.map.html","id":null,"dir":"Reference","previous_headings":"","what":"Fortify method for map objects. — fortify.map","title":"Fortify method for map objects. — fortify.map","text":"function turns map data frame can easily plotted ggplot2.","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.map.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fortify method for map objects. — fortify.map","text":"","code":"# S3 method for map fortify(model, data, ...)"},{"path":"https://animint.github.io/animint2/reference/fortify.map.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fortify method for map objects. — fortify.map","text":"model map object data used method ... used method","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/fortify.map.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fortify method for map objects. — fortify.map","text":"","code":"if (require(\"maps\")) { ca <- map(\"county\", \"ca\", plot = FALSE, fill = TRUE) head(fortify(ca)) ggplot(ca, aes(long, lat)) + geom_polygon(aes(group = group)) tx <- map(\"county\", \"texas\", plot = FALSE, fill = TRUE) head(fortify(tx)) ggplot(tx, aes(long, lat)) + geom_polygon(aes(group = group), colour = \"white\") }"},{"path":"https://animint.github.io/animint2/reference/fortify.sp.html","id":null,"dir":"Reference","previous_headings":"","what":"Fortify method for classes from the sp package. — fortify.sp","title":"Fortify method for classes from the sp package. — fortify.sp","text":"figure correct variable name region, inspect .data.frame(model).","code":""},{"path":"https://animint.github.io/animint2/reference/fortify.sp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fortify method for classes from the sp package. — fortify.sp","text":"","code":"# S3 method for SpatialPolygonsDataFrame fortify(model, data, ...) # S3 method for SpatialPolygons fortify(model, data, ...) # S3 method for Polygons fortify(model, data, ...) # S3 method for Polygon fortify(model, data, ...) # S3 method for SpatialLinesDataFrame fortify(model, data, ...) # S3 method for Lines fortify(model, data, ...) # S3 method for Line fortify(model, data, ...)"},{"path":"https://animint.github.io/animint2/reference/fortify.sp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fortify method for classes from the sp package. — fortify.sp","text":"model SpatialPolygonsDataFrame convert dataframe. data used method ... used method","code":""},{"path":"https://animint.github.io/animint2/reference/FunctionalPruning.html","id":null,"dir":"Reference","previous_headings":"","what":"Functional Pruning Algorithm — FunctionalPruning","title":"Functional Pruning Algorithm — FunctionalPruning","text":"Output algorithm optimal change-point detection.","code":""},{"path":"https://animint.github.io/animint2/reference/FunctionalPruning.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Functional Pruning Algorithm — FunctionalPruning","text":"","code":"data(\"FunctionalPruning\")"},{"path":"https://animint.github.io/animint2/reference/FunctionalPruning.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Functional Pruning Algorithm — FunctionalPruning","text":"named list 4 data.frames","code":""},{"path":"https://animint.github.io/animint2/reference/FunctionalPruning.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Functional Pruning Algorithm — FunctionalPruning","text":"https://github.com/tdhock/PeakSegFPOP-paper/blob/master/figure-constrained-PDPA-normal-real.R","code":""},{"path":"https://animint.github.io/animint2/reference/generation.loci.html","id":null,"dir":"Reference","previous_headings":"","what":"Evolution simulation — generation.loci","title":"Evolution simulation — generation.loci","text":"Allele frequencies 100 loci 12 populations simulated 100 generations.","code":""},{"path":"https://animint.github.io/animint2/reference/generation.loci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evolution simulation — generation.loci","text":"","code":"data(generation.loci)"},{"path":"https://animint.github.io/animint2/reference/generation.loci.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Evolution simulation — generation.loci","text":"data frame 120000 observations following 4 variables. locus numeric vector population numeric vector generation numeric vector frequency numeric vector color factor: blue, red, neutral type factor: balancing, none, positive","code":""},{"path":"https://animint.github.io/animint2/reference/generation.loci.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Evolution simulation — generation.loci","text":"Data generated using nicholsonppp::sim.drift.selection, see code etc/generation.loci.R.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_abline.html","id":null,"dir":"Reference","previous_headings":"","what":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","title":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","text":"paired geoms stats add straight lines plot, either horizontal, vertical specified slope intercept. useful annotating plots.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_abline.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","text":"","code":"geom_abline( mapping = NULL, data = NULL, ..., slope, intercept, na.rm = FALSE, show.legend = NA ) geom_hline( mapping = NULL, data = NULL, ..., yintercept, na.rm = FALSE, show.legend = NA ) geom_vline( mapping = NULL, data = NULL, ..., xintercept, na.rm = FALSE, show.legend = NA )"},{"path":"https://animint.github.io/animint2/reference/geom_abline.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. xintercept, yintercept, slope, intercept Parameters control position line. set, data, mapping show.legend overridden","code":""},{"path":"https://animint.github.io/animint2/reference/geom_abline.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","text":"geoms act slightly different geoms. can supply parameters two ways: either arguments layer function, via aesthetics. use arguments, e.g. geom_abline(intercept = 0, slope = 1), behind scenes geom makes new data frame containing just data supplied. means lines facets; want vary across facets, construct data frame use aesthetics. Unlike geoms, geoms inherit aesthetics plot default, understand x y aesthetics commonly set plot. also affect x y scales.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_abline.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","text":"geoms drawn using geom_line support aesthetics: alpha, colour, linetype size. also aesthetics control position line: geom_vline: xintercept geom_hline: yintercept geom_abline: slope intercept","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_abline.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Lines: horizontal, vertical, and specified by slope and intercept. — geom_abline","text":"","code":"p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() # Fixed values p + geom_vline(xintercept = 5) p + geom_vline(xintercept = 1:5) p + geom_hline(yintercept = 20) p + geom_abline() # Can't see it - outside the range of the data p + geom_abline(intercept = 20) # Calculate slope and intercept of line of best fit coef(lm(mpg ~ wt, data = mtcars)) #> (Intercept) wt #> 37.285126 -5.344472 p + geom_abline(intercept = 37, slope = -5) # But this is easier to do with geom_smooth: p + geom_smooth(method = \"lm\", se = FALSE) # To show different lines in different facets, use aesthetics p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_wrap(~ cyl) mean_wt <- data.frame(cyl = c(4, 6, 8), wt = c(2.28, 3.11, 4.00)) p + geom_hline(aes(yintercept = wt), mean_wt) # You can also control other aesthetics ggplot(mtcars, aes(mpg, wt, colour = wt)) + geom_point() + geom_hline(aes(yintercept = wt, colour = wt), mean_wt) + facet_wrap(~ cyl)"},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":null,"dir":"Reference","previous_headings":"","what":"Bars, rectangles with bases on x-axis — geom_bar","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"two types bar charts, determined mapped bar height. default, geom_bar uses stat=\"count\" makes height bar proportion number cases group (weight aethetic supplied, sum weights). want heights bars represent values data, use stat=\"identity\" map variable y aesthetic.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"","code":"geom_bar( mapping = NULL, data = NULL, stat = \"count\", position = \"stack\", ..., width = NULL, binwidth = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_count( mapping = NULL, data = NULL, geom = \"bar\", position = \"stack\", ..., width = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. width Bar width. default, set 90% resolution data. binwidth geom_bar longer binwidth argument - use get warning telling use geom_histogram instead. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Override default connection geom_bar stat_count.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"bar chart maps height bar variable, base bar must always shown produce valid visual comparison. make sense use log-scaled y axis bar chart. default, multiple x's occurring place stacked atop one another position_stack. want dodged side--side, see position_dodge. Finally, position_fill shows relative proportions x stacking bars stretching squashing height.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"geom_bar understands following aesthetics (required aesthetics bold): x alpha colour fill linetype size","code":""},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"count number points bin prop groupwise proportion","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_bar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bars, rectangles with bases on x-axis — geom_bar","text":"","code":"# geom_bar is designed to make it easy to create bar charts that show # counts (or sums of weights) g <- ggplot(mpg, aes(class)) # Number of cars in each class: g + geom_bar() # Total engine displacement of each class g + geom_bar(aes(weight = displ)) # To show (e.g.) means, you need stat = \"identity\" df <- data.frame(trt = c(\"a\", \"b\", \"c\"), outcome = c(2.3, 1.9, 3.2)) ggplot(df, aes(trt, outcome)) + geom_bar(stat = \"identity\") # But geom_point() display exactly the same information and doesn't # require the y-axis to touch zero. ggplot(df, aes(trt, outcome)) + geom_point() # You can also use geom_bar() with continuous data, in which case # it will show counts at unique locations df <- data.frame(x = rep(c(2.9, 3.1, 4.5), c(5, 10, 4))) ggplot(df, aes(x)) + geom_bar() # cf. a histogram of the same data ggplot(df, aes(x)) + geom_histogram(binwidth = 0.5) # \\donttest{ # Bar charts are automatically stacked when multiple bars are placed # at the same location g + geom_bar(aes(fill = drv)) # You can instead dodge, or fill them g + geom_bar(aes(fill = drv), position = \"dodge\") g + geom_bar(aes(fill = drv), position = \"fill\") # To change plot order of bars, change levels in underlying factor reorder_size <- function(x) { factor(x, levels = names(sort(table(x)))) } ggplot(mpg, aes(reorder_size(class))) + geom_bar() # }"},{"path":"https://animint.github.io/animint2/reference/geom_bin2d.html","id":null,"dir":"Reference","previous_headings":"","what":"Add heatmap of 2d bin counts. — geom_bin2d","title":"Add heatmap of 2d bin counts. — geom_bin2d","text":"Add heatmap 2d bin counts.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_bin2d.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add heatmap of 2d bin counts. — geom_bin2d","text":"","code":"geom_bin2d( mapping = NULL, data = NULL, stat = \"bin2d\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_bin_2d( mapping = NULL, data = NULL, geom = \"tile\", position = \"identity\", ..., bins = 30, binwidth = NULL, drop = TRUE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_bin2d.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add heatmap of 2d bin counts. — geom_bin2d","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Use override default connection geom_bin2d stat_bin2d. bins numeric vector giving number bins vertical horizontal directions. Set 30 default. binwidth Numeric vector giving bin width vertical horizontal directions. Overrides bins set. drop TRUE removes cells 0 counts.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_bin2d.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Add heatmap of 2d bin counts. — geom_bin2d","text":"stat_bin2d understands following aesthetics (required aesthetics bold): x y fill","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_bin2d.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add heatmap of 2d bin counts. — geom_bin2d","text":"","code":"d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10) d + geom_bin2d() #> Warning: Removed 478 rows containing non-finite values (stat_bin2d). # You can control the size of the bins by specifying the number of # bins in each direction: d + geom_bin2d(bins = 10) #> Warning: Removed 478 rows containing non-finite values (stat_bin2d). #> Warning: Removed 4 rows containing missing values (geom_bin2d). d + geom_bin2d(bins = 30) #> Warning: Removed 478 rows containing non-finite values (stat_bin2d). # Or by specifying the width of the bins d + geom_bin2d(binwidth = c(0.1, 0.1)) #> Warning: Removed 478 rows containing non-finite values (stat_bin2d)."},{"path":"https://animint.github.io/animint2/reference/geom_blank.html","id":null,"dir":"Reference","previous_headings":"","what":"Blank, draws nothing. — geom_blank","title":"Blank, draws nothing. — geom_blank","text":"blank geom draws nothing, can useful way ensuring common scales different plots.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_blank.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Blank, draws nothing. — geom_blank","text":"","code":"geom_blank( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_blank.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Blank, draws nothing. — geom_blank","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_blank.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Blank, draws nothing. — geom_blank","text":"","code":"ggplot(mtcars, aes(wt, mpg)) # Nothing to see here!"},{"path":"https://animint.github.io/animint2/reference/geom_contour.html","id":null,"dir":"Reference","previous_headings":"","what":"Display contours of a 3d surface in 2d. — geom_contour","title":"Display contours of a 3d surface in 2d. — geom_contour","text":"Display contours 3d surface 2d.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_contour.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Display contours of a 3d surface in 2d. — geom_contour","text":"","code":"geom_contour( mapping = NULL, data = NULL, stat = \"contour\", position = \"identity\", ..., lineend = \"butt\", linejoin = \"round\", linemitre = 1, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_contour( mapping = NULL, data = NULL, geom = \"contour\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_contour.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Display contours of a 3d surface in 2d. — geom_contour","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. lineend Line end style (round, butt, square) linejoin Line join style (round, mitre, bevel) linemitre Line mitre limit (number greater 1) na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom geometric object use display data","code":""},{"path":"https://animint.github.io/animint2/reference/geom_contour.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Display contours of a 3d surface in 2d. — geom_contour","text":"geom_contour understands following aesthetics (required aesthetics bold): x y alpha colour linetype size weight","code":""},{"path":"https://animint.github.io/animint2/reference/geom_contour.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Display contours of a 3d surface in 2d. — geom_contour","text":"level height contour","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_contour.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Display contours of a 3d surface in 2d. — geom_contour","text":"","code":"#' # Basic plot v <- ggplot(faithfuld, aes(waiting, eruptions, z = density)) v + geom_contour() # Or compute from raw data ggplot(faithful, aes(waiting, eruptions)) + geom_density_2d() # \\donttest{ # Setting bins creates evenly spaced contours in the range of the data v + geom_contour(bins = 2) v + geom_contour(bins = 10) # Setting binwidth does the same thing, parameterised by the distance # between contours v + geom_contour(binwidth = 0.01) v + geom_contour(binwidth = 0.001) # Other parameters v + geom_contour(aes(colour = ..level..)) v + geom_contour(colour = \"red\") v + geom_raster(aes(fill = density)) + geom_contour(colour = \"white\") # }"},{"path":"https://animint.github.io/animint2/reference/geom_count.html","id":null,"dir":"Reference","previous_headings":"","what":"Count the number of observations at each location. — geom_count","title":"Count the number of observations at each location. — geom_count","text":"variant geom_point counts number observations location, maps count point size. useful discrete data.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_count.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Count the number of observations at each location. — geom_count","text":"","code":"geom_count( mapping = NULL, data = NULL, stat = \"sum\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_sum( mapping = NULL, data = NULL, geom = \"point\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_count.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Count the number of observations at each location. — geom_count","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Use override default connection geom_count stat_sum.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_count.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Count the number of observations at each location. — geom_count","text":"geom_point understands following aesthetics (required aesthetics bold): x y alpha colour fill shape size stroke","code":""},{"path":"https://animint.github.io/animint2/reference/geom_count.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Count the number of observations at each location. — geom_count","text":"n number observations position prop percent points panel position","code":""},{"path":"https://animint.github.io/animint2/reference/geom_count.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Count the number of observations at each location. — geom_count","text":"","code":"ggplot(mpg, aes(cty, hwy)) + geom_point() ggplot(mpg, aes(cty, hwy)) + geom_count() # Best used in conjunction with scale_size_area which ensures that # counts of zero would be given size 0. Doesn't make much different # here because the smallest count is already close to 0. ggplot(mpg, aes(cty, hwy)) + geom_count() scale_size_area() #> #> Range: #> Limits: 0 -- 1 # Display proportions instead of counts ------------------------------------- # By default, all categorical variables in the plot form the groups. # Specifying geom_count without a group identifier leads to a plot which is # not useful: d <- ggplot(diamonds, aes(x = cut, y = clarity)) d + geom_count(aes(size = ..prop..)) # To correct this problem and achieve a more desirable plot, we need # to specify which group the proportion is to be calculated over. d + geom_count(aes(size = ..prop.., group = 1)) + scale_size_area(max_size = 10) # Or group by x/y variables to have rows/columns sum to 1. d + geom_count(aes(size = ..prop.., group = cut)) + scale_size_area(max_size = 10) d + geom_count(aes(size = ..prop.., group = clarity)) + scale_size_area(max_size = 10)"},{"path":"https://animint.github.io/animint2/reference/geom_density.html","id":null,"dir":"Reference","previous_headings":"","what":"Display a smooth density estimate. — geom_density","title":"Display a smooth density estimate. — geom_density","text":"kernel density estimate, useful display distribution variables underlying smoothness.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_density.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Display a smooth density estimate. — geom_density","text":"","code":"geom_density( mapping = NULL, data = NULL, stat = \"density\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_density( mapping = NULL, data = NULL, geom = \"area\", position = \"stack\", ..., bw = \"nrd0\", adjust = 1, kernel = \"gaussian\", trim = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_density.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Display a smooth density estimate. — geom_density","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Use override default connection geom_density stat_density. bw smoothing bandwidth used, see density details adjust adjustment bandwidth, see density details kernel kernel used density estimation, see density details trim parameter matters displaying multiple densities one plot. FALSE, default, density computed full range data. TRUE, density computed range group: typically means estimated x values line-, hence able stack density values.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_density.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Display a smooth density estimate. — geom_density","text":"geom_density understands following aesthetics (required aesthetics bold): x y alpha colour fill linetype size weight","code":""},{"path":"https://animint.github.io/animint2/reference/geom_density.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Display a smooth density estimate. — geom_density","text":"density density estimate count density * number points - useful stacked density plots scaled density estimate, scaled maximum 1","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_density.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Display a smooth density estimate. — geom_density","text":"","code":"ggplot(diamonds, aes(carat)) + geom_density() ggplot(diamonds, aes(carat)) + geom_density(adjust = 1/5) ggplot(diamonds, aes(carat)) + geom_density(adjust = 5) ggplot(diamonds, aes(depth, colour = cut)) + geom_density() + xlim(55, 70) #> Warning: Removed 45 rows containing non-finite values (stat_density). ggplot(diamonds, aes(depth, fill = cut, colour = cut)) + geom_density(alpha = 0.1) + xlim(55, 70) #> Warning: Removed 45 rows containing non-finite values (stat_density). # \\donttest{ # Stacked density plots: if you want to create a stacked density plot, you # probably want to 'count' (density * n) variable instead of the default # density # Loses marginal densities ggplot(diamonds, aes(carat, fill = cut)) + geom_density(position = \"stack\") # Preserves marginal densities ggplot(diamonds, aes(carat, ..count.., fill = cut)) + geom_density(position = \"stack\") # You can use position=\"fill\" to produce a conditional density estimate ggplot(diamonds, aes(carat, ..count.., fill = cut)) + geom_density(position = \"fill\") # }"},{"path":"https://animint.github.io/animint2/reference/geom_density_2d.html","id":null,"dir":"Reference","previous_headings":"","what":"Contours from a 2d density estimate. — geom_density_2d","title":"Contours from a 2d density estimate. — geom_density_2d","text":"Perform 2D kernel density estimation using kde2d display results contours. can useful dealing overplotting.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_density_2d.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Contours from a 2d density estimate. — geom_density_2d","text":"","code":"geom_density_2d( mapping = NULL, data = NULL, stat = \"density2d\", position = \"identity\", ..., lineend = \"butt\", linejoin = \"round\", linemitre = 1, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_density_2d( mapping = NULL, data = NULL, geom = \"density_2d\", position = \"identity\", ..., contour = TRUE, n = 100, h = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_density_2d.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Contours from a 2d density estimate. — geom_density_2d","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. lineend Line end style (round, butt, square) linejoin Line join style (round, mitre, bevel) linemitre Line mitre limit (number greater 1) na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Use override default connection geom_density_2d stat_density_2d. contour TRUE, contour results 2d density estimation n number grid points direction h Bandwidth (vector length two). NULL, estimated using bandwidth.nrd.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_density_2d.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Contours from a 2d density estimate. — geom_density_2d","text":"geom_density_2d understands following aesthetics (required aesthetics bold): x y alpha colour linetype size","code":""},{"path":"https://animint.github.io/animint2/reference/geom_density_2d.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Contours from a 2d density estimate. — geom_density_2d","text":"stat_contour","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_density_2d.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Contours from a 2d density estimate. — geom_density_2d","text":"","code":"m <- ggplot(faithful, aes(x = eruptions, y = waiting)) + geom_point() + xlim(0.5, 6) + ylim(40, 110) m + geom_density_2d() # \\donttest{ m + stat_density_2d(aes(fill = ..level..), geom = \"polygon\") #> Warning: NAs introduced by coercion set.seed(4393) dsmall <- diamonds[sample(nrow(diamonds), 1000), ] d <- ggplot(dsmall, aes(x, y)) # If you map an aesthetic to a categorical variable, you will get a # set of contours for each value of that variable d + geom_density_2d(aes(colour = cut)) # If we turn contouring off, we can use use geoms like tiles: d + stat_density_2d(geom = \"raster\", aes(fill = ..density..), contour = FALSE) # Or points: d + stat_density_2d(geom = \"point\", aes(size = ..density..), n = 20, contour = FALSE) # }"},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Dot plot — geom_dotplot","title":"Dot plot — geom_dotplot","text":"dot plot, width dot corresponds bin width (maximum width, depending binning algorithm), dots stacked, dot representing one observation.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Dot plot — geom_dotplot","text":"","code":"geom_dotplot( mapping = NULL, data = NULL, position = \"identity\", ..., binwidth = NULL, binaxis = \"x\", method = \"dotdensity\", binpositions = \"bygroup\", stackdir = \"up\", stackratio = 1, dotsize = 1, stackgroups = FALSE, origin = NULL, right = TRUE, width = 0.9, drop = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Dot plot — geom_dotplot","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. binwidth method \"dotdensity\", specifies maximum bin width. method \"histodot\", specifies bin width. Defaults 1/30 range data binaxis axis bin along, \"x\" (default) \"y\" method \"dotdensity\" (default) dot-density binning, \"histodot\" fixed bin widths (like stat_bin) binpositions method \"dotdensity\", \"bygroup\" (default) determines positions bins group separately. \"\" determines positions bins data taken together; used aligning dot stacks across multiple groups. stackdir direction stack dots. \"\" (default), \"\", \"center\", \"centerwhole\" (centered, dots aligned) stackratio close stack dots. Default 1, dots just just touch. Use smaller values closer, overlapping dots. dotsize diameter dots relative binwidth, default 1. stackgroups dots stacked across groups? effect position = \"stack\" , (geom odd properties). origin method \"histodot\", origin first bin right method \"histodot\", intervals closed right (, b], [, b) width binaxis \"y\", spacing dot stacks dodging. drop TRUE, remove bins zero counts na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Dot plot — geom_dotplot","text":"dot-density binning, bin positions determined data binwidth, maximum width bin. See Wilkinson (1999) details dot-density binning algorithm. histodot binning, bins fixed positions fixed widths, much like histogram. binning along x axis stacking along y axis, numbers y axis meaningful, due technical limitations ggplot2. can hide y axis, one examples, manually scale match number dots.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Dot plot — geom_dotplot","text":"geom_dotplot understands following aesthetics (required aesthetics bold): x y alpha colour fill","code":""},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Dot plot — geom_dotplot","text":"x center bin, binaxis \"x\" y center bin, binaxis \"x\" binwidth max width bin method \"dotdensity\"; width bin method \"histodot\" count number points bin ncount count, scaled maximum 1 density density points bin, scaled integrate 1, method \"histodot\" ndensity density, scaled maximum 1, method \"histodot\"","code":""},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Dot plot — geom_dotplot","text":"Wilkinson, L. (1999) Dot plots. American Statistician, 53(3), 276-281.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_dotplot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Dot plot — geom_dotplot","text":"","code":"ggplot(mtcars, aes(x = mpg)) + geom_dotplot() #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5) #> Warning: Unit type of dotdia should be 'npc' # Use fixed-width bins ggplot(mtcars, aes(x = mpg)) + geom_dotplot(method=\"histodot\", binwidth = 1.5) #> Warning: Unit type of dotdia should be 'npc' # Some other stacking methods ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5, stackdir = \"center\") #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5, stackdir = \"centerwhole\") #> Warning: Unit type of dotdia should be 'npc' # y axis isn't really meaningful, so hide it ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5) + scale_y_continuous(NULL, breaks = NULL) #> Warning: Unit type of dotdia should be 'npc' # Overlap dots vertically ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5, stackratio = .7) #> Warning: Unit type of dotdia should be 'npc' # Expand dot diameter ggplot(mtcars, aes(x = mpg)) + geom_dotplot(binwidth = 1.5, dotsize = 1.25) #> Warning: Unit type of dotdia should be 'npc' # \\donttest{ # Examples with stacking along y axis instead of x ggplot(mtcars, aes(x = 1, y = mpg)) + geom_dotplot(binaxis = \"y\", stackdir = \"center\") #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_dotplot(binaxis = \"y\", stackdir = \"center\") #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_dotplot(binaxis = \"y\", stackdir = \"centerwhole\") #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = factor(vs), fill = factor(cyl), y = mpg)) + geom_dotplot(binaxis = \"y\", stackdir = \"center\", position = \"dodge\") #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' # binpositions=\"all\" ensures that the bins are aligned between groups ggplot(mtcars, aes(x = factor(am), y = mpg)) + geom_dotplot(binaxis = \"y\", stackdir = \"center\", binpositions=\"all\") #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' # Stacking multiple groups, with different fill ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) + geom_dotplot(stackgroups = TRUE, binwidth = 1, binpositions = \"all\") #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = mpg, fill = factor(cyl))) + geom_dotplot(stackgroups = TRUE, binwidth = 1, method = \"histodot\") #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' ggplot(mtcars, aes(x = 1, y = mpg, fill = factor(cyl))) + geom_dotplot(binaxis = \"y\", stackgroups = TRUE, binwidth = 1, method = \"histodot\") #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' #> Warning: Unit type of dotdia should be 'npc' # }"},{"path":"https://animint.github.io/animint2/reference/geom_errorbarh.html","id":null,"dir":"Reference","previous_headings":"","what":"Horizontal error bars — geom_errorbarh","title":"Horizontal error bars — geom_errorbarh","text":"Horizontal error bars","code":""},{"path":"https://animint.github.io/animint2/reference/geom_errorbarh.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Horizontal error bars — geom_errorbarh","text":"","code":"geom_errorbarh( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_errorbarh.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Horizontal error bars — geom_errorbarh","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_errorbarh.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Horizontal error bars — geom_errorbarh","text":"geom_errorbarh understands following aesthetics (required aesthetics bold): x xmax xmin y alpha colour height linetype size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_errorbarh.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Horizontal error bars — geom_errorbarh","text":"","code":"df <- data.frame( trt = factor(c(1, 1, 2, 2)), resp = c(1, 5, 3, 4), group = factor(c(1, 2, 1, 2)), se = c(0.1, 0.3, 0.3, 0.2) ) # Define the top and bottom of the errorbars p <- ggplot(df, aes(resp, trt, colour = group)) p + geom_point() + geom_errorbarh(aes(xmax = resp + se, xmin = resp - se)) p + geom_point() + geom_errorbarh(aes(xmax = resp + se, xmin = resp - se, height = .2))"},{"path":"https://animint.github.io/animint2/reference/geom_hex.html","id":null,"dir":"Reference","previous_headings":"","what":"Hexagon binning. — geom_hex","title":"Hexagon binning. — geom_hex","text":"Hexagon binning.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_hex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hexagon binning. — geom_hex","text":"","code":"geom_hex( mapping = NULL, data = NULL, stat = \"binhex\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_bin_hex( mapping = NULL, data = NULL, geom = \"hex\", position = \"identity\", ..., bins = 30, binwidth = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_hex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hexagon binning. — geom_hex","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Override default connection geom_hex stat_binhex. bins numeric vector giving number bins vertical horizontal directions. Set 30 default. binwidth Numeric vector giving bin width vertical horizontal directions. Overrides bins set.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_hex.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Hexagon binning. — geom_hex","text":"geom_hex understands following aesthetics (required aesthetics bold): x y alpha colour fill size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_hex.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Hexagon binning. — geom_hex","text":"","code":"d <- ggplot(diamonds, aes(carat, price)) d + geom_hex() # \\donttest{ # You can control the size of the bins by specifying the number of # bins in each direction: d + geom_hex(bins = 10) d + geom_hex(bins = 30) # Or by specifying the width of the bins d + geom_hex(binwidth = c(1, 1000)) d + geom_hex(binwidth = c(.1, 500)) # }"},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":null,"dir":"Reference","previous_headings":"","what":"Histograms and frequency polygons. — geom_freqpoly","title":"Histograms and frequency polygons. — geom_freqpoly","text":"Display 1d distribution dividing bins counting number observations bin. Histograms use bars; frequency polygons use lines.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Histograms and frequency polygons. — geom_freqpoly","text":"","code":"geom_freqpoly( mapping = NULL, data = NULL, stat = \"bin\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_histogram( mapping = NULL, data = NULL, stat = \"bin\", position = \"stack\", ..., binwidth = NULL, bins = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_bin( mapping = NULL, data = NULL, geom = \"bar\", position = \"stack\", ..., binwidth = NULL, bins = NULL, center = NULL, boundary = NULL, closed = c(\"right\", \"left\"), pad = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Histograms and frequency polygons. — geom_freqpoly","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. binwidth width bins. default use bins bins cover range data. always override value, exploring multiple widths find best illustrate stories data. bin width date variable number days time; bin width time variable number seconds. bins Number bins. Overridden binwidth. Defaults 30 geom, stat Use override default connection geom_histogram/geom_freqpoly stat_bin. center center one bins. Note center range data, things shifted appropriate number widths. center integers, example, use width=1 center=0, even 0 outside range data. one center boundary may specified. boundary boundary two bins. center, things shifted boundary outside range data. example, center integers, use width = 1 boundary = 0.5, even 1 outside range data. one center boundary may specified. closed One \"right\" \"left\" indicating whether right left edges bins included bin. pad TRUE, adds empty bins either end x. ensures frequency polygons touch 0. Defaults FALSE.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Histograms and frequency polygons. — geom_freqpoly","text":"default, stat_bin uses 30 bins - good default, idea get experimenting different binwidths. may need look uncover full story behind data.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Histograms and frequency polygons. — geom_freqpoly","text":"geom_histogram uses aesthetics geom_bar; geom_freqpoly uses aesthetics geom_line.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Histograms and frequency polygons. — geom_freqpoly","text":"count number points bin density density points bin, scaled integrate 1 ncount count, scaled maximum 1 ndensity density, scaled maximum 1","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_histogram.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Histograms and frequency polygons. — geom_freqpoly","text":"","code":"ggplot(diamonds, aes(carat)) + geom_histogram() #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. ggplot(diamonds, aes(carat)) + geom_histogram(binwidth = 0.01) ggplot(diamonds, aes(carat)) + geom_histogram(bins = 200) # Rather than stacking histograms, it's easier to compare frequency # polygons ggplot(diamonds, aes(price, fill = cut)) + geom_histogram(binwidth = 500) ggplot(diamonds, aes(price, colour = cut)) + geom_freqpoly(binwidth = 500) # To make it easier to compare distributions with very different counts, # put density on the y axis instead of the default count ggplot(diamonds, aes(price, ..density.., colour = cut)) + geom_freqpoly(binwidth = 500) if (require(\"ggplot2movies\")) { # Often we don't want the height of the bar to represent the # count of observations, but the sum of some other variable. # For example, the following plot shows the number of movies # in each rating. m <- ggplot(movies, aes(rating)) m + geom_histogram(binwidth = 0.1) # If, however, we want to see the number of votes cast in each # category, we need to weight by the votes variable m + geom_histogram(aes(weight = votes), binwidth = 0.1) + ylab(\"votes\") # For transformed scales, binwidth applies to the transformed data. # The bins have constant width on the transformed scale. m + geom_histogram() + scale_x_log10() m + geom_histogram(binwidth = 0.05) + scale_x_log10() # For transformed coordinate systems, the binwidth applies to the # raw data. The bins have constant width on the original scale. # Using log scales does not work here, because the first # bar is anchored at zero, and so when transformed becomes negative # infinity. This is not a problem when transforming the scales, because # no observations have 0 ratings. m + geom_histogram(origin = 0) + coord_trans(x = \"log10\") # Use origin = 0, to make sure we don't take sqrt of negative values m + geom_histogram(origin = 0) + coord_trans(x = \"sqrt\") # You can also transform the y axis. Remember that the base of the bars # has value 0, so log transformations are not appropriate m <- ggplot(movies, aes(x = rating)) m + geom_histogram(binwidth = 0.5) + scale_y_sqrt() } rm(movies) #> Warning: object 'movies' not found"},{"path":"https://animint.github.io/animint2/reference/geom_jitter.html","id":null,"dir":"Reference","previous_headings":"","what":"Points, jittered to reduce overplotting. — geom_jitter","title":"Points, jittered to reduce overplotting. — geom_jitter","text":"jitter geom convenient default geom_point position = 'jitter'. useful way handling overplotting caused discreteness smaller datasets.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_jitter.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Points, jittered to reduce overplotting. — geom_jitter","text":"","code":"geom_jitter( mapping = NULL, data = NULL, stat = \"identity\", position = \"jitter\", ..., width = NULL, height = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_jitter.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Points, jittered to reduce overplotting. — geom_jitter","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. width, height Amount vertical horizontal jitter. jitter added positive negative directions, total spread twice value specified . omitted, defaults 40% resolution data: means jitter values occupy 80% implied bins. Categorical data aligned integers, width height 0.5 spread data possible see distinction categories. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_jitter.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Points, jittered to reduce overplotting. — geom_jitter","text":"geom_point understands following aesthetics (required aesthetics bold): x y alpha colour fill shape size stroke","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_jitter.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Points, jittered to reduce overplotting. — geom_jitter","text":"","code":"p <- ggplot(mpg, aes(cyl, hwy)) p + geom_point() p + geom_jitter() # Add aesthetic mappings p + geom_jitter(aes(colour = class)) # Use smaller width/height to emphasise categories ggplot(mpg, aes(cyl, hwy)) + geom_jitter() ggplot(mpg, aes(cyl, hwy)) + geom_jitter(width = 0.25) # Use larger width/height to completely smooth away discreteness ggplot(mpg, aes(cty, hwy)) + geom_jitter() ggplot(mpg, aes(cty, hwy)) + geom_jitter(width = 0.5, height = 0.5)"},{"path":"https://animint.github.io/animint2/reference/geom_linerange.html","id":null,"dir":"Reference","previous_headings":"","what":"Vertical intervals: lines, crossbars & errorbars. — geom_crossbar","title":"Vertical intervals: lines, crossbars & errorbars. — geom_crossbar","text":"Various ways representing vertical interval defined x, ymin ymax.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_linerange.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vertical intervals: lines, crossbars & errorbars. — geom_crossbar","text":"","code":"geom_crossbar( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., fatten = 2.5, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_errorbar( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_linerange( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_pointrange( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., fatten = 4, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_linerange.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Vertical intervals: lines, crossbars & errorbars. — geom_crossbar","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. fatten multiplicative factor used increase size middle bar geom_crossbar() middle point geom_pointrange(). na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_linerange.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Vertical intervals: lines, crossbars & errorbars. — geom_crossbar","text":"geom_linerange understands following aesthetics (required aesthetics bold): x ymax ymin alpha colour linetype size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_linerange.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Vertical intervals: lines, crossbars & errorbars. — geom_crossbar","text":"","code":"#' # Create a simple example dataset df <- data.frame( trt = factor(c(1, 1, 2, 2)), resp = c(1, 5, 3, 4), group = factor(c(1, 2, 1, 2)), upper = c(1.1, 5.3, 3.3, 4.2), lower = c(0.8, 4.6, 2.4, 3.6) ) p <- ggplot(df, aes(trt, resp, colour = group)) p + geom_linerange(aes(ymin = lower, ymax = upper)) p + geom_pointrange(aes(ymin = lower, ymax = upper)) p + geom_crossbar(aes(ymin = lower, ymax = upper), width = 0.2) p + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.2) # Draw lines connecting group means p + geom_line(aes(group = group)) + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.2) # If you want to dodge bars and errorbars, you need to manually # specify the dodge width p <- ggplot(df, aes(trt, resp, fill = group)) p + geom_bar(position = \"dodge\", stat = \"identity\") + geom_errorbar(aes(ymin = lower, ymax = upper), position = \"dodge\", width = 0.25) # Because the bars and errorbars have different widths # we need to specify how wide the objects we are dodging are dodge <- position_dodge(width=0.9) p + geom_bar(position = dodge, stat = \"identity\") + geom_errorbar(aes(ymin = lower, ymax = upper), position = dodge, width = 0.25)"},{"path":"https://animint.github.io/animint2/reference/geom_map.html","id":null,"dir":"Reference","previous_headings":"","what":"Polygons from a reference map. — geom_map","title":"Polygons from a reference map. — geom_map","text":"affect position scales.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_map.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Polygons from a reference map. — geom_map","text":"","code":"geom_map( mapping = NULL, data = NULL, stat = \"identity\", ..., map, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_map.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Polygons from a reference map. — geom_map","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. map Data frame contains map coordinates. typically created using fortify spatial object. must contain columns x long, y lat, region id. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_map.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Polygons from a reference map. — geom_map","text":"geom_map understands following aesthetics (required aesthetics bold): map_id alpha colour fill linetype size","code":""},{"path":"https://animint.github.io/animint2/reference/geom_map.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Polygons from a reference map. — geom_map","text":"","code":"# When using geom_polygon, you will typically need two data frames: # one contains the coordinates of each polygon (positions), and the # other the values associated with each polygon (values). An id # variable links the two together ids <- factor(c(\"1.1\", \"2.1\", \"1.2\", \"2.2\", \"1.3\", \"2.3\")) values <- data.frame( id = ids, value = c(3, 3.1, 3.1, 3.2, 3.15, 3.5) ) positions <- data.frame( id = rep(ids, each = 4), x = c(2, 1, 1.1, 2.2, 1, 0, 0.3, 1.1, 2.2, 1.1, 1.2, 2.5, 1.1, 0.3, 0.5, 1.2, 2.5, 1.2, 1.3, 2.7, 1.2, 0.5, 0.6, 1.3), y = c(-0.5, 0, 1, 0.5, 0, 0.5, 1.5, 1, 0.5, 1, 2.1, 1.7, 1, 1.5, 2.2, 2.1, 1.7, 2.1, 3.2, 2.8, 2.1, 2.2, 3.3, 3.2) ) ggplot(values) + geom_map(aes(map_id = id), map = positions) + expand_limits(positions) ggplot(values, aes(fill = value)) + geom_map(aes(map_id = id), map = positions) + expand_limits(positions) ggplot(values, aes(fill = value)) + geom_map(aes(map_id = id), map = positions) + expand_limits(positions) + ylim(0, 3) # Better example crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests) crimesm <- reshape2::melt(crimes, id = 1) if (require(maps)) { states_map <- map_data(\"state\") ggplot(crimes, aes(map_id = state)) + geom_map(aes(fill = Murder), map = states_map) + expand_limits(x = states_map$long, y = states_map$lat) last_plot() + coord_map() ggplot(crimesm, aes(map_id = state)) + geom_map(aes(fill = value), map = states_map) + expand_limits(x = states_map$long, y = states_map$lat) + facet_wrap( ~ variable) }"},{"path":"https://animint.github.io/animint2/reference/geom_path.html","id":null,"dir":"Reference","previous_headings":"","what":"Connect observations. — geom_path","title":"Connect observations. — geom_path","text":"geom_path() connects observations order appear data. geom_line() connects order variable x axis. geom_step() creates stairstep plot, highlighting exactly changes occur.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_path.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Connect observations. — geom_path","text":"","code":"geom_path( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., lineend = \"butt\", linejoin = \"round\", linemitre = 1, arrow = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_line( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) geom_step( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", direction = \"hv\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )"},{"path":"https://animint.github.io/animint2/reference/geom_path.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Connect observations. — geom_path","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. lineend Line end style (round, butt, square) linejoin Line join style (round, mitre, bevel) linemitre Line mitre limit (number greater 1) arrow Arrow specification, created arrow na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. direction direction stairs: 'vh' vertical horizontal, 'hv' horizontal vertical","code":""},{"path":"https://animint.github.io/animint2/reference/geom_path.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Connect observations. — geom_path","text":"geom_path understands following aesthetics (required aesthetics bold): x y alpha colour linetype size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_path.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Connect observations. — geom_path","text":"","code":"# geom_line() is suitable for time series ggplot(economics, aes(date, unemploy)) + geom_line() ggplot(economics_long, aes(date, value01, colour = variable)) + geom_line() # geom_step() is useful when you want to highlight exactly when # the y value chanes recent <- economics[economics$date > as.Date(\"2013-01-01\"), ] ggplot(recent, aes(date, unemploy)) + geom_line() ggplot(recent, aes(date, unemploy)) + geom_step() # geom_path lets you explore how two variables are related over time, # e.g. unemployment and personal savings rate m <- ggplot(economics, aes(unemploy/pop, psavert)) m + geom_path() m + geom_path(aes(colour = as.numeric(date))) # Changing parameters ---------------------------------------------- ggplot(economics, aes(date, unemploy)) + geom_line(colour = \"red\") # Use the arrow parameter to add an arrow to the line # See ?arrow for more details c <- ggplot(economics, aes(x = date, y = pop)) c + geom_line(arrow = arrow()) c + geom_line( arrow = arrow(angle = 15, ends = \"both\", type = \"closed\") ) # Control line join parameters df <- data.frame(x = 1:3, y = c(4, 1, 9)) base <- ggplot(df, aes(x, y)) base + geom_path(size = 10) base + geom_path(size = 10, lineend = \"round\") base + geom_path(size = 10, linejoin = \"mitre\", lineend = \"butt\") # NAs break the line. Use na.rm = T to suppress the warning message df <- data.frame( x = 1:5, y1 = c(1, 2, 3, 4, NA), y2 = c(NA, 2, 3, 4, 5), y3 = c(1, 2, NA, 4, 5) ) ggplot(df, aes(x, y1)) + geom_point() + geom_line() #> Warning: Removed 1 rows containing missing values (geom_point). #> Warning: Removed 1 rows containing missing values (geom_path). ggplot(df, aes(x, y2)) + geom_point() + geom_line() #> Warning: Removed 1 rows containing missing values (geom_point). #> Warning: Removed 1 rows containing missing values (geom_path). ggplot(df, aes(x, y3)) + geom_point() + geom_line() #> Warning: Removed 1 rows containing missing values (geom_point). # \\donttest{ # Setting line type vs colour/size # Line type needs to be applied to a line as a whole, so it can # not be used with colour or size that vary across a line x <- seq(0.01, .99, length.out = 100) df <- data.frame( x = rep(x, 2), y = c(qlogis(x), 2 * qlogis(x)), group = rep(c(\"a\",\"b\"), each = 100) ) p <- ggplot(df, aes(x=x, y=y, group=group)) # These work p + geom_line(linetype = 2) p + geom_line(aes(colour = group), linetype = 2) p + geom_line(aes(colour = x)) # But this doesn't should_stop(p + geom_line(aes(colour = x), linetype=2)) # }"},{"path":"https://animint.github.io/animint2/reference/geom_point.html","id":null,"dir":"Reference","previous_headings":"","what":"Points, as for a scatterplot — geom_point","title":"Points, as for a scatterplot — geom_point","text":"point geom used create scatterplots.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_point.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Points, as for a scatterplot — geom_point","text":"","code":"geom_point( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_point.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Points, as for a scatterplot — geom_point","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_point.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Points, as for a scatterplot — geom_point","text":"scatterplot useful displaying relationship two continuous variables, although can also used one continuous one categorical variable, two categorical variables. See geom_jitter possibilities. bubblechart scatterplot third variable mapped size points. special names scatterplots another variable mapped point shape colour, however. biggest potential problem scatterplot overplotting: whenever points, points may plotted top one another. can severely distort visual appearance plot. one solution problem, techniques can help. can add additional information geom_smooth geom_density_2d. Alternatively, can summarise number points location display way, using stat_sum. Another technique use transparent points, e.g. geom_point(alpha = 0.05).","code":""},{"path":"https://animint.github.io/animint2/reference/geom_point.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Points, as for a scatterplot — geom_point","text":"geom_point understands following aesthetics (required aesthetics bold): x y alpha colour fill shape size stroke","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_point.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Points, as for a scatterplot — geom_point","text":"","code":"p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point() # Add aesthetic mappings p + geom_point(aes(colour = factor(cyl))) p + geom_point(aes(shape = factor(cyl))) p + geom_point(aes(size = qsec)) # Change scales p + geom_point(aes(colour = cyl)) + scale_colour_gradient(low = \"blue\") p + geom_point(aes(shape = factor(cyl))) + scale_shape(solid = FALSE) # Set aesthetics to fixed value ggplot(mtcars, aes(wt, mpg)) + geom_point(colour = \"red\", size = 3) # \\donttest{ # Varying alpha is useful for large datasets d <- ggplot(diamonds, aes(carat, price)) d + geom_point(alpha = 1/10) d + geom_point(alpha = 1/20) d + geom_point(alpha = 1/100) # } # For shapes that have a border (like 21), you can colour the inside and # outside separately. Use the stroke aesthetic to modify the width of the # border ggplot(mtcars, aes(wt, mpg)) + geom_point(shape = 21, colour = \"black\", fill = \"white\", size = 5, stroke = 5) # \\donttest{ # You can create interesting shapes by layering multiple points of # different sizes p <- ggplot(mtcars, aes(mpg, wt, shape = factor(cyl))) p + geom_point(aes(colour = factor(cyl)), size = 4) + geom_point(colour = \"grey90\", size = 1.5) p + geom_point(colour = \"black\", size = 4.5) + geom_point(colour = \"pink\", size = 4) + geom_point(aes(shape = factor(cyl))) # These extra layers don't usually appear in the legend, but we can # force their inclusion p + geom_point(colour = \"black\", size = 4.5, show.legend = TRUE) + geom_point(colour = \"pink\", size = 4, show.legend = TRUE) + geom_point(aes(shape = factor(cyl))) # geom_point warns when missing values have been dropped from the data set # and not plotted, you can turn this off by setting na.rm = TRUE mtcars2 <- transform(mtcars, mpg = ifelse(runif(32) < 0.2, NA, mpg)) ggplot(mtcars2, aes(wt, mpg)) + geom_point() #> Warning: Removed 2 rows containing missing values (geom_point). ggplot(mtcars2, aes(wt, mpg)) + geom_point(na.rm = TRUE) # }"},{"path":"https://animint.github.io/animint2/reference/geom_polygon.html","id":null,"dir":"Reference","previous_headings":"","what":"Polygon, a filled path. — geom_polygon","title":"Polygon, a filled path. — geom_polygon","text":"Polygon, filled path.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_polygon.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Polygon, a filled path. — geom_polygon","text":"","code":"geom_polygon( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_polygon.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Polygon, a filled path. — geom_polygon","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_polygon.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Polygon, a filled path. — geom_polygon","text":"geom_polygon understands following aesthetics (required aesthetics bold): x y alpha colour fill linetype size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_polygon.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Polygon, a filled path. — geom_polygon","text":"","code":"# When using geom_polygon, you will typically need two data frames: # one contains the coordinates of each polygon (positions), and the # other the values associated with each polygon (values). An id # variable links the two together ids <- factor(c(\"1.1\", \"2.1\", \"1.2\", \"2.2\", \"1.3\", \"2.3\")) values <- data.frame( id = ids, value = c(3, 3.1, 3.1, 3.2, 3.15, 3.5) ) positions <- data.frame( id = rep(ids, each = 4), x = c(2, 1, 1.1, 2.2, 1, 0, 0.3, 1.1, 2.2, 1.1, 1.2, 2.5, 1.1, 0.3, 0.5, 1.2, 2.5, 1.2, 1.3, 2.7, 1.2, 0.5, 0.6, 1.3), y = c(-0.5, 0, 1, 0.5, 0, 0.5, 1.5, 1, 0.5, 1, 2.1, 1.7, 1, 1.5, 2.2, 2.1, 1.7, 2.1, 3.2, 2.8, 2.1, 2.2, 3.3, 3.2) ) # Currently we need to manually merge the two together datapoly <- merge(values, positions, by = c(\"id\")) (p <- ggplot(datapoly, aes(x = x, y = y)) + geom_polygon(aes(fill = value, group = id))) # Which seems like a lot of work, but then it's easy to add on # other features in this coordinate system, e.g.: stream <- data.frame( x = cumsum(runif(50, max = 0.1)), y = cumsum(runif(50,max = 0.1)) ) p + geom_line(data = stream, colour = \"grey30\", size = 5) # And if the positions are in longitude and latitude, you can use # coord_map to produce different map projections."},{"path":"https://animint.github.io/animint2/reference/geom_ribbon.html","id":null,"dir":"Reference","previous_headings":"","what":"Ribbons and area plots. — geom_ribbon","title":"Ribbons and area plots. — geom_ribbon","text":"continuous x value, geom_interval displays y interval. geom_area special case geom_ribbon, minimum range fixed 0.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_ribbon.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Ribbons and area plots. — geom_ribbon","text":"","code":"geom_ribbon( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_area( mapping = NULL, data = NULL, stat = \"identity\", position = \"stack\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )"},{"path":"https://animint.github.io/animint2/reference/geom_ribbon.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Ribbons and area plots. — geom_ribbon","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_ribbon.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Ribbons and area plots. — geom_ribbon","text":"area plot continuous analog stacked bar chart (see geom_bar), can used show composition whole varies range x. Choosing order different components stacked important, becomes increasing hard see individual pattern move stack.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_ribbon.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Ribbons and area plots. — geom_ribbon","text":"geom_ribbon understands following aesthetics (required aesthetics bold): x ymax ymin alpha colour fill linetype size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_ribbon.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Ribbons and area plots. — geom_ribbon","text":"","code":"# Generate data huron <- data.frame(year = 1875:1972, level = as.vector(LakeHuron)) h <- ggplot(huron, aes(year)) h + geom_ribbon(aes(ymin=0, ymax=level)) h + geom_area(aes(y = level)) # Add aesthetic mappings h + geom_ribbon(aes(ymin = level - 1, ymax = level + 1), fill = \"grey70\") + geom_line(aes(y = level))"},{"path":"https://animint.github.io/animint2/reference/geom_rug.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal rug plots. — geom_rug","title":"Marginal rug plots. — geom_rug","text":"Marginal rug plots.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_rug.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal rug plots. — geom_rug","text":"","code":"geom_rug( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., sides = \"bl\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_rug.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal rug plots. — geom_rug","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. sides string controls sides plot rugs appear . can set string containing \"trbl\", top, right, bottom, left. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_rug.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Marginal rug plots. — geom_rug","text":"geom_rug understands following aesthetics (required aesthetics bold): alpha colour linetype size","code":""},{"path":"https://animint.github.io/animint2/reference/geom_rug.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal rug plots. — geom_rug","text":"","code":"p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point() p + geom_point() + geom_rug() p + geom_point() + geom_rug(sides=\"b\") # Rug on bottom only p + geom_point() + geom_rug(sides=\"trbl\") # All four sides p + geom_point() + geom_rug(position='jitter')"},{"path":"https://animint.github.io/animint2/reference/geom_segment.html","id":null,"dir":"Reference","previous_headings":"","what":"Line segments and curves. — geom_segment","title":"Line segments and curves. — geom_segment","text":"geom_segment draws straight line points (x1, y1) (x2, y2). geom_curve draws curved line.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_segment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Line segments and curves. — geom_segment","text":"","code":"geom_segment( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., arrow = NULL, lineend = \"butt\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_curve( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., curvature = 0.5, angle = 90, ncp = 5, arrow = NULL, lineend = \"butt\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_segment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Line segments and curves. — geom_segment","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. arrow specification arrow heads, created arrow() lineend Line end style (round, butt, square) na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. curvature numeric value giving amount curvature. Negative values produce left-hand curves, positive values produce right-hand curves, zero produces straight line. angle numeric value 0 180, giving amount skew control points curve. Values less 90 skew curve towards start point values greater 90 skew curve towards end point. ncp number control points used draw curve. control points creates smoother curve.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_segment.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Line segments and curves. — geom_segment","text":"geom_segment understands following aesthetics (required aesthetics bold): x xend y yend alpha colour linetype size","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_segment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Line segments and curves. — geom_segment","text":"","code":"b <- ggplot(mtcars, aes(wt, mpg)) + geom_point() df <- data.frame(x1 = 2.62, x2 = 3.57, y1 = 21.0, y2 = 15.0) b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2, colour = \"curve\"), data = df) + geom_segment(aes(x = x1, y = y1, xend = x2, yend = y2, colour = \"segment\"), data = df) b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), data = df, curvature = -0.2) b + geom_curve(aes(x = x1, y = y1, xend = x2, yend = y2), data = df, curvature = 1) b + geom_curve( aes(x = x1, y = y1, xend = x2, yend = y2), data = df, arrow = arrow(length = unit(0.03, \"npc\")) ) ggplot(seals, aes(long, lat)) + geom_segment(aes(xend = long + delta_long, yend = lat + delta_lat), arrow = arrow(length = unit(0.1,\"cm\"))) + borders(\"state\") # You can also use geom_segment to recreate plot(type = \"h\") : counts <- as.data.frame(table(x = rpois(100,5))) counts$x <- as.numeric(as.character(counts$x)) with(counts, plot(x, Freq, type = \"h\", lwd = 10)) ggplot(counts, aes(x, Freq)) + geom_segment(aes(xend = x, yend = 0), size = 10, lineend = \"butt\")"},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a smoothed conditional mean. — geom_smooth","title":"Add a smoothed conditional mean. — geom_smooth","text":"Aids eye seeing patterns presence overplotting. geom_smooth stat_smooth effectively aliases: use arguments. Use geom_smooth unless want display results non-standard geom.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a smoothed conditional mean. — geom_smooth","text":"","code":"geom_smooth( mapping = NULL, data = NULL, stat = \"smooth\", position = \"identity\", ..., method = \"auto\", formula = y ~ x, se = TRUE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_smooth( mapping = NULL, data = NULL, geom = \"smooth\", position = \"identity\", ..., method = \"auto\", formula = y ~ x, se = TRUE, n = 80, span = 0.75, fullrange = FALSE, level = 0.95, method.args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a smoothed conditional mean. — geom_smooth","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. method smoothing method (function) use, eg. lm, glm, gam, loess, rlm. datasets n < 1000 default loess. datasets 1000 observations defaults gam, see gam details. formula formula use smoothing function, eg. y ~ x, y ~ poly(x, 2), y ~ log(x) se display confidence interval around smooth? (TRUE default, see level control na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Use override default connection geom_smooth stat_smooth. n number points evaluate smoother span Controls amount smoothing default loess smoother. Smaller numbers produce wigglier lines, larger numbers produce smoother lines. fullrange fit span full range plot, just data level level confidence interval use (0.95 default) method.args List additional arguments passed modelling function defined method.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a smoothed conditional mean. — geom_smooth","text":"Calculation performed (currently undocumented) predictdf generic methods. methods standard error bounds computed using predict method - exceptions loess uses t-based approximation, glm normal confidence interval constructed link scale, back-transformed response scale.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Add a smoothed conditional mean. — geom_smooth","text":"geom_smooth understands following aesthetics (required aesthetics bold): x y alpha colour fill linetype size weight","code":""},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Add a smoothed conditional mean. — geom_smooth","text":"y predicted value ymin lower pointwise confidence interval around mean ymax upper pointwise confidence interval around mean se standard error","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_smooth.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a smoothed conditional mean. — geom_smooth","text":"","code":"ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth() # Use span to control the \"wiggliness\" of the default loess smoother # The span is the fraction of points used to fit each local regression: # small numbers make a wigglier curve, larger numbers make a smoother curve. ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(span = 0.3) # Instead of a loess smooth, you can use any other modelling function: ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(method = \"lm\", se = FALSE) ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(method = \"lm\", formula = y ~ splines::bs(x, 3), se = FALSE) # Smoothes are automatically fit to each group (defined by categorical # aesthetics or the group aesthetic) and for each facet ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point() + geom_smooth(se = FALSE, method = \"lm\") ggplot(mpg, aes(displ, hwy)) + geom_point() + geom_smooth(span = 0.8) + facet_wrap(~drv) # \\donttest{ binomial_smooth <- function(...) { geom_smooth(method = \"glm\", method.args = list(family = \"binomial\"), ...) } # To fit a logistic regression, you need to coerce the values to # a numeric vector lying between 0 and 1. ggplot(rpart::kyphosis, aes(Age, Kyphosis)) + geom_jitter(height = 0.05) + binomial_smooth() #> Warning: Computation failed in `stat_smooth()`: #> y values must be 0 <= y <= 1 ggplot(rpart::kyphosis, aes(Age, as.numeric(Kyphosis) - 1)) + geom_jitter(height = 0.05) + binomial_smooth() ggplot(rpart::kyphosis, aes(Age, as.numeric(Kyphosis) - 1)) + geom_jitter(height = 0.05) + binomial_smooth(formula = y ~ splines::ns(x, 2)) # But in this case, it's probably better to fit the model yourself # so you can exercise more control and see whether or not it's a good model # }"},{"path":"https://animint.github.io/animint2/reference/geom_spoke.html","id":null,"dir":"Reference","previous_headings":"","what":"A line segment parameterised by location, direction and distance. — geom_spoke","title":"A line segment parameterised by location, direction and distance. — geom_spoke","text":"line segment parameterised location, direction distance.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_spoke.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A line segment parameterised by location, direction and distance. — geom_spoke","text":"","code":"geom_spoke( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_spoke.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A line segment parameterised by location, direction and distance. — geom_spoke","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_spoke.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"A line segment parameterised by location, direction and distance. — geom_spoke","text":"geom_spoke understands following aesthetics (required aesthetics bold): angle radius x y alpha colour linetype size","code":""},{"path":"https://animint.github.io/animint2/reference/geom_spoke.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A line segment parameterised by location, direction and distance. — geom_spoke","text":"","code":"df <- expand.grid(x = 1:10, y=1:10) df$angle <- runif(100, 0, 2*pi) df$speed <- runif(100, 0, sqrt(0.1 * df$x)) ggplot(df, aes(x, y)) + geom_point() + geom_spoke(aes(angle = angle), radius = 0.5) ggplot(df, aes(x, y)) + geom_point() + geom_spoke(aes(angle = angle, radius = speed))"},{"path":"https://animint.github.io/animint2/reference/geom_tallrect.html","id":null,"dir":"Reference","previous_headings":"","what":"ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect","title":"ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect","text":"ggplot2 geom xmin xmax aesthetics covers entire y range, useful clickSelects background elements.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_tallrect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect","text":"","code":"geom_tallrect( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_tallrect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect","text":"mapping aesthetic mapping data data set stat statistic mapping, defaults identity position position mapping, defaults identity ... arguments na.rm remove missing values? show.legend TRUE FALSE inherit.aes TRUE FALSE","code":""},{"path":"https://animint.github.io/animint2/reference/geom_tallrect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect","text":"ggplot2 layer","code":""},{"path":"https://animint.github.io/animint2/reference/geom_tallrect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements. — geom_tallrect","text":"","code":"if(require('data.table'))setDTthreads(1)#for CRAN. library(animint2) ## Example: 2 plots, 2 selectors, but only interacting with 1 plot. data(breakpoints) only.error <- subset(breakpoints$error,type==\"E\") only.segments <- subset(only.error,bases.per.probe==bases.per.probe[1]) signal.colors <- c(estimate=\"#0adb0a\", latent=\"#0098ef\") breakpointError <- list( signal=ggplot()+ geom_point(aes( position, signal), showSelected=\"bases.per.probe\", data=breakpoints$signals)+ geom_line(aes( position, signal), colour=signal.colors[[\"latent\"]], data=breakpoints$imprecision)+ geom_segment(aes( first.base, mean, xend=last.base, yend=mean), showSelected=c(\"segments\", \"bases.per.probe\"), colour=signal.colors[[\"estimate\"]], data=breakpoints$segments)+ geom_vline(aes( xintercept=base), showSelected=c(\"segments\", \"bases.per.probe\"), colour=signal.colors[[\"estimate\"]], linetype=\"dashed\", data=breakpoints$breaks), error=ggplot()+ geom_vline(aes( xintercept=segments), clickSelects=\"segments\", data=only.segments, lwd=17, alpha=1/2)+ geom_line(aes( segments, error, group=bases.per.probe), clickSelects=\"bases.per.probe\", data=only.error, lwd=4)) animint2dir(breakpointError)"},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Textual annotations. — geom_label","title":"Textual annotations. — geom_label","text":"geom_text adds text directly plot. geom_label draws rectangle underneath text, making easier read.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Textual annotations. — geom_label","text":"","code":"geom_label( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., parse = FALSE, nudge_x = 0, nudge_y = 0, label.padding = unit(0.25, \"lines\"), label.r = unit(0.15, \"lines\"), label.size = 0.25, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_text( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., parse = FALSE, nudge_x = 0, nudge_y = 0, check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Textual annotations. — geom_label","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. parse TRUE, labels parsed expressions displayed described ?plotmath nudge_x, nudge_y Horizontal vertical adjustment nudge labels . Useful offsetting text points, particularly discrete scales. label.padding Amount padding around label. Defaults 0.25 lines. label.r Radius rounded corners. Defaults 0.15 lines. label.size Size label border, mm. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. check_overlap TRUE, text overlaps previous text layer plotted. quick dirty way","code":""},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Textual annotations. — geom_label","text":"Note \"width\" \"height\" text element 0, stacking dodging text work default, axis limits automatically expanded include text. Obviously, labels height width, physical units, data units. amount space occupy plot constant data units: resize plot, labels stay size, size axes changes.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Textual annotations. — geom_label","text":"geom_text understands following aesthetics (required aesthetics bold): label x y alpha angle colour family fontface hjust lineheight size vjust","code":""},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"geom-label","dir":"Reference","previous_headings":"","what":"geom_label","title":"Textual annotations. — geom_label","text":"Currently geom_label support rot parameter considerably slower geom_text. fill aesthetic controls background colour label.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"alignment","dir":"Reference","previous_headings":"","what":"Alignment","title":"Textual annotations. — geom_label","text":"can modify text alignment vjust hjust aesthetics. can either number 0 (right/bottom) 1 (top/left) character (\"left\", \"middle\", \"right\", \"bottom\", \"center\", \"top\"). two special alignments: \"inward\" \"outward\". Inward always aligns text towards center, outward aligns away center","code":""},{"path":"https://animint.github.io/animint2/reference/geom_text.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Textual annotations. — geom_label","text":"","code":"p <- ggplot(mtcars, aes(wt, mpg, label = rownames(mtcars))) p + geom_text() # Avoid overlaps p + geom_text(check_overlap = TRUE) # Labels with background p + geom_label() # Change size of the label p + geom_text(size = 10) # Set aesthetics to fixed value p + geom_point() + geom_text(hjust = 0, nudge_x = 0.05) p + geom_point() + geom_text(vjust = 0, nudge_y = 0.5) p + geom_point() + geom_text(angle = 45) if (FALSE) { # Doesn't work on all systems p + geom_text(family = \"Times New Roman\") } # Add aesthetic mappings p + geom_text(aes(colour = factor(cyl))) p + geom_text(aes(colour = factor(cyl))) + scale_colour_discrete(l = 40) p + geom_label(aes(fill = factor(cyl)), colour = \"white\", fontface = \"bold\") p + geom_text(aes(size = wt)) # Scale height of text, rather than sqrt(height) p + geom_text(aes(size = wt)) + scale_radius(range = c(3,6)) # You can display expressions by setting parse = TRUE. The # details of the display are described in ?plotmath, but note that # geom_text uses strings, not expressions. p + geom_text(aes(label = paste(wt, \"^(\", cyl, \")\", sep = \"\")), parse = TRUE) # Add a text annotation p + geom_text() + annotate(\"text\", label = \"plot mpg vs. wt\", x = 2, y = 15, size = 8, colour = \"red\") # \\donttest{ # Aligning labels and bars -------------------------------------------------- df <- data.frame( x = factor(c(1, 1, 2, 2)), y = c(1, 3, 2, 1), grp = c(\"a\", \"b\", \"a\", \"b\") ) # ggplot2 doesn't know you want to give the labels the same virtual width # as the bars: ggplot(data = df, aes(x, y, fill = grp, label = y)) + geom_bar(stat = \"identity\", position = \"dodge\") + geom_text(position = \"dodge\") #> Warning: Width not defined. Set with `position_dodge(width = ?)` # So tell it: ggplot(data = df, aes(x, y, fill = grp, label = y)) + geom_bar(stat = \"identity\", position = \"dodge\") + geom_text(position = position_dodge(0.9)) # Use you can't nudge and dodge text, so instead adjust the y postion ggplot(data = df, aes(x, y, fill = grp, label = y)) + geom_bar(stat = \"identity\", position = \"dodge\") + geom_text(aes(y = y + 0.05), position = position_dodge(0.9), vjust = 0) # To place text in the middle of each bar in a stacked barplot, you # need to do the computation yourself df <- transform(df, mid_y = ave(df$y, df$x, FUN = function(val) cumsum(val) - (0.5 * val))) ggplot(data = df, aes(x, y, fill = grp, label = y)) + geom_bar(stat = \"identity\") + geom_text(aes(y = mid_y)) # Justification ------------------------------------------------------------- df <- data.frame( x = c(1, 1, 2, 2, 1.5), y = c(1, 2, 1, 2, 1.5), text = c(\"bottom-left\", \"bottom-right\", \"top-left\", \"top-right\", \"center\") ) ggplot(df, aes(x, y)) + geom_text(aes(label = text)) ggplot(df, aes(x, y)) + geom_text(aes(label = text), vjust = \"inward\", hjust = \"inward\") # }"},{"path":"https://animint.github.io/animint2/reference/geom_tile.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw rectangles. — geom_raster","title":"Draw rectangles. — geom_raster","text":"geom_rect geom_tile thing, parameterised differently. geom_rect uses locations four corners (xmin, xmax, ymin ymax). geom_tile uses center tile size (x, y, width, height). geom_raster high performance special case tiles size.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_tile.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw rectangles. — geom_raster","text":"","code":"geom_raster( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., hjust = 0.5, vjust = 0.5, interpolate = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_rect( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_tile( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_tile.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw rectangles. — geom_raster","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. stat statistical transformation use data layer, string. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. hjust, vjust horizontal vertical justification grob. justification value number 0 1. Defaults 0.5 , centering pixel data location. interpolate TRUE interpolate linearly, FALSE (default) interpolate. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_tile.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Draw rectangles. — geom_raster","text":"geom_tile understands following aesthetics (required aesthetics bold): x y alpha colour fill linetype size","code":""},{"path":"https://animint.github.io/animint2/reference/geom_tile.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw rectangles. — geom_raster","text":"","code":"# The most common use for rectangles is to draw a surface. You always want # to use geom_raster here because it's so much faster, and produces # smaller output when saving to PDF ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density)) # Interpolation smooths the surface & is most helpful when rendering images. ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density), interpolate = TRUE) # If you want to draw arbitrary rectangles, use geom_tile() or geom_rect() df <- data.frame( x = rep(c(2, 5, 7, 9, 12), 2), y = rep(c(1, 2), each = 5), z = factor(rep(1:5, each = 2)), w = rep(diff(c(0, 4, 6, 8, 10, 14)), 2) ) ggplot(df, aes(x, y)) + geom_tile(aes(fill = z)) ggplot(df, aes(x, y)) + geom_tile(aes(fill = z, width = w), colour = \"grey50\") ggplot(df, aes(xmin = x - w / 2, xmax = x + w / 2, ymin = y, ymax = y + 1)) + geom_rect(aes(fill = z, width = w), colour = \"grey50\") # \\donttest{ # Justification controls where the cells are anchored df <- expand.grid(x = 0:5, y = 0:5) df$z <- runif(nrow(df)) # default is compatible with geom_tile() ggplot(df, aes(x, y, fill = z)) + geom_raster() # zero padding ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) # Inspired by the image-density plots of Ken Knoblauch cars <- ggplot(mtcars, aes(mpg, factor(cyl))) cars + geom_point() cars + stat_bin2d(aes(fill = ..count..), binwidth = c(3,1)) cars + stat_bin2d(aes(fill = ..density..), binwidth = c(3,1)) cars + stat_density(aes(fill = ..density..), geom = \"raster\", position = \"identity\") cars + stat_density(aes(fill = ..count..), geom = \"raster\", position = \"identity\") # }"},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":null,"dir":"Reference","previous_headings":"","what":"Violin plot. — geom_violin","title":"Violin plot. — geom_violin","text":"Violin plot.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Violin plot. — geom_violin","text":"","code":"geom_violin( mapping = NULL, data = NULL, stat = \"ydensity\", position = \"dodge\", ..., draw_quantiles = NULL, trim = TRUE, scale = \"area\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_ydensity( mapping = NULL, data = NULL, geom = \"violin\", position = \"dodge\", ..., bw = \"nrd0\", adjust = 1, kernel = \"gaussian\", trim = TRUE, scale = \"area\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Violin plot. — geom_violin","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. draw_quantiles (NULL) (default), draw horizontal lines given quantiles density estimate. trim TRUE (default), trim tails violins range data. FALSE, trim tails. scale \"area\" (default), violins area (trimming tails). \"count\", areas scaled proportionally number observations. \"width\", violins maximum width. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. geom, stat Use override default connection geom_violin stat_ydensity. bw smoothing bandwidth used, see density details adjust adjustment bandwidth, see density details kernel kernel used density estimation, see density details","code":""},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Violin plot. — geom_violin","text":"geom_violin understands following aesthetics (required aesthetics bold): x y alpha colour fill linetype size weight","code":""},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Violin plot. — geom_violin","text":"density density estimate scaled density estimate, scaled maximum 1 count density * number points - probably useless violin plots violinwidth density scaled violin plot, according area, counts constant maximum width n number points width width violin bounding box","code":""},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Violin plot. — geom_violin","text":"Hintze, J. L., Nelson, R. D. (1998) Violin Plots: Box Plot-Density Trace Synergism. American Statistician 52, 181-184.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/geom_violin.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Violin plot. — geom_violin","text":"","code":"p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_violin() # \\donttest{ p + geom_violin() + geom_jitter(height = 0) p + geom_violin() + coord_flip() # Scale maximum width proportional to sample size: p + geom_violin(scale = \"count\") # Scale maximum width to 1 for all violins: p + geom_violin(scale = \"width\") # Default is to trim violins to the range of the data. To disable: p + geom_violin(trim = FALSE) # Use a smaller bandwidth for closer density fit (default is 1). p + geom_violin(adjust = .5) # Add aesthetic mappings # Note that violins are automatically dodged when any aesthetic is # a factor p + geom_violin(aes(fill = cyl)) p + geom_violin(aes(fill = factor(cyl))) p + geom_violin(aes(fill = factor(vs))) p + geom_violin(aes(fill = factor(am))) # Set aesthetics to fixed value p + geom_violin(fill = \"grey80\", colour = \"#3366FF\") # Show quartiles p + geom_violin(draw_quantiles = c(0.25, 0.5, 0.75)) # Scales vs. coordinate transforms ------- if (require(\"ggplot2movies\")) { # Scale transformations occur before the density statistics are computed. # Coordinate transformations occur afterwards. Observe the effect on the # number of outliers. m <- ggplot(movies, aes(y = votes, x = rating, group = cut_width(rating, 0.5))) m + geom_violin() m + geom_violin() + scale_y_log10() m + geom_violin() + coord_trans(y = \"log10\") m + geom_violin() + scale_y_log10() + coord_trans(y = \"log10\") # Violin plots with continuous x: # Use the group aesthetic to group observations in violins ggplot(movies, aes(year, budget)) + geom_violin() ggplot(movies, aes(year, budget)) + geom_violin(aes(group = cut_width(year, 10)), scale = \"width\") } #> Warning: Removed 53573 rows containing non-finite values (stat_ydensity). # }"},{"path":"https://animint.github.io/animint2/reference/geom_widerect.html","id":null,"dir":"Reference","previous_headings":"","what":"ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect","title":"ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect","text":"ggplot2 geom ymin ymax aesthetics covers entire x range, useful clickSelects background elements.","code":""},{"path":"https://animint.github.io/animint2/reference/geom_widerect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect","text":"","code":"geom_widerect( mapping = NULL, data = NULL, stat = \"identity\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/geom_widerect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect","text":"mapping aesthetic mapping data data set stat statistic mapping, defaults identity position position mapping, defaults identity ... arguments na.rm remove missing values? show.legend TRUE FALSE inherit.aes TRUE FALSE","code":""},{"path":"https://animint.github.io/animint2/reference/geom_widerect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect","text":"ggplot2 layer","code":""},{"path":"https://animint.github.io/animint2/reference/geom_widerect.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ggplot2 geom with ymin and ymax aesthetics that covers the entire x range, useful for clickSelects background elements. — geom_widerect","text":"","code":"if (FALSE) { source(system.file(\"examples/WorldBank.R\", package = \"animint\")) }"},{"path":"https://animint.github.io/animint2/reference/getCommonChunk.html","id":null,"dir":"Reference","previous_headings":"","what":"Save the common columns for each tsv to one chunk — getCommonChunk","title":"Save the common columns for each tsv to one chunk — getCommonChunk","text":"Save common columns tsv one chunk","code":""},{"path":"https://animint.github.io/animint2/reference/getCommonChunk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save the common columns for each tsv to one chunk — getCommonChunk","text":"","code":"getCommonChunk(built, chunk.vars, aes.list)"},{"path":"https://animint.github.io/animint2/reference/getCommonChunk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save the common columns for each tsv to one chunk — getCommonChunk","text":"built data.frame built data. chunk.vars variables chunk . aes.list character vector aesthetics. vars character vector chunk variable names split .","code":""},{"path":"https://animint.github.io/animint2/reference/getCommonChunk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Save the common columns for each tsv to one chunk — getCommonChunk","text":"list common varied data save, NULL common data.","code":""},{"path":"https://animint.github.io/animint2/reference/getLayerName.html","id":null,"dir":"Reference","previous_headings":"","what":"Gives a unique name to each layer in saveLayer — getLayerName","title":"Gives a unique name to each layer in saveLayer — getLayerName","text":"Gives unique name layer saveLayer","code":""},{"path":"https://animint.github.io/animint2/reference/getLayerName.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Gives a unique name to each layer in saveLayer — getLayerName","text":"","code":"getLayerName(L, geom_num, p.name)"},{"path":"https://animint.github.io/animint2/reference/getLayerName.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Gives a unique name to each layer in saveLayer — getLayerName","text":"L layer saveLayer named geom_num number layer saved p.name name plot layer belongs","code":""},{"path":"https://animint.github.io/animint2/reference/getLayerName.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Gives a unique name to each layer in saveLayer — getLayerName","text":"unique name layer","code":""},{"path":"https://animint.github.io/animint2/reference/getLayerParams.html","id":null,"dir":"Reference","previous_headings":"","what":"Get all parameters for a layer — getLayerParams","title":"Get all parameters for a layer — getLayerParams","text":"Get parameters layer","code":""},{"path":"https://animint.github.io/animint2/reference/getLayerParams.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get all parameters for a layer — getLayerParams","text":"","code":"getLayerParams(l)"},{"path":"https://animint.github.io/animint2/reference/getLayerParams.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get all parameters for a layer — getLayerParams","text":"l single layer plot","code":""},{"path":"https://animint.github.io/animint2/reference/getLayerParams.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get all parameters for a layer — getLayerParams","text":"parameters layer","code":""},{"path":"https://animint.github.io/animint2/reference/getLegend.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to get legend information for each scale — getLegend","title":"Function to get legend information for each scale — getLegend","text":"Function get legend information scale","code":""},{"path":"https://animint.github.io/animint2/reference/getLegend.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to get legend information for each scale — getLegend","text":"","code":"getLegend(mb)"},{"path":"https://animint.github.io/animint2/reference/getLegend.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to get legend information for each scale — getLegend","text":"mb single entry guides_merge() list legend data","code":""},{"path":"https://animint.github.io/animint2/reference/getLegend.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to get legend information for each scale — getLegend","text":"list legend information, NULL guide=FALSE.","code":""},{"path":"https://animint.github.io/animint2/reference/getLegendList.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to get legend information from ggplot — getLegendList","title":"Function to get legend information from ggplot — getLegendList","text":"Function get legend information ggplot","code":""},{"path":"https://animint.github.io/animint2/reference/getLegendList.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to get legend information from ggplot — getLegendList","text":"","code":"getLegendList(plistextra)"},{"path":"https://animint.github.io/animint2/reference/getLegendList.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to get legend information from ggplot — getLegendList","text":"plistextra output ggplot_build(p)","code":""},{"path":"https://animint.github.io/animint2/reference/getLegendList.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to get legend information from ggplot — getLegendList","text":"list containing information legend","code":""},{"path":"https://animint.github.io/animint2/reference/getTextSize.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to process text size with different types of unit — getTextSize","title":"Function to process text size with different types of unit — getTextSize","text":"Function process text size different types unit","code":""},{"path":"https://animint.github.io/animint2/reference/getTextSize.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to process text size with different types of unit — getTextSize","text":"","code":"getTextSize(element.name, theme)"},{"path":"https://animint.github.io/animint2/reference/getTextSize.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to process text size with different types of unit — getTextSize","text":"element.name name theme element theme combined theme plot_theme()","code":""},{"path":"https://animint.github.io/animint2/reference/getTextSize.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to process text size with different types of unit — getTextSize","text":"character text size, unit pt/px","code":""},{"path":"https://animint.github.io/animint2/reference/getUniqueAxisLabels.html","id":null,"dir":"Reference","previous_headings":"","what":"Get unique axis labels for the plot — getUniqueAxisLabels","title":"Get unique axis labels for the plot — getUniqueAxisLabels","text":"Get unique axis labels plot","code":""},{"path":"https://animint.github.io/animint2/reference/getUniqueAxisLabels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get unique axis labels for the plot — getUniqueAxisLabels","text":"","code":"getUniqueAxisLabels(plot.meta)"},{"path":"https://animint.github.io/animint2/reference/getUniqueAxisLabels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get unique axis labels for the plot — getUniqueAxisLabels","text":"plot.meta contains axis labels","code":""},{"path":"https://animint.github.io/animint2/reference/getUniqueAxisLabels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get unique axis labels for the plot — getUniqueAxisLabels","text":"modified plot.meta unique axis labels","code":""},{"path":"https://animint.github.io/animint2/reference/gg-add.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a new component to a ggplot or theme object. — +.gganimint","title":"Add a new component to a ggplot or theme object. — +.gganimint","text":"operator allows add objects ggplot theme object.","code":""},{"path":"https://animint.github.io/animint2/reference/gg-add.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a new component to a ggplot or theme object. — +.gganimint","text":"","code":"# S3 method for gganimint +(e1, e2) e1 %+% e2 e1 %+replace% e2"},{"path":"https://animint.github.io/animint2/reference/gg-add.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a new component to a ggplot or theme object. — +.gganimint","text":"e1 object class ggplot theme e2 component add e1","code":""},{"path":"https://animint.github.io/animint2/reference/gg-add.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a new component to a ggplot or theme object. — +.gganimint","text":"first object object class ggplot, can add following types objects, return modified ggplot object. data.frame: replace current data.frame (must use %+%) uneval: replace current aesthetics layer: add new layer theme: update plot theme scale: replace current scale coord: override current coordinate system facet: override current coordinate faceting first object object class theme, can add another theme object. return modified theme object. theme objects, + operator %+replace% can used modify elements themes. + operator updates elements e1 differ elements specified (NULL) e2. Thus operator can used incrementally add modify attributes ggplot theme. contrast, %+replace% operator replaces entire element; element theme specified e2 present resulting theme (.e. NULL). Thus operator can used overwrite entire theme.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/gg-add.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a new component to a ggplot or theme object. — +.gganimint","text":"","code":"### Adding objects to a ggplot object p <- ggplot(mtcars, aes(wt, mpg, colour = disp)) + geom_point() p p + coord_cartesian(ylim = c(0, 40)) p + scale_colour_continuous(breaks = c(100, 300)) p + guides(colour = \"colourbar\") # Use a different data frame m <- mtcars[1:10, ] p %+% m ### Adding objects to a theme object # Compare these results of adding theme objects to other theme objects add_el <- theme_grey() + theme(text = element_text(family = \"Times\")) rep_el <- theme_grey() %+replace% theme(text = element_text(family = \"Times\")) add_el$text #> List of 10 #> $ family : chr \"Times\" #> $ face : chr \"plain\" #> $ colour : chr \"black\" #> $ size : num 11 #> $ hjust : num 0.5 #> $ vjust : num 0.5 #> $ angle : num 0 #> $ lineheight: num 0.9 #> $ margin : 'margin' num [1:4] 0points 0points 0points 0points #> ..- attr(*, \"unit\")= int 8 #> $ debug : logi FALSE #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" rep_el$text #> List of 10 #> $ family : chr \"Times\" #> $ face : NULL #> $ colour : NULL #> $ size : NULL #> $ hjust : NULL #> $ vjust : NULL #> $ angle : NULL #> $ lineheight: NULL #> $ margin : NULL #> $ debug : NULL #> - attr(*, \"class\")= chr [1:2] \"element_text\" \"element\""},{"path":"https://animint.github.io/animint2/reference/gganimintproto.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new gganimintproto object — gganimintproto","title":"Create a new gganimintproto object — gganimintproto","text":"gganimintproto inspired proto package, important differences. Notably, cleanly supports cross-package inheritance, faster performance.","code":""},{"path":"https://animint.github.io/animint2/reference/gganimintproto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new gganimintproto object — gganimintproto","text":"","code":"gganimintproto(`_class` = NULL, `_inherit` = NULL, ...) gganimintproto_parent(parent, self)"},{"path":"https://animint.github.io/animint2/reference/gganimintproto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new gganimintproto object — gganimintproto","text":"_class Class name assign object. stored class attribute object. NULL (default), class name added object. _inherit gganimintproto object inherit . NULL, inherit object. ... list members gganimintproto object. parent, self Access parent class parent object self.","code":""},{"path":"https://animint.github.io/animint2/reference/gganimintproto.html","id":"calling-gganimintproto-methods","dir":"Reference","previous_headings":"","what":"Calling gganimintproto methods","title":"Create a new gganimintproto object — gganimintproto","text":"gganimintproto methods can take optional self argument: present, regular method; absent, \"static\" method (.e. use fields). Imagine gganimintproto object Adder, method addx = function(self, n) n + self$x. , call function, use Adder$addx(10) -- self passed automatically wrapper function. self located anywhere function signature, although customarily comes first.","code":""},{"path":"https://animint.github.io/animint2/reference/gganimintproto.html","id":"calling-methods-in-a-parent","dir":"Reference","previous_headings":"","what":"Calling methods in a parent","title":"Create a new gganimintproto object — gganimintproto","text":"explicitly call methods parent, use gganimintproto_parent(Parent, self).","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new ggplot plot. — ggplot","title":"Create a new ggplot plot. — ggplot","text":"ggplot() initializes ggplot object. can used declare input data frame graphic specify set plot aesthetics intended common throughout subsequent layers unless specifically overridden.","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new ggplot plot. — ggplot","text":"","code":"ggplot(data = NULL, mapping = aes(), ..., environment = parent.frame())"},{"path":"https://animint.github.io/animint2/reference/ggplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new ggplot plot. — ggplot","text":"data Default dataset use plot. already data.frame, converted one fortify. specified, must suppled layer added plot. mapping Default list aesthetic mappings use plot. specified, must suppled layer added plot. ... arguments passed methods. currently used. environment variable defined aesthetic mapping found data, ggplot look environment. defaults using environment ggplot() called.","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a new ggplot plot. — ggplot","text":"ggplot() typically used construct plot incrementally, using + operator add layers existing ggplot object. advantageous code explicit layers added order added. complex graphics multiple layers, initialization ggplot recommended. three common ways invoke ggplot: ggplot(df, aes(x, y, )) ggplot(df) ggplot() first method recommended layers use data set aesthetics, although method can also used add layer using data another data frame. See first example . second method specifies default data frame use plot, aesthetics defined front. useful one data frame used predominantly layers added, aesthetics may vary one layer another. third method initializes skeleton ggplot object fleshed layers added. method useful multiple data frames used produce different layers, often case complex graphics.","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a new ggplot plot. — ggplot","text":"","code":"df <- data.frame(gp = factor(rep(letters[1:3], each = 10)), y = rnorm(30)) # Compute sample mean and standard deviation in each group ds <- plyr::ddply(df, \"gp\", plyr::summarise, mean = mean(y), sd = sd(y)) # Declare the data frame and common aesthetics. # The summary data frame ds is used to plot # larger red points in a second geom_point() layer. # If the data = argument is not specified, it uses the # declared data frame from ggplot(); ditto for the aesthetics. ggplot(df, aes(x = gp, y = y)) + geom_point() + geom_point(data = ds, aes(y = mean), colour = 'red', size = 3) # Same plot as above, declaring only the data frame in ggplot(). # Note how the x and y aesthetics must now be declared in # each geom_point() layer. ggplot(df) + geom_point(aes(x = gp, y = y)) + geom_point(data = ds, aes(x = gp, y = mean), colour = 'red', size = 3) # Set up a skeleton ggplot object and add layers: ggplot() + geom_point(data = df, aes(x = gp, y = y)) + geom_point(data = ds, aes(x = gp, y = mean), colour = 'red', size = 3) + geom_errorbar(data = ds, aes(x = gp, y = mean, ymin = mean - sd, ymax = mean + sd), colour = 'red', width = 0.4)"},{"path":"https://animint.github.io/animint2/reference/ggplotGrob.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate a ggplot2 plot grob. — ggplotGrob","title":"Generate a ggplot2 plot grob. — ggplotGrob","text":"Generate ggplot2 plot grob.","code":""},{"path":"https://animint.github.io/animint2/reference/ggplotGrob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a ggplot2 plot grob. — ggplotGrob","text":"","code":"ggplotGrob(x)"},{"path":"https://animint.github.io/animint2/reference/ggplotGrob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a ggplot2 plot grob. — ggplotGrob","text":"x ggplot2 object","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot_build.html","id":null,"dir":"Reference","previous_headings":"","what":"Build ggplot for rendering. — ggplot_build","title":"Build ggplot for rendering. — ggplot_build","text":"ggplot_build takes plot object, performs steps necessary produce object can rendered. function outputs two pieces: list data frames (one layer), panel object, contain information axis limits, breaks etc.","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot_build.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build ggplot for rendering. — ggplot_build","text":"","code":"ggplot_build(plot) layer_data(plot, i = 1L) layer_scales(plot, i = 1L, j = 1L) layer_grob(plot, i = 1L)"},{"path":"https://animint.github.io/animint2/reference/ggplot_build.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build ggplot for rendering. — ggplot_build","text":"plot ggplot object","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot_build.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Build ggplot for rendering. — ggplot_build","text":"layer_data, layer_grob, layer_scales helper functions returns data, grob, scales associated given layer. useful tests.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/ggplot_gtable.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a plot with all the usual bits and pieces. — ggplot_gtable","title":"Build a plot with all the usual bits and pieces. — ggplot_gtable","text":"function builds grobs necessary displaying plot, stores special data structure called gtable. object amenable programmatic manipulation, want (e.g.) make legend box 2 cm wide, combine multiple plots single display, preserving aspect ratios across plots.","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot_gtable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a plot with all the usual bits and pieces. — ggplot_gtable","text":"","code":"ggplot_gtable(data)"},{"path":"https://animint.github.io/animint2/reference/ggplot_gtable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a plot with all the usual bits and pieces. — ggplot_gtable","text":"data plot data generated ggplot_build plot plot object","code":""},{"path":"https://animint.github.io/animint2/reference/ggplot_gtable.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a plot with all the usual bits and pieces. — ggplot_gtable","text":"gtable object","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/ggsave.html","id":null,"dir":"Reference","previous_headings":"","what":"Save a ggplot (or other grid object) with sensible defaults — ggsave","title":"Save a ggplot (or other grid object) with sensible defaults — ggsave","text":"ggsave() convenient function saving plot. defaults saving last plot displayed, using size current graphics device. also guesses type graphics device extension.","code":""},{"path":"https://animint.github.io/animint2/reference/ggsave.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save a ggplot (or other grid object) with sensible defaults — ggsave","text":"","code":"ggsave( filename, plot = last_plot(), device = NULL, path = NULL, scale = 1, width = NA, height = NA, units = c(\"in\", \"cm\", \"mm\"), dpi = 300, limitsize = TRUE, ... )"},{"path":"https://animint.github.io/animint2/reference/ggsave.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save a ggplot (or other grid object) with sensible defaults — ggsave","text":"filename File name create disk. plot Plot save, defaults last plot displayed. device Device use (function recognized extensions, e.g. \"pdf\"). default, extracted filename extension. ggsave currently recognises eps/ps, tex (pictex), pdf, jpeg, tiff, png, bmp, svg wmf (windows ). path Path save plot (combined filename). scale Multiplicative scaling factor. width, height Plot dimensions, defaults size current graphics device. units Units width height specified explicitly (, cm, mm) dpi Resolution used raster outputs. limitsize TRUE (default), ggsave save images larger 50x50 inches, prevent common error specifying dimensions pixels. ... arguments passed graphics device","code":""},{"path":"https://animint.github.io/animint2/reference/ggsave.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save a ggplot (or other grid object) with sensible defaults — ggsave","text":"","code":"if (FALSE) { ggplot(mtcars, aes(mpg, wt)) + geom_point() ggsave(file.path(tempdir(), \"mtcars.pdf\")) ggsave(file.path(tempdir(), \"mtcars.png\")) ggsave(file.path(tempdir(), \"mtcars.pdf\"), width = 4, height = 4) ggsave(file.path(tempdir(), \"mtcars.pdf\"), width = 20, height = 20, units = \"cm\") unlink(file.path(tempdir(), \"mtcars.pdf\")) unlink(file.path(tempdir(), \"mtcars.png\")) # specify device when saving to a file with unknown extension # (for example a server supplied temporary file) file <- tempfile() ggsave(file, device = \"pdf\") unlink(file) }"},{"path":"https://animint.github.io/animint2/reference/ggtheme.html","id":null,"dir":"Reference","previous_headings":"","what":"ggplot2 themes — ggtheme","title":"ggplot2 themes — ggtheme","text":"Themes set general aspect plot colour background, gridlines, size colour fonts.","code":""},{"path":"https://animint.github.io/animint2/reference/ggtheme.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ggplot2 themes — ggtheme","text":"","code":"theme_grey(base_size = 11, base_family = \"\") theme_gray(base_size = 11, base_family = \"\") theme_bw(base_size = 12, base_family = \"\") theme_linedraw(base_size = 12, base_family = \"\") theme_light(base_size = 12, base_family = \"\") theme_minimal(base_size = 12, base_family = \"\") theme_classic(base_size = 12, base_family = \"\") theme_dark(base_size = 12, base_family = \"\") theme_void(base_size = 12, base_family = \"\")"},{"path":"https://animint.github.io/animint2/reference/ggtheme.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ggplot2 themes — ggtheme","text":"base_size base font size base_family base font family","code":""},{"path":"https://animint.github.io/animint2/reference/ggtheme.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"ggplot2 themes — ggtheme","text":"theme_gray signature ggplot2 theme grey background white gridlines, designed put data forward yet make comparisons easy. theme_bw classic dark--light ggplot2 theme. May work better presentations displayed projector. theme_linedraw theme black lines various widths white backgrounds, reminiscent line drawings. Serves purpose similar theme_bw. Note theme thin lines (<< 1 pt) journals may refuse. theme_light theme similar theme_linedraw light grey lines axes, direct attention towards data. theme_dark dark cousin theme_light, similar line sizes dark background. Useful make thin coloured lines pop . theme_minimal minimalistic theme background annotations. theme_classic classic-looking theme, x y axis lines gridlines. theme_void completely empty theme.","code":""},{"path":"https://animint.github.io/animint2/reference/ggtheme.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ggplot2 themes — ggtheme","text":"","code":"p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg, colour = factor(gear))) + facet_wrap(~am) p p + theme_gray() p + theme_bw() p + theme_linedraw() p + theme_light() p + theme_dark() p + theme_minimal() p + theme_classic() p + theme_void()"},{"path":"https://animint.github.io/animint2/reference/gg_dep.html","id":null,"dir":"Reference","previous_headings":"","what":"Give a deprecation error, warning, or message, depending on version number. — gg_dep","title":"Give a deprecation error, warning, or message, depending on version number. — gg_dep","text":"Version numbers format .., like 0.9.2. function compares current version number ggplot2 specified version, recent version function (object) deprecated.","code":""},{"path":"https://animint.github.io/animint2/reference/gg_dep.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Give a deprecation error, warning, or message, depending on version number. — gg_dep","text":"","code":"gg_dep(version, msg)"},{"path":"https://animint.github.io/animint2/reference/gg_dep.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Give a deprecation error, warning, or message, depending on version number. — gg_dep","text":"version last version ggplot2 function good (words, last version deprecated). msg message print.","code":""},{"path":"https://animint.github.io/animint2/reference/gg_dep.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Give a deprecation error, warning, or message, depending on version number. — gg_dep","text":"gg_dep give error, warning, message, depending difference current ggplot2 version specified version. current major number greater version's major number, current minor number 1 greater version's minor number, give error. current minor number differs version's minor number one, give warning. current subminor number differs version's subminor number, print message.","code":""},{"path":"https://animint.github.io/animint2/reference/graphical-units.html","id":null,"dir":"Reference","previous_headings":"","what":"Graphical units — graphical-units","title":"Graphical units — graphical-units","text":"Multiply size mm constants order convert units grid uses internally lwd fontsize.","code":""},{"path":"https://animint.github.io/animint2/reference/graphical-units.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Graphical units — graphical-units","text":"","code":".pt .stroke"},{"path":"https://animint.github.io/animint2/reference/graphical-units.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Graphical units — graphical-units","text":"object class numeric length 1. object class numeric length 1.","code":""},{"path":"https://animint.github.io/animint2/reference/guides.html","id":null,"dir":"Reference","previous_headings":"","what":"Set guides for each scale. — guides","title":"Set guides for each scale. — guides","text":"Guides scale can set call scale_* argument guide, guides.","code":""},{"path":"https://animint.github.io/animint2/reference/guides.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set guides for each scale. — guides","text":"","code":"guides(...)"},{"path":"https://animint.github.io/animint2/reference/guides.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set guides for each scale. — guides","text":"... List scale guide pairs","code":""},{"path":"https://animint.github.io/animint2/reference/guides.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set guides for each scale. — guides","text":"list containing mapping scale guide.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/guides.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set guides for each scale. — guides","text":"","code":"# \\donttest{ # ggplot object dat <- data.frame(x = 1:5, y = 1:5, p = 1:5, q = factor(1:5), r = factor(1:5)) p <- ggplot(dat, aes(x, y, colour = p, size = q, shape = r)) + geom_point() # without guide specification p #> Warning: Using size for a discrete variable is not advised. # Show colorbar guide for colour. # All these examples below have a same effect. p + guides(colour = \"colorbar\", size = \"legend\", shape = \"legend\") #> Warning: Using size for a discrete variable is not advised. p + guides(colour = guide_colorbar(), size = guide_legend(), shape = guide_legend()) #> Warning: Using size for a discrete variable is not advised. p + scale_colour_continuous(guide = \"colorbar\") + scale_size_discrete(guide = \"legend\") + scale_shape(guide = \"legend\") #> Warning: Using size for a discrete variable is not advised. # Remove some guides p + guides(colour = \"none\") #> Warning: Using size for a discrete variable is not advised. p + guides(colour = \"colorbar\",size = \"none\") #> Warning: Using size for a discrete variable is not advised. # Guides are integrated where possible p + guides(colour = guide_legend(\"title\"), size = guide_legend(\"title\"), shape = guide_legend(\"title\")) #> Warning: Using size for a discrete variable is not advised. # same as g <- guide_legend(\"title\") p + guides(colour = g, size = g, shape = g) #> Warning: Using size for a discrete variable is not advised. p + theme(legend.position = \"bottom\") #> Warning: Using size for a discrete variable is not advised. # position of guides p + theme(legend.position = \"bottom\", legend.box = \"horizontal\") #> Warning: Using size for a discrete variable is not advised. # Set order for multiple guides ggplot(mpg, aes(displ, cty)) + geom_point(aes(size = hwy, colour = cyl, shape = drv)) + guides( colour = guide_colourbar(order = 1), shape = guide_legend(order = 2), size = guide_legend(order = 3) ) # }"},{"path":"https://animint.github.io/animint2/reference/guide_colourbar.html","id":null,"dir":"Reference","previous_headings":"","what":"Continuous colour bar guide. — guide_colourbar","title":"Continuous colour bar guide. — guide_colourbar","text":"Colour bar guide shows continuous color scales mapped onto values. Colour bar available scale_fill scale_colour. information, see inspiration function: Matlab's colorbar function.","code":""},{"path":"https://animint.github.io/animint2/reference/guide_colourbar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Continuous colour bar guide. — guide_colourbar","text":"","code":"guide_colourbar( title = waiver(), title.position = NULL, title.theme = NULL, title.hjust = NULL, title.vjust = NULL, label = TRUE, label.position = NULL, label.theme = NULL, label.hjust = NULL, label.vjust = NULL, barwidth = NULL, barheight = NULL, nbin = 20, raster = TRUE, ticks = TRUE, draw.ulim = TRUE, draw.llim = TRUE, direction = NULL, default.unit = \"line\", reverse = FALSE, order = 0, ... ) guide_colorbar( title = waiver(), title.position = NULL, title.theme = NULL, title.hjust = NULL, title.vjust = NULL, label = TRUE, label.position = NULL, label.theme = NULL, label.hjust = NULL, label.vjust = NULL, barwidth = NULL, barheight = NULL, nbin = 20, raster = TRUE, ticks = TRUE, draw.ulim = TRUE, draw.llim = TRUE, direction = NULL, default.unit = \"line\", reverse = FALSE, order = 0, ... )"},{"path":"https://animint.github.io/animint2/reference/guide_colourbar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Continuous colour bar guide. — guide_colourbar","text":"title character string expression indicating title guide. NULL, title shown. default (waiver), name scale object name specified labs used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text expected. default, theme specified legend.title theme theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. label logical. TRUE labels drawn. FALSE labels invisible. label.position character string indicating position label. One \"top\", \"bottom\" (default horizontal guide), \"left\", \"right\" (default vertical guide). label.theme theme object rendering label text. Usually object element_text expected. default, theme specified legend.text theme theme. label.hjust numeric specifying horizontal justification label text. label.vjust numeric specifying vertical justification label text. barwidth numeric unit object specifying width colorbar. Default value legend.key.width legend.key.size theme theme. barheight numeric unit object specifying height colorbar. Default value legend.key.height legend.key.size theme theme. nbin numeric specifying number bins drawing colorbar. smoother colorbar larger value. raster logical. TRUE colorbar rendered raster object. FALSE colorbar rendered set rectangles. Note graphics devices capable rendering raster image. ticks logical specifying tick marks colorbar visible. draw.ulim logical specifying upper limit tick marks visible. draw.llim logical specifying lower limit tick marks visible. direction character string indicating direction guide. One \"horizontal\" \"vertical.\" default.unit character string indicating unit barwidth barheight. reverse logical. TRUE colorbar reversed. default, highest value top lowest value bottom order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm. ... ignored.","code":""},{"path":"https://animint.github.io/animint2/reference/guide_colourbar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Continuous colour bar guide. — guide_colourbar","text":"guide object","code":""},{"path":"https://animint.github.io/animint2/reference/guide_colourbar.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Continuous colour bar guide. — guide_colourbar","text":"Guides can specified scale_* guides. guide=\"legend\" scale_* syntactic sugar guide=guide_legend() (e.g. scale_color_manual(guide = \"legend\")). specify guide scale detail, see guides.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/guide_colourbar.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Continuous colour bar guide. — guide_colourbar","text":"","code":"df <- reshape2::melt(outer(1:4, 1:4), varnames = c(\"X1\", \"X2\")) p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value)) p2 <- p1 + geom_point(aes(size = value)) # Basic form p1 + scale_fill_continuous(guide = \"colorbar\") p1 + scale_fill_continuous(guide = guide_colorbar()) p1 + guides(fill = guide_colorbar()) # Control styles # bar size p1 + guides(fill = guide_colorbar(barwidth = 0.5, barheight = 10)) # no label p1 + guides(fill = guide_colorbar(label = FALSE)) # no tick marks p1 + guides(fill = guide_colorbar(ticks = FALSE)) # label position p1 + guides(fill = guide_colorbar(label.position = \"left\")) # label theme p1 + guides(fill = guide_colorbar(label.theme = element_text(colour = \"blue\", angle = 0))) # small number of bins p1 + guides(fill = guide_colorbar(nbin = 3)) # large number of bins p1 + guides(fill = guide_colorbar(nbin = 100)) # make top- and bottom-most ticks invisible p1 + scale_fill_continuous(limits = c(0,20), breaks = c(0, 5, 10, 15, 20), guide = guide_colorbar(nbin=100, draw.ulim = FALSE, draw.llim = FALSE)) # guides can be controlled independently p2 + scale_fill_continuous(guide = \"colorbar\") + scale_size(guide = \"legend\") p2 + guides(fill = \"colorbar\", size = \"legend\") p2 + scale_fill_continuous(guide = guide_colorbar(direction = \"horizontal\")) + scale_size(guide = guide_legend(direction = \"vertical\"))"},{"path":"https://animint.github.io/animint2/reference/guide_legend.html","id":null,"dir":"Reference","previous_headings":"","what":"Legend guide. — guide_legend","title":"Legend guide. — guide_legend","text":"Legend type guide shows key (.e., geoms) mapped onto values. Legend guides various scales integrated possible.","code":""},{"path":"https://animint.github.io/animint2/reference/guide_legend.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Legend guide. — guide_legend","text":"","code":"guide_legend( title = waiver(), title.position = NULL, title.theme = NULL, title.hjust = NULL, title.vjust = NULL, label = TRUE, label.position = NULL, label.theme = NULL, label.hjust = NULL, label.vjust = NULL, keywidth = NULL, keyheight = NULL, direction = NULL, default.unit = \"line\", override.aes = list(), nrow = NULL, ncol = NULL, byrow = FALSE, reverse = FALSE, order = 0, ... )"},{"path":"https://animint.github.io/animint2/reference/guide_legend.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Legend guide. — guide_legend","text":"title character string expression indicating title guide. NULL, title shown. default (waiver), name scale object name specified labs used title. title.position character string indicating position title. One \"top\" (default vertical guide), \"bottom\", \"left\" (default horizontal guide), \"right.\" title.theme theme object rendering title text. Usually object element_text expected. default, theme specified legend.title theme theme. title.hjust number specifying horizontal justification title text. title.vjust number specifying vertical justification title text. label logical. TRUE labels drawn. FALSE labels invisible. label.position character string indicating position label. One \"top\", \"bottom\" (default horizontal guide), \"left\", \"right\" (default vertical guide). label.theme theme object rendering label text. Usually object element_text expected. default, theme specified legend.text theme theme. label.hjust numeric specifying horizontal justification label text. label.vjust numeric specifying vertical justification label text. keywidth numeric unit object specifying width legend key. Default value legend.key.width legend.key.size theme theme. keyheight numeric unit object specifying height legend key. Default value legend.key.height legend.key.size theme theme. direction character string indicating direction guide. One \"horizontal\" \"vertical.\" default.unit character string indicating unit keywidth keyheight. override.aes list specifying aesthetic parameters legend key. See details examples. nrow desired number rows legends. ncol desired number column legends. byrow logical. FALSE (default) legend-matrix filled columns, otherwise legend-matrix filled rows. reverse logical. TRUE order legends reversed. order positive integer less 99 specifies order guide among multiple guides. controls order multiple guides displayed, contents guide . 0 (default), order determined secret algorithm. ... ignored.","code":""},{"path":"https://animint.github.io/animint2/reference/guide_legend.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Legend guide. — guide_legend","text":"guide object","code":""},{"path":"https://animint.github.io/animint2/reference/guide_legend.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Legend guide. — guide_legend","text":"Guides can specified scale_* guides. guide=\"legend\" scale_* syntactic sugar guide=guide_legend() (e.g. scale_color_manual(guide = \"legend\")). specify guide scale detail, see guides.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/guide_legend.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Legend guide. — guide_legend","text":"","code":"# \\donttest{ df <- reshape2::melt(outer(1:4, 1:4), varnames = c(\"X1\", \"X2\")) p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value)) p2 <- p1 + geom_point(aes(size = value)) # Basic form p1 + scale_fill_continuous(guide = \"legend\") p1 + scale_fill_continuous(guide = guide_legend()) # Guide title p1 + scale_fill_continuous(guide = guide_legend(title = \"V\")) # title text p1 + scale_fill_continuous(guide = guide_legend(title = NULL)) # no title # Control styles # key size p1 + guides(fill = guide_legend(keywidth = 3, keyheight = 1)) # title position p1 + guides(fill = guide_legend(title = \"LEFT\", title.position = \"left\")) # title text styles via element_text p1 + guides(fill = guide_legend( title.theme = element_text( size = 15, face = \"italic\", colour = \"red\", angle = 0 ) ) ) # label position p1 + guides(fill = guide_legend(label.position = \"left\", label.hjust = 1)) # label styles p1 + scale_fill_continuous(breaks = c(5, 10, 15), labels = paste(\"long\", c(5, 10, 15)), guide = guide_legend( direction = \"horizontal\", title.position = \"top\", label.position = \"bottom\", label.hjust = 0.5, label.vjust = 1, label.theme = element_text(angle = 90) ) ) # Set aesthetic of legend key # very low alpha value make it difficult to see legend key p3 <- ggplot(diamonds, aes(carat, price)) + geom_point(aes(colour = color), alpha = 1/100) p3 # override.aes overwrites the alpha p3 + guides(colour = guide_legend(override.aes = list(alpha = 1))) # multiple row/col legends df <- data.frame(x = 1:20, y = 1:20, color = letters[1:20]) p <- ggplot(df, aes(x, y)) + geom_point(aes(colour = color)) p + guides(col = guide_legend(nrow = 8)) p + guides(col = guide_legend(ncol = 8)) p + guides(col = guide_legend(nrow = 8, byrow = TRUE)) p + guides(col = guide_legend(ncol = 8, byrow = TRUE)) # reversed order legend p + guides(col = guide_legend(reverse = TRUE)) # }"},{"path":"https://animint.github.io/animint2/reference/g_train_layout.html","id":null,"dir":"Reference","previous_headings":"","what":"Learn the layout of panels within a plot. — g_train_layout","title":"Learn the layout of panels within a plot. — g_train_layout","text":"determined facet, returns data frame, joined data plotted tells us panel appear , panel appears grid, scales uses.","code":""},{"path":"https://animint.github.io/animint2/reference/g_train_layout.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Learn the layout of panels within a plot. — g_train_layout","text":"","code":"g_train_layout(panel, facet, data, plot_data)"},{"path":"https://animint.github.io/animint2/reference/g_train_layout.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Learn the layout of panels within a plot. — g_train_layout","text":"panel panel object train facet facetting specification data list data frames (one layer), one plot plot_data default data frame","code":""},{"path":"https://animint.github.io/animint2/reference/g_train_layout.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Learn the layout of panels within a plot. — g_train_layout","text":"updated panel object","code":""},{"path":"https://animint.github.io/animint2/reference/g_train_layout.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Learn the layout of panels within a plot. — g_train_layout","text":"well layout info, function also adds empty lists house x y scales.","code":""},{"path":"https://animint.github.io/animint2/reference/hmisc.html","id":null,"dir":"Reference","previous_headings":"","what":"Wrap up a selection of summary functions from Hmisc to make it easy to use\r\nwith stat_summary. — hmisc","title":"Wrap up a selection of summary functions from Hmisc to make it easy to use\r\nwith stat_summary. — hmisc","text":"See Hmisc documentation details options.","code":""},{"path":"https://animint.github.io/animint2/reference/hmisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wrap up a selection of summary functions from Hmisc to make it easy to use\r\nwith stat_summary. — hmisc","text":"","code":"mean_cl_boot(x, ...) mean_cl_normal(x, ...) mean_sdl(x, ...) median_hilow(x, ...)"},{"path":"https://animint.github.io/animint2/reference/hmisc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wrap up a selection of summary functions from Hmisc to make it easy to use\r\nwith stat_summary. — hmisc","text":"x numeric vector ... arguments passed respective Hmisc function.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/intreg.html","id":null,"dir":"Reference","previous_headings":"","what":"Interval regression — intreg","title":"Interval regression — intreg","text":"Learning model complexity using max-margin interval regression. observed several noisy piecewise constant signals, weak labels many change-points occur several regions. Max margin interval regression algorithm uses information learn penalty function accurate change-point detection.","code":""},{"path":"https://animint.github.io/animint2/reference/intreg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Interval regression — intreg","text":"","code":"data(intreg)"},{"path":"https://animint.github.io/animint2/reference/intreg.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Interval regression — intreg","text":"7 related data.frames: signals contains noisy piecewise constant signals, annotations contains weak labels, segments breaks contain segmentation model, selection contains penalty cost information, intervals contains target intervals penalty values signal, model describes learned max margin interval regression model.","code":""},{"path":"https://animint.github.io/animint2/reference/is.Coord.html","id":null,"dir":"Reference","previous_headings":"","what":"Is this object a coordinate system? — is.Coord","title":"Is this object a coordinate system? — is.Coord","text":"object coordinate system?","code":""},{"path":"https://animint.github.io/animint2/reference/is.Coord.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is this object a coordinate system? — is.Coord","text":"","code":"is.Coord(x)"},{"path":"https://animint.github.io/animint2/reference/is.facet.html","id":null,"dir":"Reference","previous_headings":"","what":"Is this object a facetting specification? — is.facet","title":"Is this object a facetting specification? — is.facet","text":"object facetting specification?","code":""},{"path":"https://animint.github.io/animint2/reference/is.facet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is this object a facetting specification? — is.facet","text":"","code":"is.facet(x)"},{"path":"https://animint.github.io/animint2/reference/is.facet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is this object a facetting specification? — is.facet","text":"x object test","code":""},{"path":"https://animint.github.io/animint2/reference/is.gganimintproto.html","id":null,"dir":"Reference","previous_headings":"","what":"Is an object a gganimintproto object? — is.gganimintproto","title":"Is an object a gganimintproto object? — is.gganimintproto","text":"object gganimintproto object?","code":""},{"path":"https://animint.github.io/animint2/reference/is.gganimintproto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is an object a gganimintproto object? — is.gganimintproto","text":"","code":"is.gganimintproto(x)"},{"path":"https://animint.github.io/animint2/reference/is.gganimintproto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is an object a gganimintproto object? — is.gganimintproto","text":"x object test.","code":""},{"path":"https://animint.github.io/animint2/reference/is.ggplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Reports whether x is a ggplot object — is.ggplot","title":"Reports whether x is a ggplot object — is.ggplot","text":"Reports whether x ggplot object","code":""},{"path":"https://animint.github.io/animint2/reference/is.ggplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reports whether x is a ggplot object — is.ggplot","text":"","code":"is.ggplot(x)"},{"path":"https://animint.github.io/animint2/reference/is.ggplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Reports whether x is a ggplot object — is.ggplot","text":"x object test","code":""},{"path":"https://animint.github.io/animint2/reference/is.rel.html","id":null,"dir":"Reference","previous_headings":"","what":"Reports whether x is a rel object — is.rel","title":"Reports whether x is a rel object — is.rel","text":"Reports whether x rel object","code":""},{"path":"https://animint.github.io/animint2/reference/is.rel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reports whether x is a rel object — is.rel","text":"","code":"is.rel(x)"},{"path":"https://animint.github.io/animint2/reference/is.rel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Reports whether x is a rel object — is.rel","text":"x object test","code":""},{"path":"https://animint.github.io/animint2/reference/is.rgb.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if character is an RGB hexadecimal color value — is.rgb","title":"Check if character is an RGB hexadecimal color value — is.rgb","text":"Check character RGB hexadecimal color value","code":""},{"path":"https://animint.github.io/animint2/reference/is.rgb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if character is an RGB hexadecimal color value — is.rgb","text":"","code":"is.rgb(x)"},{"path":"https://animint.github.io/animint2/reference/is.rgb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if character is an RGB hexadecimal color value — is.rgb","text":"x character","code":""},{"path":"https://animint.github.io/animint2/reference/is.rgb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if character is an RGB hexadecimal color value — is.rgb","text":"True/False value","code":""},{"path":"https://animint.github.io/animint2/reference/is.theme.html","id":null,"dir":"Reference","previous_headings":"","what":"Reports whether x is a theme object — is.theme","title":"Reports whether x is a theme object — is.theme","text":"Reports whether x theme object","code":""},{"path":"https://animint.github.io/animint2/reference/is.theme.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Reports whether x is a theme object — is.theme","text":"","code":"is.theme(x)"},{"path":"https://animint.github.io/animint2/reference/is.theme.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Reports whether x is a theme object — is.theme","text":"x object test","code":""},{"path":"https://animint.github.io/animint2/reference/issueSelectorWarnings.html","id":null,"dir":"Reference","previous_headings":"","what":"Issue warnings for selectors — issueSelectorWarnings","title":"Issue warnings for selectors — issueSelectorWarnings","text":"Issue warnings selectors","code":""},{"path":"https://animint.github.io/animint2/reference/issueSelectorWarnings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Issue warnings for selectors — issueSelectorWarnings","text":"","code":"issueSelectorWarnings(geoms, selector.aes, duration)"},{"path":"https://animint.github.io/animint2/reference/issueSelectorWarnings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Issue warnings for selectors — issueSelectorWarnings","text":"geoms geoms check warnings selector.aes selectors geom duration animation variable information check key value","code":""},{"path":"https://animint.github.io/animint2/reference/issueSelectorWarnings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Issue warnings for selectors — issueSelectorWarnings","text":"NULL","code":""},{"path":"https://animint.github.io/animint2/reference/knit_print.animint.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint","title":"Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint","text":"Insert interactive animation R markdown document using customized print method.","code":""},{"path":"https://animint.github.io/animint2/reference/knit_print.animint.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint","text":"","code":"# S3 method for animint knit_print(x, options, ...)"},{"path":"https://animint.github.io/animint2/reference/knit_print.animint.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint","text":"x named list ggplots option lists pass animint2dir. options knitr options. ... placeholder.","code":""},{"path":"https://animint.github.io/animint2/reference/knit_print.animint.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint","text":"https://github.com/yihui/knitr/blob/master/vignettes/knit_print.Rmd","code":""},{"path":"https://animint.github.io/animint2/reference/knit_print.animint.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Insert an interactive animation into an R markdown document using a customized print method. — knit_print.animint","text":"Carson Sievert","code":""},{"path":"https://animint.github.io/animint2/reference/labeller.html","id":null,"dir":"Reference","previous_headings":"","what":"Generic labeller function for facets — labeller","title":"Generic labeller function for facets — labeller","text":"function makes easy assign different labellers different factors. labeller can function can named character vectors serve lookup table.","code":""},{"path":"https://animint.github.io/animint2/reference/labeller.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generic labeller function for facets — labeller","text":"","code":"labeller( ..., .rows = NULL, .cols = NULL, keep.as.numeric = NULL, .multi_line = TRUE, .default = label_value )"},{"path":"https://animint.github.io/animint2/reference/labeller.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generic labeller function for facets — labeller","text":"... Named arguments form variable = labeller. labeller passed as_labeller() can lookup table, function taking returning character vectors, simply labeller function. .rows, .cols Labeller whole margin (either rows columns). passed as_labeller(). margin-wide labeller set, make sure mention ... variable belonging margin. keep..numeric Deprecated. supplied labellers -labeller functions able work character labels. .multi_line Whether display labels multiple factors separate lines. passed labeller function. .default Default labeller variables specified. Also used lookup tables non-labeller functions.","code":""},{"path":"https://animint.github.io/animint2/reference/labeller.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generic labeller function for facets — labeller","text":"labeller function supply facet_grid argument labeller.","code":""},{"path":"https://animint.github.io/animint2/reference/labeller.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generic labeller function for facets — labeller","text":"case functions, labeller class labeller, directly applied data frame labels. Otherwise, applied columns data frame labels. data frame processed function specified .default argument. intended used functions taking character vector capitalize.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/labeller.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generic labeller function for facets — labeller","text":"","code":"# \\donttest{ p1 <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() # You can assign different labellers to variables: p1 + facet_grid(vs + am ~ gear, labeller = labeller(vs = label_both, am = label_value)) # Or whole margins: p1 + facet_grid(vs + am ~ gear, labeller = labeller(.rows = label_both, .cols = label_value)) # You can supply functions operating on strings: capitalize <- function(string) { substr(string, 1, 1) <- toupper(substr(string, 1, 1)) string } p2 <- ggplot(msleep, aes(x = sleep_total, y = awake)) + geom_point() p2 + facet_grid(vore ~ conservation, labeller = labeller(vore = capitalize)) # Or use character vectors as lookup tables: conservation_status <- c( cd = \"Conservation Dependent\", en = \"Endangered\", lc = \"Least concern\", nt = \"Near Threatened\", vu = \"Vulnerable\", domesticated = \"Domesticated\" ) ## Source: http://en.wikipedia.org/wiki/Wikipedia:Conservation_status p2 + facet_grid(vore ~ conservation, labeller = labeller( .default = capitalize, conservation = conservation_status )) # In the following example, we rename the levels to the long form, # then apply a wrap labeller to the columns to prevent cropped text msleep$conservation2 <- plyr::revalue(msleep$conservation, conservation_status) p2 %+% msleep + facet_grid(vore ~ conservation2) p2 %+% msleep + facet_grid(vore ~ conservation2, labeller = labeller(conservation2 = label_wrap_gen(10)) ) # labeller() is especially useful to act as a global labeller. You # can set it up once and use it on a range of different plots with # different facet specifications. global_labeller <- labeller( vore = capitalize, conservation = conservation_status, conservation2 = label_wrap_gen(10), .default = label_both ) p2 + facet_grid(vore ~ conservation, labeller = global_labeller) p2 + facet_wrap(~vore, labeller = global_labeller) p2 %+% msleep + facet_wrap(~conservation2, labeller = global_labeller) # }"},{"path":"https://animint.github.io/animint2/reference/labellers.html","id":null,"dir":"Reference","previous_headings":"","what":"Labeller functions — labellers","title":"Labeller functions — labellers","text":"Labeller functions charge formatting strip labels facet grids wraps. accept multi_line argument control whether multiple factors (defined formulae ~first + second) displayed single line separated commas, line.","code":""},{"path":"https://animint.github.io/animint2/reference/labellers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Labeller functions — labellers","text":"","code":"label_value(labels, multi_line = TRUE) label_both(labels, multi_line = TRUE, sep = \": \") label_context(labels, multi_line = TRUE, sep = \": \") label_parsed(labels, multi_line = TRUE) label_wrap_gen(width = 25, multi_line = TRUE)"},{"path":"https://animint.github.io/animint2/reference/labellers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Labeller functions — labellers","text":"labels Data frame labels. Usually contains one element, facetting multiple factors entails multiple label variables. multi_line Whether display labels multiple factors separate lines. sep String separating variables values. width Maximum number characters wrapping strip.","code":""},{"path":"https://animint.github.io/animint2/reference/labellers.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Labeller functions — labellers","text":"label_value() displays value factor label_both() displays variable name factor value. label_context() context-dependent uses label_value() single factor facetting label_both() multiple factors involved. label_wrap_gen() uses strwrap() line wrapping. label_parsed() interprets labels plotmath expressions. label_bquote() offers flexible way constructing plotmath expressions. See examples bquote() details syntax argument.","code":""},{"path":"https://animint.github.io/animint2/reference/labellers.html","id":"writing-new-labeller-functions","dir":"Reference","previous_headings":"","what":"Writing New Labeller Functions","title":"Labeller functions — labellers","text":"Note easy way write labeller function transform function operating character vectors as_labeller(). labeller function accepts data frame labels (character vectors) containing one column factor. Multiple factors occur formula type ~first + second. return value must rectangular list 'row' characterises single facet. list elements can either character vectors lists plotmath expressions. multiple elements returned, get displayed new lines (.e., facet gets multi-line strip labels). illustrate, say labeller returns list two character vectors length 3. rectangular list elements length. first facet get first elements vector display line. second facet gets second elements vector, . useful labeller, can retrieve type attribute incoming data frame labels. value attribute reflects kind strips labeller dealing : \"cols\" columns \"rows\" rows. Note facet_wrap() columns default rows strips switched switch option. facet attribute also provides metadata labels. takes values \"grid\" \"wrap\". compatibility labeller(), labeller function must labeller S3 class.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/labellers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Labeller functions — labellers","text":"","code":"mtcars$cyl2 <- factor(mtcars$cyl, labels = c(\"alpha\", \"beta\", \"gamma\")) p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() # Displaying only the values p + facet_grid(. ~ cyl) p + facet_grid(. ~ cyl, labeller = label_value) # \\donttest{ # Displaying both the values and the variables p + facet_grid(. ~ cyl, labeller = label_both) # Displaying only the values or both the values and variables # depending on whether multiple factors are facetted over p + facet_grid(am ~ vs+cyl, labeller = label_context) # Interpreting the labels as plotmath expressions p + facet_grid(. ~ cyl2) p + facet_grid(. ~ cyl2, labeller = label_parsed) p + facet_wrap(~vs + cyl2, labeller = label_parsed) # }"},{"path":"https://animint.github.io/animint2/reference/label_bquote.html","id":null,"dir":"Reference","previous_headings":"","what":"Backquoted labeller — label_bquote","title":"Backquoted labeller — label_bquote","text":"label_bquote() offers flexible way labelling facet rows columns plotmath expressions. Backquoted variables replaced value facet.","code":""},{"path":"https://animint.github.io/animint2/reference/label_bquote.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Backquoted labeller — label_bquote","text":"","code":"label_bquote(rows = NULL, cols = NULL, default = label_value)"},{"path":"https://animint.github.io/animint2/reference/label_bquote.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Backquoted labeller — label_bquote","text":"rows Backquoted labelling expression rows. cols Backquoted labelling expression columns. default Default labeller function rows columns plotmath expression provided.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/label_bquote.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Backquoted labeller — label_bquote","text":"","code":"# The variables mentioned in the plotmath expression must be # backquoted and referred to by their names. p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() p + facet_grid(vs ~ ., labeller = label_bquote(alpha ^ .(vs))) p + facet_grid(. ~ vs, labeller = label_bquote(cols = .(vs) ^ .(vs))) p + facet_grid(. ~ vs + am, labeller = label_bquote(cols = .(am) ^ .(vs)))"},{"path":"https://animint.github.io/animint2/reference/labs.html","id":null,"dir":"Reference","previous_headings":"","what":"Change axis labels, legend titles, plot title/subtitle and below-plot\r\ncaption. — labs","title":"Change axis labels, legend titles, plot title/subtitle and below-plot\r\ncaption. — labs","text":"Change axis labels, legend titles, plot title/subtitle -plot caption.","code":""},{"path":"https://animint.github.io/animint2/reference/labs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Change axis labels, legend titles, plot title/subtitle and below-plot\r\ncaption. — labs","text":"","code":"labs(...) xlab(label) ylab(label) ggtitle(label, subtitle = NULL)"},{"path":"https://animint.github.io/animint2/reference/labs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Change axis labels, legend titles, plot title/subtitle and below-plot\r\ncaption. — labs","text":"... list new names form aesthetic = \"new name\" label text axis, plot title caption plot. subtitle text subtitle plot displayed title. Leave NULL subtitle.","code":""},{"path":"https://animint.github.io/animint2/reference/labs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Change axis labels, legend titles, plot title/subtitle and below-plot\r\ncaption. — labs","text":"","code":"p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p + labs(title = \"New plot title\") p + labs(x = \"New x label\") p + xlab(\"New x label\") p + ylab(\"New y label\") p + ggtitle(\"New plot title\") # Can add a subtitle to plots with either of the following p + ggtitle(\"New plot title\", subtitle = \"A subtitle\") p + labs(title = \"New plot title\", subtitle = \"A subtitle\") # Can add a plot caption underneath the whole plot (for sources, notes or # copyright), similar to the \\code{sub} parameter in base R, with the # following p + labs(caption = \"(based on data from ...)\") # This should work independently of other functions that modify the # the scale names p + ylab(\"New y label\") + ylim(2, 4) #> Warning: Removed 8 rows containing missing values (geom_point). p + ylim(2, 4) + ylab(\"New y label\") #> Warning: Removed 8 rows containing missing values (geom_point). # The labs function also modifies legend labels p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point() p + labs(colour = \"Cylinders\") # Can also pass in a list, if that is more convenient p + labs(list(title = \"Title\", subtitle = \"Subtitle\", x = \"X\", y = \"Y\"))"},{"path":"https://animint.github.io/animint2/reference/last_plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve the last plot to be modified or created. — last_plot","title":"Retrieve the last plot to be modified or created. — last_plot","text":"Retrieve last plot modified created.","code":""},{"path":"https://animint.github.io/animint2/reference/last_plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve the last plot to be modified or created. — last_plot","text":"","code":"last_plot()"},{"path":[]},{"path":"https://animint.github.io/animint2/reference/layer.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a new layer — layer","title":"Create a new layer — layer","text":"layer combination data, stat geom potential position adjustment. Usually layers created using geom_* stat_* calls can also created directly using function.","code":""},{"path":"https://animint.github.io/animint2/reference/layer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a new layer — layer","text":"","code":"layer( geom = NULL, stat = NULL, data = NULL, mapping = NULL, position = NULL, params = list(), inherit.aes = TRUE, subset = NULL, show.legend = NA )"},{"path":"https://animint.github.io/animint2/reference/layer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a new layer — layer","text":"geom geometric object use display data stat statistical transformation use data layer, string. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. position Position adjustment, either string, result call position adjustment function. params Additional parameters geom stat. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders. subset DEPRECATED. older way subsetting dataset used layer. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes.","code":""},{"path":"https://animint.github.io/animint2/reference/layer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a new layer — layer","text":"","code":"# geom calls are just a short cut for layer ggplot(mpg, aes(displ, hwy)) + geom_point() # shortcut for ggplot(mpg, aes(displ, hwy)) + layer(geom = \"point\", stat = \"identity\", position = \"identity\", params = list(na.rm = FALSE) ) # use a function as data to plot a subset of global data ggplot(mpg, aes(displ, hwy)) + layer(geom = \"point\", stat = \"identity\", position = \"identity\", data = head, params = list(na.rm = FALSE) )"},{"path":"https://animint.github.io/animint2/reference/limits.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate correct scale type for specified limits — limits","title":"Generate correct scale type for specified limits — limits","text":"Generate correct scale type specified limits","code":""},{"path":"https://animint.github.io/animint2/reference/limits.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate correct scale type for specified limits — limits","text":"","code":"limits(lims, var)"},{"path":"https://animint.github.io/animint2/reference/limits.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate correct scale type for specified limits — limits","text":"var name variable limits vector limits","code":""},{"path":"https://animint.github.io/animint2/reference/limits.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate correct scale type for specified limits — limits","text":"","code":"animint2:::limits(c(1, 5), \"x\") #> #> Range: #> Limits: 1 -- 5 animint2:::limits(c(5, 1), \"x\") #> #> Range: #> Limits: -5 -- -1 animint2:::limits(c(\"A\", \"b\", \"c\"), \"x\") #> #> aesthetics: x xmin xmax xend #> break_info: function #> break_positions: function #> breaks: waiver #> call: call #> clone: function #> dimension: function #> drop: TRUE #> expand: waiver #> get_breaks: function #> get_breaks_minor: function #> get_labels: function #> get_limits: function #> guide: none #> is_discrete: function #> is_empty: function #> labels: waiver #> limits: A b c #> map: function #> map_df: function #> na.value: NA #> name: waiver #> palette: function #> range: #> range: NULL #> reset: function #> train: function #> super: #> range_c: #> range: NULL #> reset: function #> train: function #> super: #> reset: function #> scale_name: position_d #> train: function #> train_df: function #> transform: function #> transform_df: function #> super: animint2:::limits(c(\"A\", \"b\", \"c\"), \"fill\") #> #> aesthetics: fill #> break_info: function #> break_positions: function #> breaks: waiver #> call: call #> clone: function #> dimension: function #> drop: TRUE #> expand: waiver #> get_breaks: function #> get_breaks_minor: function #> get_labels: function #> get_limits: function #> guide: legend #> is_discrete: function #> is_empty: function #> labels: waiver #> limits: A b c #> map: function #> map_df: function #> na.value: grey50 #> name: waiver #> palette: function #> range: #> range: NULL #> reset: function #> train: function #> super: #> reset: function #> scale_name: hue #> train: function #> train_df: function #> transform: function #> transform_df: function #> super: animint2:::limits(as.Date(c(\"2008-01-01\", \"2009-01-01\")), \"x\") #> #> Range: #> Limits: 1.39e+04 -- 1.42e+04"},{"path":"https://animint.github.io/animint2/reference/lims.html","id":null,"dir":"Reference","previous_headings":"","what":"Convenience functions to set the axis limits. — lims","title":"Convenience functions to set the axis limits. — lims","text":"Observations range dropped completely passed layers. NA value substituted one limits limit automatically calculated.","code":""},{"path":"https://animint.github.io/animint2/reference/lims.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convenience functions to set the axis limits. — lims","text":"","code":"lims(...) xlim(...) ylim(...)"},{"path":"https://animint.github.io/animint2/reference/lims.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convenience functions to set the axis limits. — lims","text":"... numeric, create continuous scale, factor character, create discrete scale. lims, every argument must named.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/lims.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convenience functions to set the axis limits. — lims","text":"","code":"# xlim xlim(15, 20) #> #> Range: #> Limits: 15 -- 20 xlim(20, 15) #> #> Range: #> Limits: -20 -- -15 xlim(c(10, 20)) #> #> Range: #> Limits: 10 -- 20 xlim(\"a\", \"b\", \"c\") #> #> aesthetics: x xmin xmax xend #> break_info: function #> break_positions: function #> breaks: waiver #> call: call #> clone: function #> dimension: function #> drop: TRUE #> expand: waiver #> get_breaks: function #> get_breaks_minor: function #> get_labels: function #> get_limits: function #> guide: none #> is_discrete: function #> is_empty: function #> labels: waiver #> limits: a b c #> map: function #> map_df: function #> na.value: NA #> name: waiver #> palette: function #> range: #> range: NULL #> reset: function #> train: function #> super: #> range_c: #> range: NULL #> reset: function #> train: function #> super: #> reset: function #> scale_name: position_d #> train: function #> train_df: function #> transform: function #> transform_df: function #> super: ggplot(mtcars, aes(mpg, wt)) + geom_point() + xlim(15, 20) #> Warning: Removed 19 rows containing missing values (geom_point). # with automatic lower limit ggplot(mtcars, aes(mpg, wt)) + geom_point() + xlim(NA, 20) #> Warning: Removed 14 rows containing missing values (geom_point). # Change both xlim and ylim ggplot(mtcars, aes(mpg, wt)) + geom_point() + lims(x = c(10, 20), y = c(3, 5)) #> Warning: Removed 18 rows containing missing values (geom_point)."},{"path":"https://animint.github.io/animint2/reference/luv_colours.html","id":null,"dir":"Reference","previous_headings":"","what":"colors() in Luv space. — luv_colours","title":"colors() in Luv space. — luv_colours","text":"built-colors() translated Luv colour space.","code":""},{"path":"https://animint.github.io/animint2/reference/luv_colours.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"colors() in Luv space. — luv_colours","text":"","code":"luv_colours"},{"path":"https://animint.github.io/animint2/reference/luv_colours.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"colors() in Luv space. — luv_colours","text":"data frame 657 observations 4 variables: L,u,vPosition Luv colour space colColour name","code":""},{"path":"https://animint.github.io/animint2/reference/make_bar.html","id":null,"dir":"Reference","previous_headings":"","what":"Convenience function for an interactive bar that might otherwise be\r\ncreated using stat_summary(geom=","title":"Convenience function for an interactive bar that might otherwise be\r\ncreated using stat_summary(geom=","text":"Convenience function interactive bar might otherwise created using stat_summary(geom=\"bar\").","code":""},{"path":"https://animint.github.io/animint2/reference/make_bar.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convenience function for an interactive bar that might otherwise be\r\ncreated using stat_summary(geom=","text":"","code":"make_bar(data, x.name, alpha = 1)"},{"path":"https://animint.github.io/animint2/reference/make_bar.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convenience function for an interactive bar that might otherwise be\r\ncreated using stat_summary(geom=","text":"data data.frame analyze unique x.name values. x.name variable used x, clickSelects. alpha transparency selected bar, default 1.","code":""},{"path":"https://animint.github.io/animint2/reference/make_bar.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convenience function for an interactive bar that might otherwise be\r\ncreated using stat_summary(geom=","text":"geom_bar layer.","code":""},{"path":"https://animint.github.io/animint2/reference/make_bar.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convenience function for an interactive bar that might otherwise be\r\ncreated using stat_summary(geom=","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a clickSelects geom_tallrect that completely tiles the x\r\nrange. This makes it easy to construct tallrects for the common\r\ncase of selecting a particular x value. — make_tallrect","title":"Make a clickSelects geom_tallrect that completely tiles the x\r\nrange. This makes it easy to construct tallrects for the common\r\ncase of selecting a particular x value. — make_tallrect","text":"Make clickSelects geom_tallrect completely tiles x range. makes easy construct tallrects common case selecting particular x value.","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a clickSelects geom_tallrect that completely tiles the x\r\nrange. This makes it easy to construct tallrects for the common\r\ncase of selecting a particular x value. — make_tallrect","text":"","code":"make_tallrect(data, x.name, even = FALSE, alpha = 1/2, ...)"},{"path":"https://animint.github.io/animint2/reference/make_tallrect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a clickSelects geom_tallrect that completely tiles the x\r\nrange. This makes it easy to construct tallrects for the common\r\ncase of selecting a particular x value. — make_tallrect","text":"data data.frame analyze unique x.name values. x.name variable used x, clickSelects. even Logical parameter, tallrects even width? alpha transparency selected tallrect, default 1/2. ... passed geom_tallrect.","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a clickSelects geom_tallrect that completely tiles the x\r\nrange. This makes it easy to construct tallrects for the common\r\ncase of selecting a particular x value. — make_tallrect","text":"geom_tallrect layer.","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a clickSelects geom_tallrect that completely tiles the x\r\nrange. This makes it easy to construct tallrects for the common\r\ncase of selecting a particular x value. — make_tallrect","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect_or_widerect.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a clickSelects geom_widerect or geom_tallrect that completely\r\ntiles the x or y range. This function is used internally by\r\nmake_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect","title":"Make a clickSelects geom_widerect or geom_tallrect that completely\r\ntiles the x or y range. This function is used internally by\r\nmake_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect","text":"Make clickSelects geom_widerect geom_tallrect completely tiles x y range. function used internally make_tallrect make_widerect, user-friendly.","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect_or_widerect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a clickSelects geom_widerect or geom_tallrect that completely\r\ntiles the x or y range. This function is used internally by\r\nmake_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect","text":"","code":"make_tallrect_or_widerect( aes.prefix, geom_xrect, data, var.name, even = FALSE, alpha = 0.5, ..., data.fun = identity )"},{"path":"https://animint.github.io/animint2/reference/make_tallrect_or_widerect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a clickSelects geom_widerect or geom_tallrect that completely\r\ntiles the x or y range. This function is used internally by\r\nmake_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect","text":"aes.prefix \"x\" \"y\" geom_xrect geom_tallrect geom_widerect data data.frame analyze unique var.name values. var.name variable used clickSelects even Logical parameter, xrects even width? alpha transparency selected xrect, default 1/2. ... passed geom_xrect data.fun called data passed geom_xrect(aes(..), data.fun(df)) useful facetted plots, adding columns data.frame, want geom one panel.","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect_or_widerect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a clickSelects geom_widerect or geom_tallrect that completely\r\ntiles the x or y range. This function is used internally by\r\nmake_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect","text":"geom_xrect layer","code":""},{"path":"https://animint.github.io/animint2/reference/make_tallrect_or_widerect.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a clickSelects geom_widerect or geom_tallrect that completely\r\ntiles the x or y range. This function is used internally by\r\nmake_tallrect or make_widerect, which are more user-friendly. — make_tallrect_or_widerect","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/make_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Convenvience function for a showSelected plot label. — make_text","title":"Convenvience function for a showSelected plot label. — make_text","text":"Convenvience function showSelected plot label.","code":""},{"path":"https://animint.github.io/animint2/reference/make_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convenvience function for a showSelected plot label. — make_text","text":"","code":"make_text(data, x, y, label.var, format = NULL)"},{"path":"https://animint.github.io/animint2/reference/make_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convenvience function for a showSelected plot label. — make_text","text":"data data.frame relevant data x x coordinate label position y y coordinate label position label.var variable matching showSelected, used obtain label value format String format label. Use %d, %f, etc. insert relevant label.var value.","code":""},{"path":"https://animint.github.io/animint2/reference/make_text.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convenvience function for a showSelected plot label. — make_text","text":"geom_text layer.","code":""},{"path":"https://animint.github.io/animint2/reference/make_text.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convenvience function for a showSelected plot label. — make_text","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/make_widerect.html","id":null,"dir":"Reference","previous_headings":"","what":"Make a clickSelects geom_widerect that completely tiles the y\r\nrange. This makes it easy to construct widerects for the common\r\ncase of selecting a particular y value. — make_widerect","title":"Make a clickSelects geom_widerect that completely tiles the y\r\nrange. This makes it easy to construct widerects for the common\r\ncase of selecting a particular y value. — make_widerect","text":"Make clickSelects geom_widerect completely tiles y range. makes easy construct widerects common case selecting particular y value.","code":""},{"path":"https://animint.github.io/animint2/reference/make_widerect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Make a clickSelects geom_widerect that completely tiles the y\r\nrange. This makes it easy to construct widerects for the common\r\ncase of selecting a particular y value. — make_widerect","text":"","code":"make_widerect(data, y.name, even = FALSE, alpha = 0.5, ...)"},{"path":"https://animint.github.io/animint2/reference/make_widerect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Make a clickSelects geom_widerect that completely tiles the y\r\nrange. This makes it easy to construct widerects for the common\r\ncase of selecting a particular y value. — make_widerect","text":"data data.frame analyze unique y.name values. y.name variable used y, clickSelects. even Logical parameter, widerects even width? alpha transparency selected widerect, default 1/2. ... passed geom_widerect.","code":""},{"path":"https://animint.github.io/animint2/reference/make_widerect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Make a clickSelects geom_widerect that completely tiles the y\r\nrange. This makes it easy to construct widerects for the common\r\ncase of selecting a particular y value. — make_widerect","text":"geom_widerect layer.","code":""},{"path":"https://animint.github.io/animint2/reference/make_widerect.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Make a clickSelects geom_widerect that completely tiles the y\r\nrange. This makes it easy to construct widerects for the common\r\ncase of selecting a particular y value. — make_widerect","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/malaria.html","id":null,"dir":"Reference","previous_headings":"","what":"Malaria parasite genome variants — malaria","title":"Malaria parasite genome variants — malaria","text":"Two sequencing methods used measure genetic variants malaria parasite yoelii yoelii, strain N67. High quality gold standard Sanger sequences obtained 45 amplicons, small subset 14-chromosome genome. Next generation sequencing (NGS) used find genome-wide variants, lot noise false positive variants need filtered via thresholding MQ score.","code":""},{"path":"https://animint.github.io/animint2/reference/malaria.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Malaria parasite genome variants — malaria","text":"","code":"data(\"malaria\")"},{"path":"https://animint.github.io/animint2/reference/malaria.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Malaria parasite genome variants — malaria","text":"List 8 data.frames: $ error.variants :'data.frame':\t18800 obs. 19 variables: $ regions :'data.frame':\t14 obs. 6 variables: $ amplicons :'data.frame':\t45 obs. 8 variables: $ chroms :'data.frame':\t14 obs. 2 variables: $ error.amplicons :'data.frame':\t1800 obs. 11 variables: $ filterVar.labels:'data.frame':\t40 obs. 3 variables: $ error.curves :'data.frame':\t120 obs. 4 variables: $ filterVar :'data.frame':\t1 obs. 2 variables:","code":""},{"path":"https://animint.github.io/animint2/reference/malaria.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Malaria parasite genome variants — malaria","text":"https://github.com/tdhock/malaria-evolution-viz","code":""},{"path":"https://animint.github.io/animint2/reference/map_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a data frame of map data. — map_data","title":"Create a data frame of map data. — map_data","text":"Create data frame map data.","code":""},{"path":"https://animint.github.io/animint2/reference/map_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a data frame of map data. — map_data","text":"","code":"map_data(map, region = \".\", exact = FALSE, ...)"},{"path":"https://animint.github.io/animint2/reference/map_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a data frame of map data. — map_data","text":"map name map provided maps package. include county, france, italy, nz, state, usa, world, world2. region name subregions include. Defaults . includes subregion. See documentation map details. exact region treated regular expression (FALSE) fixed string (TRUE). ... arguments passed map","code":""},{"path":"https://animint.github.io/animint2/reference/map_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a data frame of map data. — map_data","text":"","code":"if (require(\"maps\")) { states <- map_data(\"state\") arrests <- USArrests names(arrests) <- tolower(names(arrests)) arrests$region <- tolower(rownames(USArrests)) choro <- merge(states, arrests, sort = FALSE, by = \"region\") choro <- choro[order(choro$order), ] ggplot(choro, aes(long, lat)) + geom_polygon(aes(group = group, fill = assault)) + coord_map(\"albers\", at0 = 45.5, lat1 = 29.5) ggplot(choro, aes(long, lat)) + geom_polygon(aes(group = group, fill = assault / murder)) + coord_map(\"albers\", at0 = 45.5, lat1 = 29.5) }"},{"path":"https://animint.github.io/animint2/reference/margin.html","id":null,"dir":"Reference","previous_headings":"","what":"Define margins. — margin","title":"Define margins. — margin","text":"convenient function creates grid unit object correct length use setting margins.","code":""},{"path":"https://animint.github.io/animint2/reference/margin.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Define margins. — margin","text":"","code":"margin(t = 0, r = 0, b = 0, l = 0, unit = \"pt\")"},{"path":"https://animint.github.io/animint2/reference/margin.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Define margins. — margin","text":"t, r, b, l Dimensions margin. (remember order, think trouble). unit Default units dimensions. Defaults \"pt\" can easily scaled text.","code":""},{"path":"https://animint.github.io/animint2/reference/margin.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Define margins. — margin","text":"","code":"margin(4) #> [1] 4points 0points 0points 0points margin(4, 2) #> [1] 4points 2points 0points 0points margin(4, 3, 2, 1) #> [1] 4points 3points 2points 1points"},{"path":"https://animint.github.io/animint2/reference/mean_se.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate mean and standard errors on either side. — mean_se","title":"Calculate mean and standard errors on either side. — mean_se","text":"Calculate mean standard errors either side.","code":""},{"path":"https://animint.github.io/animint2/reference/mean_se.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate mean and standard errors on either side. — mean_se","text":"","code":"mean_se(x, mult = 1)"},{"path":"https://animint.github.io/animint2/reference/mean_se.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate mean and standard errors on either side. — mean_se","text":"x numeric vector mult number multiples standard error","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/merge_recurse.html","id":null,"dir":"Reference","previous_headings":"","what":"Merge a list of data frames. — merge_recurse","title":"Merge a list of data frames. — merge_recurse","text":"Merge list data frames.","code":""},{"path":"https://animint.github.io/animint2/reference/merge_recurse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Merge a list of data frames. — merge_recurse","text":"","code":"merge_recurse(dfs)"},{"path":"https://animint.github.io/animint2/reference/merge_recurse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Merge a list of data frames. — merge_recurse","text":"dfs list data frames","code":""},{"path":"https://animint.github.io/animint2/reference/merge_recurse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Merge a list of data frames. — merge_recurse","text":"data frame","code":""},{"path":"https://animint.github.io/animint2/reference/midwest.html","id":null,"dir":"Reference","previous_headings":"","what":"Midwest demographics. — midwest","title":"Midwest demographics. — midwest","text":"Demographic information midwest counties","code":""},{"path":"https://animint.github.io/animint2/reference/midwest.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Midwest demographics. — midwest","text":"","code":"midwest"},{"path":"https://animint.github.io/animint2/reference/midwest.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Midwest demographics. — midwest","text":"data frame 437 rows 28 variables PID county state area poptotal. Total population popdensity. Population density popwhite. Number whites. popblack. Number blacks. popamerindian. Number American Indians. popasian. Number Asians. popother. Number races. percwhite. Percent white. percblack. Percent black. percamerindan. Percent American Indian. percasian. Percent Asian. percother. Percent races. popadults. Number adults. perchsd. percollege. Percent college educated. percprof. Percent profession. poppovertyknown. percpovertyknown percbelowpoverty percchildbelowpovert percadultpoverty percelderlypoverty inmetro. metro area. category'","code":""},{"path":"https://animint.github.io/animint2/reference/mixtureKNN.html","id":null,"dir":"Reference","previous_headings":"","what":"K-Nearest-Neighbors model of the mixture example data — mixtureKNN","title":"K-Nearest-Neighbors model of the mixture example data — mixtureKNN","text":"Several KNN models fit mixture example data set.","code":""},{"path":"https://animint.github.io/animint2/reference/mixtureKNN.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"K-Nearest-Neighbors model of the mixture example data — mixtureKNN","text":"","code":"data(\"mixtureKNN\")"},{"path":"https://animint.github.io/animint2/reference/mixtureKNN.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"K-Nearest-Neighbors model of the mixture example data — mixtureKNN","text":"Named list 9 data.frames.","code":""},{"path":"https://animint.github.io/animint2/reference/mixtureKNN.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"K-Nearest-Neighbors model of the mixture example data — mixtureKNN","text":"animint/inst/examples/knn.R","code":""},{"path":"https://animint.github.io/animint2/reference/mixtureKNN.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"K-Nearest-Neighbors model of the mixture example data — mixtureKNN","text":"help(mixture.example, package=\"ElemStatLearn\")","code":""},{"path":"https://animint.github.io/animint2/reference/montreal.bikes.html","id":null,"dir":"Reference","previous_headings":"","what":"Montreal bikes — montreal.bikes","title":"Montreal bikes — montreal.bikes","text":"Data montreal bike usage, paths, accidents, 2009-2014.","code":""},{"path":"https://animint.github.io/animint2/reference/montreal.bikes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Montreal bikes — montreal.bikes","text":"","code":"data(\"montreal.bikes\")"},{"path":"https://animint.github.io/animint2/reference/montreal.bikes.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Montreal bikes — montreal.bikes","text":"named list four data.frames. counter.counts contains dates counts bikes several locations Montreal. counter.locations geographical coordinates counter locations. path.locations geographical coordinates several Montreal bike paths. accidents dates/times/locations/severity accidents involving bikes.","code":""},{"path":"https://animint.github.io/animint2/reference/montreal.bikes.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Montreal bikes — montreal.bikes","text":"github.com/tdhock/montreal-velos","code":""},{"path":"https://animint.github.io/animint2/reference/mpg.html","id":null,"dir":"Reference","previous_headings":"","what":"Fuel economy data from 1999 and 2008 for 38 popular models of car — mpg","title":"Fuel economy data from 1999 and 2008 for 38 popular models of car — mpg","text":"dataset contains subset fuel economy data EPA makes available https://fueleconomy.gov. contains models new release every year 1999 2008 - used proxy popularity car.","code":""},{"path":"https://animint.github.io/animint2/reference/mpg.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fuel economy data from 1999 and 2008 for 38 popular models of car — mpg","text":"","code":"mpg"},{"path":"https://animint.github.io/animint2/reference/mpg.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Fuel economy data from 1999 and 2008 for 38 popular models of car — mpg","text":"data frame 234 rows 11 variables manufacturer. model. displ. engine displacement, litres year. cyl. number cylinders trans. type transmission drv. f = front-wheel drive, r = rear wheel drive, 4 = 4wd cty. city miles per gallon hwy. highway miles per gallon fl. class.","code":""},{"path":"https://animint.github.io/animint2/reference/msleep.html","id":null,"dir":"Reference","previous_headings":"","what":"An updated and expanded version of the mammals sleep dataset. — msleep","title":"An updated and expanded version of the mammals sleep dataset. — msleep","text":"updated expanded version mammals sleep dataset. Updated sleep times weights taken V. M. Savage G. B. West. quantitative, theoretical framework understanding mammalian sleep. Proceedings National Academy Sciences, 104 (3):1051-1056, 2007.","code":""},{"path":"https://animint.github.io/animint2/reference/msleep.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"An updated and expanded version of the mammals sleep dataset. — msleep","text":"","code":"msleep"},{"path":"https://animint.github.io/animint2/reference/msleep.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"An updated and expanded version of the mammals sleep dataset. — msleep","text":"data frame 83 rows 11 variables name. common name genus. vore. carnivore, omnivore herbivore? order. conservation. conservation status animal sleep_total. total amount sleep, hours sleep_rem. rem sleep, hours sleep_cycle. length sleep cycle, hours awake. amount time spent awake, hours brainwt. brain weight kilograms bodywt. body weight kilograms","code":""},{"path":"https://animint.github.io/animint2/reference/msleep.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"An updated and expanded version of the mammals sleep dataset. — msleep","text":"Additional variables order, conservation status vore added wikipedia.","code":""},{"path":"https://animint.github.io/animint2/reference/newEnvironment.html","id":null,"dir":"Reference","previous_headings":"","what":"Environment to store meta data — newEnvironment","title":"Environment to store meta data — newEnvironment","text":"Get new environment store meta-data. Used alter state lower-level functions","code":""},{"path":"https://animint.github.io/animint2/reference/newEnvironment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Environment to store meta data — newEnvironment","text":"","code":"newEnvironment()"},{"path":"https://animint.github.io/animint2/reference/newEnvironment.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Environment to store meta data — newEnvironment","text":"new environment store meta data","code":""},{"path":"https://animint.github.io/animint2/reference/parsePlot.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a ggplot to a list. — parsePlot","title":"Convert a ggplot to a list. — parsePlot","text":"Convert ggplot list.","code":""},{"path":"https://animint.github.io/animint2/reference/parsePlot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a ggplot to a list. — parsePlot","text":"","code":"parsePlot(meta, plot, plot.name)"},{"path":"https://animint.github.io/animint2/reference/parsePlot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a ggplot to a list. — parsePlot","text":"meta environment previously calculated plot data, new plot parse, already stored plot plot.name. plot ggplot list object plot.name name plot","code":""},{"path":"https://animint.github.io/animint2/reference/parsePlot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a ggplot to a list. — parsePlot","text":"nothing, info stored meta.","code":""},{"path":"https://animint.github.io/animint2/reference/PeakConsistency.html","id":null,"dir":"Reference","previous_headings":"","what":"Consistency of segmentation models in simulated Poisson peaks — PeakConsistency","title":"Consistency of segmentation models in simulated Poisson peaks — PeakConsistency","text":"4 seed ten samples, sequence noisy Poisson data generated, PeakSeg PeakSegJoint used detect peak.","code":""},{"path":"https://animint.github.io/animint2/reference/PeakConsistency.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Consistency of segmentation models in simulated Poisson peaks — PeakConsistency","text":"","code":"data(\"PeakConsistency\")"},{"path":"https://animint.github.io/animint2/reference/PeakConsistency.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Consistency of segmentation models in simulated Poisson peaks — PeakConsistency","text":"list four data.frames: model, truth, signal, guess.","code":""},{"path":"https://animint.github.io/animint2/reference/PeakConsistency.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Consistency of segmentation models in simulated Poisson peaks — PeakConsistency","text":"https://github.com/tdhock/PeakSegJoint-paper/blob/master/figure-consistency.R","code":""},{"path":"https://animint.github.io/animint2/reference/pirates.html","id":null,"dir":"Reference","previous_headings":"","what":"Worldwide pirate attacks from 1978 to 2013 — pirates","title":"Worldwide pirate attacks from 1978 to 2013 — pirates","text":"row 1 pirate attack, geographic location textual descriptions.","code":""},{"path":"https://animint.github.io/animint2/reference/pirates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Worldwide pirate attacks from 1978 to 2013 — pirates","text":"","code":"data(pirates)"},{"path":"https://animint.github.io/animint2/reference/pirates.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Worldwide pirate attacks from 1978 to 2013 — pirates","text":"data frame 6636 observations following 14 variables. Reference factor DateOfOcc Date SubReg factor Aggressor factor Victim factor Descript factor Desc1 factor Desc2 factor Desc3 factor Desc4 factor Desc5 factor Desc6 factor coords.x1 numeric vector coords.x2 numeric vector","code":""},{"path":"https://animint.github.io/animint2/reference/pirates.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Worldwide pirate attacks from 1978 to 2013 — pirates","text":"http://msi.nga.mil/MSISiteContent/StaticFiles/Files/ASAM_shp.zip","code":""},{"path":"https://animint.github.io/animint2/reference/position_dodge.html","id":null,"dir":"Reference","previous_headings":"","what":"Adjust position by dodging overlaps to the side. — position_dodge","title":"Adjust position by dodging overlaps to the side. — position_dodge","text":"Adjust position dodging overlaps side.","code":""},{"path":"https://animint.github.io/animint2/reference/position_dodge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Adjust position by dodging overlaps to the side. — position_dodge","text":"","code":"position_dodge(width = NULL)"},{"path":"https://animint.github.io/animint2/reference/position_dodge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Adjust position by dodging overlaps to the side. — position_dodge","text":"width Dodging width, different width individual elements. useful want align narrow geoms wider geoms. See examples use case.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/position_dodge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Adjust position by dodging overlaps to the side. — position_dodge","text":"","code":"ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar(position = \"dodge\") # \\donttest{ ggplot(diamonds, aes(price, fill = cut)) + geom_histogram(position=\"dodge\") #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. # To dodge items with different widths, you need to be explicit df <- data.frame(x = c(\"a\",\"a\",\"b\",\"b\"), y = 2:5, g = rep(1:2, 2)) p <- ggplot(df, aes(x, y, group = g)) + geom_bar( stat = \"identity\", position = \"dodge\", fill = \"grey50\", colour = \"black\" ) p # A line range has no width: p + geom_linerange(aes(ymin = y-1, ymax = y+1), position = \"dodge\") #> Warning: Width not defined. Set with `position_dodge(width = ?)` # You need to explicitly specify the width for dodging p + geom_linerange(aes(ymin = y-1, ymax = y+1), position = position_dodge(width = 0.9)) # Similarly with error bars: p + geom_errorbar(aes(ymin = y-1, ymax = y+1), width = 0.2, position = \"dodge\") p + geom_errorbar(aes(ymin = y-1, ymax = y+1, width = 0.2), position = position_dodge(width = 0.90)) # }"},{"path":"https://animint.github.io/animint2/reference/position_identity.html","id":null,"dir":"Reference","previous_headings":"","what":"Don't adjust position — position_identity","title":"Don't adjust position — position_identity","text":"adjust position","code":""},{"path":"https://animint.github.io/animint2/reference/position_identity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Don't adjust position — position_identity","text":"","code":"position_identity()"},{"path":[]},{"path":"https://animint.github.io/animint2/reference/position_jitter.html","id":null,"dir":"Reference","previous_headings":"","what":"Jitter points to avoid overplotting. — position_jitter","title":"Jitter points to avoid overplotting. — position_jitter","text":"Jitter points avoid overplotting.","code":""},{"path":"https://animint.github.io/animint2/reference/position_jitter.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Jitter points to avoid overplotting. — position_jitter","text":"","code":"position_jitter(width = NULL, height = NULL)"},{"path":"https://animint.github.io/animint2/reference/position_jitter.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Jitter points to avoid overplotting. — position_jitter","text":"width, height Amount vertical horizontal jitter. jitter added positive negative directions, total spread twice value specified . omitted, defaults 40% resolution data: means jitter values occupy 80% implied bins. Categorical data aligned integers, width height 0.5 spread data possible see distinction categories.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/position_jitter.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Jitter points to avoid overplotting. — position_jitter","text":"","code":"ggplot(mtcars, aes(am, vs)) + geom_point() # Default amount of jittering will generally be too much for # small datasets: ggplot(mtcars, aes(am, vs)) + geom_jitter() # Two ways to override ggplot(mtcars, aes(am, vs)) + geom_jitter(width = 0.1, height = 0.1) ggplot(mtcars, aes(am, vs)) + geom_jitter(position = position_jitter(width = 0.1, height = 0.1))"},{"path":"https://animint.github.io/animint2/reference/position_jitterdodge.html","id":null,"dir":"Reference","previous_headings":"","what":"Adjust position by simultaneously dodging and jittering — position_jitterdodge","title":"Adjust position by simultaneously dodging and jittering — position_jitterdodge","text":"Adjust position simultaneously dodging jittering","code":""},{"path":"https://animint.github.io/animint2/reference/position_jitterdodge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Adjust position by simultaneously dodging and jittering — position_jitterdodge","text":"","code":"position_jitterdodge( jitter.width = NULL, jitter.height = 0, dodge.width = 0.75 )"},{"path":"https://animint.github.io/animint2/reference/position_jitterdodge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Adjust position by simultaneously dodging and jittering — position_jitterdodge","text":"jitter.width degree jitter x direction. Defaults 40% resolution data. jitter.height degree jitter y direction. Defaults 0. dodge.width amount dodge x direction. Defaults 0.75, default position_dodge() width.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/position_nudge.html","id":null,"dir":"Reference","previous_headings":"","what":"Nudge points. — position_nudge","title":"Nudge points. — position_nudge","text":"useful want nudge labels little ways points.","code":""},{"path":"https://animint.github.io/animint2/reference/position_nudge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Nudge points. — position_nudge","text":"","code":"position_nudge(x = 0, y = 0)"},{"path":"https://animint.github.io/animint2/reference/position_nudge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Nudge points. — position_nudge","text":"x, y Amount vertical horizontal distance move.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/position_nudge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Nudge points. — position_nudge","text":"","code":"df <- data.frame( x = c(1,3,2,5), y = c(\"a\",\"c\",\"d\",\"c\") ) ggplot(df, aes(x, y)) + geom_point() + geom_text(aes(label = y)) ggplot(df, aes(x, y)) + geom_point() + geom_text(aes(label = y), position = position_nudge(y = -0.1))"},{"path":"https://animint.github.io/animint2/reference/position_stack.html","id":null,"dir":"Reference","previous_headings":"","what":"Stack overlapping objects on top of one another. — position_fill","title":"Stack overlapping objects on top of one another. — position_fill","text":"position_fill additionally standardises stack unit height.","code":""},{"path":"https://animint.github.io/animint2/reference/position_stack.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stack overlapping objects on top of one another. — position_fill","text":"","code":"position_fill() position_stack()"},{"path":[]},{"path":"https://animint.github.io/animint2/reference/position_stack.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stack overlapping objects on top of one another. — position_fill","text":"","code":"# Stacking is the default behaviour for most area plots: ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar() # Fill makes it easier to compare proportions ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar(position = \"fill\") # To change stacking order, use factor() to change order of levels mtcars$vs <- factor(mtcars$vs, levels = c(1,0)) ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar() ggplot(diamonds, aes(price, fill = cut)) + geom_histogram(binwidth = 500) # When used with a histogram, position_fill creates a conditional density # estimate ggplot(diamonds, aes(price, fill = cut)) + geom_histogram(binwidth = 500, position = \"fill\") # Stacking is also useful for time series data.set <- data.frame( Time = c(rep(1, 4),rep(2, 4), rep(3, 4), rep(4, 4)), Type = rep(c('a', 'b', 'c', 'd'), 4), Value = rpois(16, 10) ) ggplot(data.set, aes(Time, Value)) + geom_area(aes(fill = Type)) # If you want to stack lines, you need to say so: ggplot(data.set, aes(Time, Value)) + geom_line(aes(colour = Type)) ggplot(data.set, aes(Time, Value)) + geom_line(position = \"stack\", aes(colour = Type)) # But realise that this makes it *much* harder to compare individual # trends"},{"path":"https://animint.github.io/animint2/reference/presidential.html","id":null,"dir":"Reference","previous_headings":"","what":"Terms of 11 presidents from Eisenhower to Obama. — presidential","title":"Terms of 11 presidents from Eisenhower to Obama. — presidential","text":"names president, start end date term, party 11 US presidents Eisenhower Obama.","code":""},{"path":"https://animint.github.io/animint2/reference/presidential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Terms of 11 presidents from Eisenhower to Obama. — presidential","text":"","code":"presidential"},{"path":"https://animint.github.io/animint2/reference/presidential.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Terms of 11 presidents from Eisenhower to Obama. — presidential","text":"data frame 11 rows 4 variables","code":""},{"path":"https://animint.github.io/animint2/reference/print.animint.html","id":null,"dir":"Reference","previous_headings":"","what":"print animint — print.animint","title":"print animint — print.animint","text":"Print animint rendering local directory.","code":""},{"path":"https://animint.github.io/animint2/reference/print.animint.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print animint — print.animint","text":"","code":"# S3 method for animint print(x, ...)"},{"path":"https://animint.github.io/animint2/reference/print.animint.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print animint — print.animint","text":"x List ggplots options. particular .dir option passed along animint2dir. ... passed animint2dir","code":""},{"path":"https://animint.github.io/animint2/reference/print.animint.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"print animint — print.animint","text":"animint2dir","code":""},{"path":"https://animint.github.io/animint2/reference/print.animint.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print animint — print.animint","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/print.gganimintplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw plot on current graphics device. — print.gganimintplot","title":"Draw plot on current graphics device. — print.gganimintplot","text":"Draw plot current graphics device.","code":""},{"path":"https://animint.github.io/animint2/reference/print.gganimintplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw plot on current graphics device. — print.gganimintplot","text":"","code":"# S3 method for gganimintplot print(x, newpage = is.null(vp), vp = NULL, ...) # S3 method for gganimintplot plot(x, newpage = is.null(vp), vp = NULL, ...)"},{"path":"https://animint.github.io/animint2/reference/print.gganimintplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw plot on current graphics device. — print.gganimintplot","text":"x plot display newpage draw new (empty) page first? vp viewport draw plot ... arguments used method","code":""},{"path":"https://animint.github.io/animint2/reference/print.gganimintplot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw plot on current graphics device. — print.gganimintplot","text":"Invisibly returns result ggplot_build, list components contain plot , data, information scales, panels etc.","code":""},{"path":"https://animint.github.io/animint2/reference/print.gganimintproto.html","id":null,"dir":"Reference","previous_headings":"","what":"Print a gganimintproto object — print.gganimintproto","title":"Print a gganimintproto object — print.gganimintproto","text":"gganimintproto object $print method, call method. Otherwise, print members object, optionally, members inherited objects.","code":""},{"path":"https://animint.github.io/animint2/reference/print.gganimintproto.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print a gganimintproto object — print.gganimintproto","text":"","code":"# S3 method for gganimintproto print(x, ..., flat = TRUE)"},{"path":"https://animint.github.io/animint2/reference/print.gganimintproto.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print a gganimintproto object — print.gganimintproto","text":"x gganimintproto object print. ... gganimintproto object print method, arguments passed . Otherwise, arguments unused. flat TRUE (default), show flattened list local inherited members. FALSE, show inheritance hierarchy.","code":""},{"path":"https://animint.github.io/animint2/reference/prior.html","id":null,"dir":"Reference","previous_headings":"","what":"Class prior change — prior","title":"Class prior change — prior","text":"Performance several class prior change models studied across 4 data sets.","code":""},{"path":"https://animint.github.io/animint2/reference/prior.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Class prior change — prior","text":"","code":"data(prior)"},{"path":"https://animint.github.io/animint2/reference/prior.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Class prior change — prior","text":"List 2 data.frames: accuracy contains mean standard error performance measures (sqErr accuracy), data.set.info contains meta-data dimension number positive negative examples data set.","code":""},{"path":"https://animint.github.io/animint2/reference/prior.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Class prior change — prior","text":"MC du Plessis, personal communication.","code":""},{"path":"https://animint.github.io/animint2/reference/prior.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Class prior change — prior","text":"du Plessis MC, Sugiyama M. Semi-Supervised Learning Class Balance Class-Prior Change Distribution Matching. ICML 2012.","code":""},{"path":"https://animint.github.io/animint2/reference/prostateLasso.html","id":null,"dir":"Reference","previous_headings":"","what":"Lasso model of the prostate cancer data set — prostateLasso","title":"Lasso model of the prostate cancer data set — prostateLasso","text":"lars package used obtain full path lasso solutions.","code":""},{"path":"https://animint.github.io/animint2/reference/prostateLasso.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lasso model of the prostate cancer data set — prostateLasso","text":"","code":"data(\"prostateLasso\")"},{"path":"https://animint.github.io/animint2/reference/prostateLasso.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Lasso model of the prostate cancer data set — prostateLasso","text":"list 4 data.frames: path piecewise linear coefficient path, residuals prediction error every model every data point, models one row per regularization parameter, error total train/validation prediction error regularization parameter.","code":""},{"path":"https://animint.github.io/animint2/reference/prostateLasso.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Lasso model of the prostate cancer data set — prostateLasso","text":"https://github.com/tdhock/animint-book/blob/master/Ch11-lasso.Rmd","code":""},{"path":"https://animint.github.io/animint2/reference/pt.to.lines.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert pt value to lines — pt.to.lines","title":"Convert pt value to lines — pt.to.lines","text":"Convert pt value lines","code":""},{"path":"https://animint.github.io/animint2/reference/pt.to.lines.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert pt value to lines — pt.to.lines","text":"","code":"pt.to.lines(pt_value)"},{"path":"https://animint.github.io/animint2/reference/pt.to.lines.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert pt value to lines — pt.to.lines","text":"pt_value Value pt converted lines","code":""},{"path":"https://animint.github.io/animint2/reference/pt.to.lines.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert pt value to lines — pt.to.lines","text":"Value lines","code":""},{"path":"https://animint.github.io/animint2/reference/pt.to.lines.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Convert pt value to lines — pt.to.lines","text":"work input pt. Input returned .","code":""},{"path":"https://animint.github.io/animint2/reference/qplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Quick plot — qplot","title":"Quick plot — qplot","text":"qplot basic plotting function ggplot2 package, designed familiar used base plot(). convenient wrapper creating number different types plots using consistent calling scheme.","code":""},{"path":"https://animint.github.io/animint2/reference/qplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Quick plot — qplot","text":"","code":"qplot( x, y = NULL, ..., data, facets = NULL, margins = FALSE, geom = \"auto\", xlim = c(NA, NA), ylim = c(NA, NA), log = \"\", main = NULL, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), asp = NA, stat = NULL, position = NULL ) quickplot( x, y = NULL, ..., data, facets = NULL, margins = FALSE, geom = \"auto\", xlim = c(NA, NA), ylim = c(NA, NA), log = \"\", main = NULL, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), asp = NA, stat = NULL, position = NULL )"},{"path":"https://animint.github.io/animint2/reference/qplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Quick plot — qplot","text":"x, y, ... Aesthetics passed layer data Data frame use (optional). specified, create one, extracting vectors current environment. facets faceting formula use. Picks facet_wrap facet_grid depending whether formula one- two-sided margins See facet_grid: display marginal facets? geom Character vector specifying geom(s) draw. Defaults \"point\" x y specified, \"histogram\" x specified. xlim, ylim X y axis limits log variables log transform (\"x\", \"y\", \"xy\") main, xlab, ylab Character vector (expression) giving plot title, x axis label, y axis label respectively. asp y/x aspect ratio stat, position DEPRECATED.","code":""},{"path":"https://animint.github.io/animint2/reference/qplot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Quick plot — qplot","text":"","code":"# Use data from data.frame qplot(mpg, wt, data = mtcars) qplot(mpg, wt, data = mtcars, colour = cyl) qplot(mpg, wt, data = mtcars, size = cyl) qplot(mpg, wt, data = mtcars, facets = vs ~ am) # \\donttest{ qplot(1:10, rnorm(10), colour = runif(10)) qplot(1:10, letters[1:10]) mod <- lm(mpg ~ wt, data = mtcars) qplot(resid(mod), fitted(mod)) f <- function() { a <- 1:10 b <- a ^ 2 qplot(a, b) } f() # To set aesthetics, wrap in I() qplot(mpg, wt, data = mtcars, colour = I(\"red\")) # qplot will attempt to guess what geom you want depending on the input # both x and y supplied = scatterplot qplot(mpg, wt, data = mtcars) # just x supplied = histogram qplot(mpg, data = mtcars) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. # just y supplied = scatterplot, with x = seq_along(y) qplot(y = mpg, data = mtcars) #> Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. #> Don't know how to automatically pick scale for object of type quosure/formula. Defaulting to continuous. #> Error: Aesthetics must be either length 1 or the same as the data (32): y, x # Use different geoms qplot(mpg, wt, data = mtcars, geom = \"path\") qplot(mpg, data = mtcars, geom = \"dotplot\") #> `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`. #> Warning: Unit type of dotdia should be 'npc' # }"},{"path":"https://animint.github.io/animint2/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. grid arrow, unit scales alpha","code":""},{"path":"https://animint.github.io/animint2/reference/reexports.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Objects exported from other packages — reexports","text":"","code":"ggplot(mpg, aes(displ, hwy)) + geom_point(alpha = 0.5, colour = \"blue\") ggplot(mpg, aes(displ, hwy)) + geom_point(colour = alpha(\"blue\", 0.5))"},{"path":"https://animint.github.io/animint2/reference/rel.html","id":null,"dir":"Reference","previous_headings":"","what":"Relative sizing for theme elements — rel","title":"Relative sizing for theme elements — rel","text":"Relative sizing theme elements","code":""},{"path":"https://animint.github.io/animint2/reference/rel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Relative sizing for theme elements — rel","text":"","code":"rel(x)"},{"path":"https://animint.github.io/animint2/reference/rel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Relative sizing for theme elements — rel","text":"x number representing relative size","code":""},{"path":"https://animint.github.io/animint2/reference/rel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Relative sizing for theme elements — rel","text":"","code":"df <- data.frame(x = 1:3, y = 1:3) ggplot(df, aes(x, y)) + geom_point() + theme(axis.title.x = element_text(size = rel(2.5)))"},{"path":"https://animint.github.io/animint2/reference/remove_missing.html","id":null,"dir":"Reference","previous_headings":"","what":"Convenience function to remove missing values from a data.frame — remove_missing","title":"Convenience function to remove missing values from a data.frame — remove_missing","text":"Remove non-complete rows, warning na.rm = FALSE. ggplot somewhat accommodating missing values R generally. stats require complete data, missing values automatically removed warning. na.rm = TRUE supplied statistic, warning suppressed.","code":""},{"path":"https://animint.github.io/animint2/reference/remove_missing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convenience function to remove missing values from a data.frame — remove_missing","text":"","code":"remove_missing(df, na.rm = FALSE, vars = names(df), name = \"\", finite = FALSE)"},{"path":"https://animint.github.io/animint2/reference/remove_missing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convenience function to remove missing values from a data.frame — remove_missing","text":"df data.frame na.rm true, suppress warning message. vars Character vector variables check missings name Optional function name improve error message. finite TRUE, also remove non-finite values.","code":""},{"path":"https://animint.github.io/animint2/reference/renderAnimint.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an animint output element — renderAnimint","title":"Create an animint output element — renderAnimint","text":"Shiny server output function customized animint plots (similar shiny::plotOutput friends).","code":""},{"path":"https://animint.github.io/animint2/reference/renderAnimint.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an animint output element — renderAnimint","text":"","code":"renderAnimint(expr, env = parent.frame(), quoted = FALSE)"},{"path":"https://animint.github.io/animint2/reference/renderAnimint.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an animint output element — renderAnimint","text":"expr expression creates list ggplot objects. env environment evaluate expr. quoted expr quoted expression (quote())? useful want save expression variable.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/resolution.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the ","title":"Compute the ","text":"resolution smallest non-zero distance adjacent values. one unique value, resolution defined one.","code":""},{"path":"https://animint.github.io/animint2/reference/resolution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the ","text":"","code":"resolution(x, zero = TRUE)"},{"path":"https://animint.github.io/animint2/reference/resolution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the ","text":"x numeric vector zero zero value automatically included computation resolution","code":""},{"path":"https://animint.github.io/animint2/reference/resolution.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the ","text":"x integer vector, assumed represent discrete variable, resolution 1.","code":""},{"path":"https://animint.github.io/animint2/reference/resolution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the ","text":"","code":"resolution(1:10) #> [1] 1 resolution((1:10) - 0.5) #> [1] 0.5 resolution((1:10) - 0.5, FALSE) #> [1] 1 resolution(c(1,2, 10, 20, 50)) #> [1] 1 resolution(as.integer(c(1, 10, 20, 50))) # Returns 1 #> [1] 1"},{"path":"https://animint.github.io/animint2/reference/saveChunks.html","id":null,"dir":"Reference","previous_headings":"","what":"Split data set into chunks and save them to separate files. — saveChunks","title":"Split data set into chunks and save them to separate files. — saveChunks","text":"Split data set chunks save separate files.","code":""},{"path":"https://animint.github.io/animint2/reference/saveChunks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Split data set into chunks and save them to separate files. — saveChunks","text":"","code":"saveChunks(x, meta)"},{"path":"https://animint.github.io/animint2/reference/saveChunks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Split data set into chunks and save them to separate files. — saveChunks","text":"x data.frame. meta environment.","code":""},{"path":"https://animint.github.io/animint2/reference/saveChunks.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Split data set into chunks and save them to separate files. — saveChunks","text":"recursive list chunk file names.","code":""},{"path":"https://animint.github.io/animint2/reference/saveChunks.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Split data set into chunks and save them to separate files. — saveChunks","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/scale_alpha.html","id":null,"dir":"Reference","previous_headings":"","what":"Alpha scales. — scale_alpha","title":"Alpha scales. — scale_alpha","text":"scale_alpha alias scale_alpha_continuous since common use alpha, saves bit typing.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_alpha.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Alpha scales. — scale_alpha","text":"","code":"scale_alpha(..., range = c(0.1, 1)) scale_alpha_continuous(..., range = c(0.1, 1)) scale_alpha_discrete(..., range = c(0.1, 1))"},{"path":"https://animint.github.io/animint2/reference/scale_alpha.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Alpha scales. — scale_alpha","text":"... arguments passed continuous_scale discrete_scale appropriate, control name, limits, breaks, labels forth. range range output alpha values. lie 0 1.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_alpha.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Alpha scales. — scale_alpha","text":"","code":"(p <- ggplot(mtcars, aes(mpg, cyl)) + geom_point(aes(alpha = cyl))) p + scale_alpha(\"cylinders\") p + scale_alpha(\"number\\nof\\ncylinders\") p + scale_alpha(range = c(0.4, 0.8)) (p <- ggplot(mtcars, aes(mpg, cyl)) + geom_point(aes(alpha = factor(cyl)))) p + scale_alpha_discrete(range = c(0.4, 0.8))"},{"path":"https://animint.github.io/animint2/reference/scale_brewer.html","id":null,"dir":"Reference","previous_headings":"","what":"Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer","title":"Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer","text":"ColorBrewer provides sequential, diverging qualitative colour schemes particularly suited tested display discrete values (levels factor) map. ggplot2 can use colours discrete scales. also allows smoothly interpolate 6 colours palette continuous scale (6 colours per palette gives nice gradients; results saturated colours look good). However, original colour schemes (particularly qualitative ones) intended perceptual result left appreciation user. See https://colorbrewer2.org information.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_brewer.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer","text":"","code":"scale_colour_brewer(..., type = \"seq\", palette = 1, direction = 1) scale_fill_brewer(..., type = \"seq\", palette = 1, direction = 1) scale_colour_distiller( ..., type = \"seq\", palette = 1, direction = -1, values = NULL, space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\" ) scale_fill_distiller( ..., type = \"seq\", palette = 1, direction = -1, values = NULL, space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\" )"},{"path":"https://animint.github.io/animint2/reference/scale_brewer.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer","text":"... arguments passed discrete_scale control name, limits, breaks, labels forth. type One \"seq\" (sequential), \"div\" (diverging) \"qual\" (qualitative) palette string, use named palette. number, index list palettes appropriate type direction Sets order colours scale. 1, default, colours output RColorBrewer::brewer.pal(). -1, order colours reversed. values colours evenly positioned along gradient vector gives position (0 1) colour colours vector. See rescale() convenience function map arbitrary range 0 1. space colour space calculate gradient. Must \"Lab\" - values deprecated. na.value Colour use missing values guide Type legend. Use \"colourbar\" continuous colour bar, \"legend\" discrete colour legend.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_brewer.html","id":"palettes","dir":"Reference","previous_headings":"","what":"Palettes","title":"Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer","text":"following palettes available use scales: Diverging BrBG, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, Spectral Qualitative Accent, Dark2, Paired, Pastel1, Pastel2, Set1, Set2, Set3 Sequential Blues, BuGn, BuPu, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_brewer.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sequential, diverging and qualitative colour scales from colorbrewer.org — scale_colour_brewer","text":"","code":"dsamp <- diamonds[sample(nrow(diamonds), 1000), ] (d <- ggplot(dsamp, aes(carat, price)) + geom_point(aes(colour = clarity))) # Change scale label d + scale_colour_brewer() d + scale_colour_brewer(\"Diamond\\nclarity\") # Select brewer palette to use, see ?scales::brewer_pal for more details d + scale_colour_brewer(palette = \"Greens\") d + scale_colour_brewer(palette = \"Set1\") # \\donttest{ # scale_fill_brewer works just the same as # scale_colour_brewer but for fill colours p <- ggplot(diamonds, aes(x = price, fill = cut)) + geom_histogram(position = \"dodge\", binwidth = 1000) p + scale_fill_brewer() # the order of colour can be reversed p + scale_fill_brewer(direction = -1) # the brewer scales look better on a darker background p + scale_fill_brewer(direction = -1) + theme_dark() # } # Use distiller variant with continous data v <- ggplot(faithfuld) + geom_tile(aes(waiting, eruptions, fill = density)) v v + scale_fill_distiller() v + scale_fill_distiller(palette = \"Spectral\")"},{"path":"https://animint.github.io/animint2/reference/scale_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Continuous position scales (x & y). — scale_continuous","title":"Continuous position scales (x & y). — scale_continuous","text":"scale_x_continuous scale_y_continuous key functions. others, scale_x_log10, scale_y_sqrt etc, aliases set trans argument commonly used transformations.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Continuous position scales (x & y). — scale_continuous","text":"","code":"scale_x_continuous( name = waiver(), breaks = waiver(), minor_breaks = waiver(), labels = waiver(), limits = NULL, expand = waiver(), oob = censor, na.value = NA_real_, trans = \"identity\" ) scale_y_continuous( name = waiver(), breaks = waiver(), minor_breaks = waiver(), labels = waiver(), limits = NULL, expand = waiver(), oob = censor, na.value = NA_real_, trans = \"identity\" ) scale_x_log10(...) scale_y_log10(...) scale_x_reverse(...) scale_y_reverse(...) scale_x_sqrt(...) scale_y_sqrt(...)"},{"path":"https://animint.github.io/animint2/reference/scale_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Continuous position scales (x & y). — scale_continuous","text":"name name scale. Used axis legend title. NULL, default, name scale taken first mapping used aesthetic. breaks One : NULL breaks waiver() default breaks computed transformation object numeric vector positions function takes limits input returns breaks output minor_breaks One : NULL minor breaks waiver() default breaks (one minor break major break) numeric vector positions function given limits returns vector minor breaks. labels One : NULL labels waiver() default labels computed transformation object character vector giving labels (must length breaks) function takes breaks input returns labels output limits numeric vector length two providing limits scale. Use NA refer existing minimum maximum. expand numeric vector length two giving multiplicative additive expansion constants. constants ensure data placed distance away axes. defaults c(0.05, 0) continuous variables, c(0, 0.6) discrete variables. oob Function handles limits outside scale limits (bounds). default replaces bounds values NA. na.value Missing values replaced value. trans Either name transformation object, object . Built-transformations include \"asn\", \"atanh\", \"boxcox\", \"exp\", \"identity\", \"log\", \"log10\", \"log1p\", \"log2\", \"logit\", \"probability\", \"probit\", \"reciprocal\", \"reverse\" \"sqrt\". transformation object bundles together transform, inverse, methods generating breaks labels. Transformation objects defined scales package, called name_trans, e.g. boxcox_trans. can create transformation trans_new. ... arguments passed scale_(x|y)_continuous","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Continuous position scales (x & y). — scale_continuous","text":"","code":"# \\donttest{ if (require(ggplot2movies)) { m <- ggplot(subset(movies, votes > 1000), aes(rating, votes)) + geom_point(na.rm = TRUE) m # Manipulating the default position scales lets you: # * change the axis labels m + scale_y_continuous(\"number of votes\") m + scale_y_continuous(quote(votes ^ alpha)) # * modify the axis limits m + scale_y_continuous(limits = c(0, 5000)) m + scale_y_continuous(limits = c(1000, 10000)) m + scale_x_continuous(limits = c(7, 8)) # you can also use the short hand functions xlim and ylim m + ylim(0, 5000) m + ylim(1000, 10000) m + xlim(7, 8) # * choose where the ticks appear m + scale_x_continuous(breaks = 1:10) m + scale_x_continuous(breaks = c(1,3,7,9)) # * manually label the ticks m + scale_x_continuous(breaks = c(2,5,8), labels = c(\"two\", \"five\", \"eight\")) m + scale_x_continuous(breaks = c(2,5,8), labels = c(\"horrible\", \"ok\", \"awesome\")) m + scale_x_continuous(breaks = c(2,5,8), labels = expression(Alpha, Beta, Omega)) # There are a few built in transformation that you can use: m + scale_y_log10() m + scale_y_sqrt() m + scale_y_reverse() # You can also create your own and supply them to the trans argument. # See ?scales::trans_new # You can control the formatting of the labels with the formatter # argument. Some common formats are built into the scales package: df <- data.frame( x = rnorm(10) * 100000, y = seq(0, 1, length.out = 10) ) p <- ggplot(df, aes(x, y)) + geom_point() p + scale_y_continuous(labels = scales::percent) p + scale_y_continuous(labels = scales::dollar) p + scale_x_continuous(labels = scales::comma) # Other shortcut functions ggplot(movies, aes(rating, votes)) + geom_point() + ylim(1e4, 5e4) # * axis labels ggplot(movies, aes(rating, votes)) + geom_point() + labs(x = \"My x axis\", y = \"My y axis\") # * log scaling ggplot(movies, aes(rating, votes)) + geom_point() + scale_x_log10() + scale_y_log10() } # }"},{"path":"https://animint.github.io/animint2/reference/scale_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Position scale, date & date times — scale_date","title":"Position scale, date & date times — scale_date","text":"Use scale_*_date Date variables, scale_*_datetime POSIXct variables.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Position scale, date & date times — scale_date","text":"","code":"scale_x_date( name = waiver(), breaks = waiver(), date_breaks = waiver(), labels = waiver(), date_labels = waiver(), minor_breaks = waiver(), date_minor_breaks = waiver(), limits = NULL, expand = waiver() ) scale_y_date( name = waiver(), breaks = waiver(), date_breaks = waiver(), labels = waiver(), date_labels = waiver(), minor_breaks = waiver(), date_minor_breaks = waiver(), limits = NULL, expand = waiver() ) scale_x_datetime( name = waiver(), breaks = waiver(), date_breaks = waiver(), labels = waiver(), date_labels = waiver(), minor_breaks = waiver(), date_minor_breaks = waiver(), limits = NULL, expand = waiver() ) scale_y_datetime( name = waiver(), breaks = waiver(), date_breaks = waiver(), labels = waiver(), date_labels = waiver(), minor_breaks = waiver(), date_minor_breaks = waiver(), limits = NULL, expand = waiver() )"},{"path":"https://animint.github.io/animint2/reference/scale_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Position scale, date & date times — scale_date","text":"name name scale. Used axis legend title. NULL, default, name scale taken first mapping used aesthetic. breaks One : NULL breaks waiver() default breaks computed transformation object numeric vector positions function takes limits input returns breaks output date_breaks string giving distance breaks like \"2 weeks\", \"10 years\". breaks date_breaks specified, date_breaks wins. labels One : NULL labels waiver() default labels computed transformation object character vector giving labels (must length breaks) function takes breaks input returns labels output date_labels string giving formatting specification labels. Codes defined strftime. labels date_labels specified, date_labels wins. minor_breaks One : NULL minor breaks waiver() default breaks (one minor break major break) numeric vector positions function given limits returns vector minor breaks. date_minor_breaks string giving distance minor breaks like \"2 weeks\", \"10 years\". minor_breaks date_minor_breaks specified, date_minor_breaks wins. limits numeric vector length two providing limits scale. Use NA refer existing minimum maximum. expand numeric vector length two giving multiplicative additive expansion constants. constants ensure data placed distance away axes. defaults c(0.05, 0) continuous variables, c(0, 0.6) discrete variables.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_date.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Position scale, date & date times — scale_date","text":"","code":"last_month <- Sys.Date() - 0:29 df <- data.frame( date = last_month, price = runif(30) ) base <- ggplot(df, aes(date, price)) + geom_line() # The date scale will attempt to pick sensible defaults for # major and minor tick marks. Override with date_breaks, date_labels # date_minor_breaks arguments. base + scale_x_date(date_labels = \"%b %d\") base + scale_x_date(date_breaks = \"1 week\", date_labels = \"%W\") base + scale_x_date(date_minor_breaks = \"1 day\") # Set limits base + scale_x_date(limits = c(Sys.Date() - 7, NA)) #> Warning: Removed 22 rows containing missing values (geom_path)."},{"path":"https://animint.github.io/animint2/reference/scale_discrete.html","id":null,"dir":"Reference","previous_headings":"","what":"Discrete position. — scale_x_discrete","title":"Discrete position. — scale_x_discrete","text":"can use continuous positions even discrete position scale - allows (e.g.) place labels bars bar chart. Continuous positions numeric values starting one first level, increasing one level (.e. labels placed integer positions). allows jittering work.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_discrete.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Discrete position. — scale_x_discrete","text":"","code":"scale_x_discrete(..., expand = waiver()) scale_y_discrete(..., expand = waiver())"},{"path":"https://animint.github.io/animint2/reference/scale_discrete.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Discrete position. — scale_x_discrete","text":"... common discrete scale parameters: name, breaks, labels, na.value, limits guide. See discrete_scale details expand numeric vector length two giving multiplicative additive expansion constants. constants ensure data placed distance away axes.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_discrete.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Discrete position. — scale_x_discrete","text":"","code":"ggplot(diamonds, aes(cut)) + geom_bar() # \\donttest{ # The discrete position scale is added automatically whenever you # have a discrete position. (d <- ggplot(subset(diamonds, carat > 1), aes(cut, clarity)) + geom_jitter()) d + scale_x_discrete(\"Cut\") d + scale_x_discrete(\"Cut\", labels = c(\"Fair\" = \"F\",\"Good\" = \"G\", \"Very Good\" = \"VG\",\"Perfect\" = \"P\",\"Ideal\" = \"I\")) # Use limits to adjust the which levels (and in what order) # are displayed d + scale_x_discrete(limits = c(\"Fair\",\"Ideal\")) #> Warning: Removed 11189 rows containing missing values (geom_point). # you can also use the short hand functions xlim and ylim d + xlim(\"Fair\",\"Ideal\", \"Good\") #> Warning: Removed 9610 rows containing missing values (geom_point). d + ylim(\"I1\", \"IF\") #> Warning: Removed 16770 rows containing missing values (geom_point). # See ?reorder to reorder based on the values of another variable ggplot(mpg, aes(manufacturer, cty)) + geom_point() ggplot(mpg, aes(reorder(manufacturer, cty), cty)) + geom_point() ggplot(mpg, aes(reorder(manufacturer, displ), cty)) + geom_point() # Use abbreviate as a formatter to reduce long names ggplot(mpg, aes(reorder(manufacturer, displ), cty)) + geom_point() + scale_x_discrete(labels = abbreviate) # }"},{"path":"https://animint.github.io/animint2/reference/scale_gradient.html","id":null,"dir":"Reference","previous_headings":"","what":"Smooth gradient between two colours — scale_colour_gradient","title":"Smooth gradient between two colours — scale_colour_gradient","text":"scale_*_gradient creates two colour gradient (low-high), scale_*_gradient2 creates diverging colour gradient (low-mid-high), scale_*_gradientn creats n-colour gradient.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_gradient.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Smooth gradient between two colours — scale_colour_gradient","text":"","code":"scale_colour_gradient( ..., low = \"#132B43\", high = \"#56B1F7\", space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\" ) scale_fill_gradient( ..., low = \"#132B43\", high = \"#56B1F7\", space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\" ) scale_colour_gradient2( ..., low = muted(\"red\"), mid = \"white\", high = muted(\"blue\"), midpoint = 0, space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\" ) scale_fill_gradient2( ..., low = muted(\"red\"), mid = \"white\", high = muted(\"blue\"), midpoint = 0, space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\" ) scale_colour_gradientn( ..., colours, values = NULL, space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\", colors ) scale_fill_gradientn( ..., colours, values = NULL, space = \"Lab\", na.value = \"grey50\", guide = \"colourbar\", colors )"},{"path":"https://animint.github.io/animint2/reference/scale_gradient.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Smooth gradient between two colours — scale_colour_gradient","text":"... arguments passed discrete_scale control name, limits, breaks, labels forth. low, high Colours low high ends gradient. space colour space calculate gradient. Must \"Lab\" - values deprecated. na.value Colour use missing values guide Type legend. Use \"colourbar\" continuous colour bar, \"legend\" discrete colour legend. mid colour mid point midpoint midpoint (data value) diverging scale. Defaults 0. colours, colors Vector colours use n-colour gradient. values colours evenly positioned along gradient vector gives position (0 1) colour colours vector. See rescale() convenience function map arbitrary range 0 1.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_gradient.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Smooth gradient between two colours — scale_colour_gradient","text":"Default colours generated munsell mnsl(c(\"2.5PB 2/4\", \"2.5PB 7/10\"). Generally, continuous colour scales want keep hue constant, vary chroma luminance. munsell package makes easy using Munsell colour system.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_gradient.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Smooth gradient between two colours — scale_colour_gradient","text":"","code":"df <- data.frame( x = runif(100), y = runif(100), z1 = rnorm(100), z2 = abs(rnorm(100)) ) # Default colour scale colours from light blue to dark blue ggplot(df, aes(x, y)) + geom_point(aes(colour = z2)) # For diverging colour scales use gradient2 ggplot(df, aes(x, y)) + geom_point(aes(colour = z1)) + scale_colour_gradient2() # Use your own colour scale with gradientn ggplot(df, aes(x, y)) + geom_point(aes(colour = z1)) + scale_colour_gradientn(colours = terrain.colors(10)) # Equivalent fill scales do the same job for the fill aesthetic ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density)) + scale_fill_gradientn(colours = terrain.colors(10)) # Adjust colour choices with low and high ggplot(df, aes(x, y)) + geom_point(aes(colour = z2)) + scale_colour_gradient(low = \"white\", high = \"black\") # Avoid red-green colour contrasts because ~10% of men have difficulty # seeing them"},{"path":"https://animint.github.io/animint2/reference/scale_grey.html","id":null,"dir":"Reference","previous_headings":"","what":"Sequential grey colour scale. — scale_colour_grey","title":"Sequential grey colour scale. — scale_colour_grey","text":"Based gray.colors","code":""},{"path":"https://animint.github.io/animint2/reference/scale_grey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sequential grey colour scale. — scale_colour_grey","text":"","code":"scale_colour_grey(..., start = 0.2, end = 0.8, na.value = \"red\") scale_fill_grey(..., start = 0.2, end = 0.8, na.value = \"red\")"},{"path":"https://animint.github.io/animint2/reference/scale_grey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sequential grey colour scale. — scale_colour_grey","text":"... arguments passed discrete_scale control name, limits, breaks, labels forth. start grey value low end palette end grey value high end palette na.value Colour use missing values","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_grey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sequential grey colour scale. — scale_colour_grey","text":"","code":"p <- ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = factor(cyl))) p + scale_colour_grey() p + scale_colour_grey(end = 0) # You may want to turn off the pale grey background with this scale p + scale_colour_grey() + theme_bw() # Colour of missing values is controlled with na.value: miss <- factor(sample(c(NA, 1:5), nrow(mtcars), replace = TRUE)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss)) + scale_colour_grey() ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss)) + scale_colour_grey(na.value = \"green\")"},{"path":"https://animint.github.io/animint2/reference/scale_hue.html","id":null,"dir":"Reference","previous_headings":"","what":"Qualitative colour scale with evenly spaced hues. — scale_colour_hue","title":"Qualitative colour scale with evenly spaced hues. — scale_colour_hue","text":"Qualitative colour scale evenly spaced hues.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_hue.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Qualitative colour scale with evenly spaced hues. — scale_colour_hue","text":"","code":"scale_colour_hue( ..., h = c(0, 360) + 15, c = 100, l = 65, h.start = 0, direction = 1, na.value = \"grey50\" ) scale_fill_hue( ..., h = c(0, 360) + 15, c = 100, l = 65, h.start = 0, direction = 1, na.value = \"grey50\" )"},{"path":"https://animint.github.io/animint2/reference/scale_hue.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Qualitative colour scale with evenly spaced hues. — scale_colour_hue","text":"... arguments passed discrete_scale control name, limits, breaks, labels forth. h range hues use, [0, 360] c chroma (intensity colour), maximum value varies depending combination hue luminance. l luminance (lightness), [0, 100] h.start hue start direction direction travel around colour wheel, 1 = clockwise, -1 = counter-clockwise na.value Colour use missing values","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_hue.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Qualitative colour scale with evenly spaced hues. — scale_colour_hue","text":"","code":"# \\donttest{ dsamp <- diamonds[sample(nrow(diamonds), 1000), ] (d <- ggplot(dsamp, aes(carat, price)) + geom_point(aes(colour = clarity))) # Change scale label d + scale_colour_hue() d + scale_colour_hue(\"clarity\") d + scale_colour_hue(expression(clarity[beta])) # Adjust luminosity and chroma d + scale_colour_hue(l = 40, c = 30) d + scale_colour_hue(l = 70, c = 30) d + scale_colour_hue(l = 70, c = 150) d + scale_colour_hue(l = 80, c = 150) # Change range of hues used d + scale_colour_hue(h = c(0, 90)) d + scale_colour_hue(h = c(90, 180)) d + scale_colour_hue(h = c(180, 270)) d + scale_colour_hue(h = c(270, 360)) # Vary opacity # (only works with pdf, quartz and cairo devices) d <- ggplot(dsamp, aes(carat, price, colour = clarity)) d + geom_point(alpha = 0.9) d + geom_point(alpha = 0.5) d + geom_point(alpha = 0.2) # Colour of missing values is controlled with na.value: miss <- factor(sample(c(NA, 1:5), nrow(mtcars), replace = TRUE)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = miss)) + scale_colour_hue(na.value = \"black\") # }"},{"path":"https://animint.github.io/animint2/reference/scale_identity.html","id":null,"dir":"Reference","previous_headings":"","what":"Use values without scaling. — scale_identity","title":"Use values without scaling. — scale_identity","text":"Use values without scaling.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_identity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use values without scaling. — scale_identity","text":"","code":"scale_colour_identity(..., guide = \"none\") scale_fill_identity(..., guide = \"none\") scale_shape_identity(..., guide = \"none\") scale_linetype_identity(..., guide = \"none\") scale_alpha_identity(..., guide = \"none\") scale_size_identity(..., guide = \"none\")"},{"path":"https://animint.github.io/animint2/reference/scale_identity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use values without scaling. — scale_identity","text":"... arguments passed discrete_scale continuous_scale guide Guide use scale - defaults \"none\".","code":""},{"path":"https://animint.github.io/animint2/reference/scale_identity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Use values without scaling. — scale_identity","text":"","code":"ggplot(luv_colours, aes(u, v)) + geom_point(aes(colour = col), size = 3) + scale_color_identity() + coord_equal() df <- data.frame( x = 1:4, y = 1:4, colour = c(\"red\", \"green\", \"blue\", \"yellow\") ) ggplot(df, aes(x, y)) + geom_tile(aes(fill = colour)) ggplot(df, aes(x, y)) + geom_tile(aes(fill = colour)) + scale_fill_identity() # To get a legend guide, specify guide = \"legend\" ggplot(df, aes(x, y)) + geom_tile(aes(fill = colour)) + scale_fill_identity(guide = \"legend\") # But you'll typically also need to supply breaks and labels: ggplot(df, aes(x, y)) + geom_tile(aes(fill = colour)) + scale_fill_identity(\"trt\", labels = letters[1:4], breaks = df$colour, guide = \"legend\") # cyl scaled to appropriate size ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(size = cyl)) # cyl used as point size ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(size = cyl)) + scale_size_identity()"},{"path":"https://animint.github.io/animint2/reference/scale_linetype.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale for line patterns. — scale_linetype","title":"Scale for line patterns. — scale_linetype","text":"Default line types based set supplied Richard Pearson, University Manchester. Line types can mapped continuous values.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_linetype.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale for line patterns. — scale_linetype","text":"","code":"scale_linetype(..., na.value = \"blank\") scale_linetype_continuous(...) scale_linetype_discrete(..., na.value = \"blank\")"},{"path":"https://animint.github.io/animint2/reference/scale_linetype.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scale for line patterns. — scale_linetype","text":"... common discrete scale parameters: name, breaks, labels, na.value, limits guide. See discrete_scale details na.value linetype use NA values.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_linetype.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scale for line patterns. — scale_linetype","text":"","code":"base <- ggplot(economics_long, aes(date, value01)) base + geom_line(aes(group = variable)) base + geom_line(aes(linetype = variable)) # See scale_manual for more flexibility"},{"path":"https://animint.github.io/animint2/reference/scale_manual.html","id":null,"dir":"Reference","previous_headings":"","what":"Create your own discrete scale. — scale_manual","title":"Create your own discrete scale. — scale_manual","text":"Create discrete scale.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_manual.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create your own discrete scale. — scale_manual","text":"","code":"scale_colour_manual(..., values) scale_fill_manual(..., values) scale_size_manual(..., values) scale_shape_manual(..., values) scale_linetype_manual(..., values) scale_alpha_manual(..., values)"},{"path":"https://animint.github.io/animint2/reference/scale_manual.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create your own discrete scale. — scale_manual","text":"... common discrete scale parameters: name, breaks, labels, na.value, limits guide. See discrete_scale details values set aesthetic values map data values . named vector, values matched based names. unnamed, values matched order (usually alphabetical) limits scale. data values match given na.value.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_manual.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create your own discrete scale. — scale_manual","text":"","code":"# \\donttest{ p <- ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = factor(cyl))) p + scale_colour_manual(values = c(\"red\",\"blue\", \"green\")) p + scale_colour_manual( values = c(\"8\" = \"red\",\"4\" = \"blue\",\"6\" = \"green\")) # With rgb hex values p + scale_colour_manual(values = c(\"#FF0000\", \"#0000FF\", \"#00FF00\")) # As with other scales you can use breaks to control the appearance # of the legend cols <- c(\"8\" = \"red\",\"4\" = \"blue\",\"6\" = \"darkgreen\", \"10\" = \"orange\") p + scale_colour_manual(values = cols) p + scale_colour_manual(values = cols, breaks = c(\"4\", \"6\", \"8\")) p + scale_colour_manual(values = cols, breaks = c(\"8\", \"6\", \"4\")) p + scale_colour_manual(values = cols, breaks = c(\"4\", \"6\", \"8\"), labels = c(\"four\", \"six\", \"eight\")) # And limits to control the possible values of the scale p + scale_colour_manual(values = cols, limits = c(\"4\", \"8\")) p + scale_colour_manual(values = cols, limits = c(\"4\", \"6\", \"8\", \"10\")) # Notice that the values are matched with limits, and not breaks p + scale_colour_manual(limits = c(6, 8, 4), breaks = c(8, 4, 6), values = c(\"grey50\", \"grey80\", \"black\")) # }"},{"path":"https://animint.github.io/animint2/reference/scale_shape.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale for shapes, aka glyphs. — scale_shape","title":"Scale for shapes, aka glyphs. — scale_shape","text":"continuous variable can mapped shape.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_shape.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale for shapes, aka glyphs. — scale_shape","text":"","code":"scale_shape(..., solid = TRUE)"},{"path":"https://animint.github.io/animint2/reference/scale_shape.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scale for shapes, aka glyphs. — scale_shape","text":"... common discrete scale parameters: name, breaks, labels, na.value, limits guide. See discrete_scale details solid shapes solid, TRUE, hollow FALSE?","code":""},{"path":"https://animint.github.io/animint2/reference/scale_shape.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scale for shapes, aka glyphs. — scale_shape","text":"","code":"dsmall <- diamonds[sample(nrow(diamonds), 100), ] (d <- ggplot(dsmall, aes(carat, price)) + geom_point(aes(shape = cut))) d + scale_shape(solid = TRUE) # the default d + scale_shape(solid = FALSE) d + scale_shape(name = \"Cut of diamond\") d + scale_shape(name = \"Cut of\\ndiamond\") # To change order of levels, change order of # underlying factor levels(dsmall$cut) <- c(\"Fair\", \"Good\", \"Very Good\", \"Premium\", \"Ideal\") # Need to recreate plot to pick up new data ggplot(dsmall, aes(price, carat)) + geom_point(aes(shape = cut)) # Or for short: d %+% dsmall"},{"path":"https://animint.github.io/animint2/reference/scale_size.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale size (area or radius). — scale_size","title":"Scale size (area or radius). — scale_size","text":"scale_size scales area, scale_radius scales radius. size aesthetic commonly used points text, humans perceive area points (radius), provides optimal perception. scale_size_area ensures value 0 mapped size 0.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_size.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale size (area or radius). — scale_size","text":"","code":"scale_radius( name = waiver(), breaks = waiver(), labels = waiver(), limits = NULL, range = c(1, 6), trans = \"identity\", guide = \"legend\" ) scale_size( name = waiver(), breaks = waiver(), labels = waiver(), limits = NULL, range = c(1, 6), trans = \"identity\", guide = \"legend\" ) scale_size_area(..., max_size = 6)"},{"path":"https://animint.github.io/animint2/reference/scale_size.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scale size (area or radius). — scale_size","text":"name name scale. Used axis legend title. NULL, default, name scale taken first mapping used aesthetic. breaks One : NULL breaks waiver() default breaks computed transformation object numeric vector positions function takes limits input returns breaks output labels One : NULL labels waiver() default labels computed transformation object character vector giving labels (must length breaks) function takes breaks input returns labels output limits numeric vector length two providing limits scale. Use NA refer existing minimum maximum. range numeric vector length 2 specifies minimum maximum size plotting symbol transformation. trans Either name transformation object, object . Built-transformations include \"asn\", \"atanh\", \"boxcox\", \"exp\", \"identity\", \"log\", \"log10\", \"log1p\", \"log2\", \"logit\", \"probability\", \"probit\", \"reciprocal\", \"reverse\" \"sqrt\". transformation object bundles together transform, inverse, methods generating breaks labels. Transformation objects defined scales package, called name_trans, e.g. boxcox_trans. can create transformation trans_new. guide Name guide object, object . ... arguments passed continuous_scale control name, limits, breaks, labels forth. max_size Size largest points.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/scale_size.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scale size (area or radius). — scale_size","text":"","code":"p <- ggplot(mpg, aes(displ, hwy, size = hwy)) + geom_point() p p + scale_size(\"Highway mpg\") p + scale_size(range = c(0, 10)) # If you want zero value to have zero size, use scale_size_area: p + scale_size_area() # This is most useful when size is a count ggplot(mpg, aes(class, cyl)) + geom_count() + scale_size_area() # If you want to map size to radius (usually bad idea), use scale_radius p + scale_radius()"},{"path":"https://animint.github.io/animint2/reference/scale_size_animint.html","id":null,"dir":"Reference","previous_headings":"","what":"Scale point sizes using circle area, but specifying the radius in\r\npixels. — scale_size_animint","title":"Scale point sizes using circle area, but specifying the radius in\r\npixels. — scale_size_animint","text":"Scale point sizes using circle area, specifying radius pixels.","code":""},{"path":"https://animint.github.io/animint2/reference/scale_size_animint.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scale point sizes using circle area, but specifying the radius in\r\npixels. — scale_size_animint","text":"","code":"scale_size_animint(pixel.range = c(2, 20), ...)"},{"path":"https://animint.github.io/animint2/reference/scale_size_animint.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scale point sizes using circle area, but specifying the radius in\r\npixels. — scale_size_animint","text":"pixel.range min max circle radius pixels. ... passed continuous_scale.","code":""},{"path":"https://animint.github.io/animint2/reference/seals.html","id":null,"dir":"Reference","previous_headings":"","what":"Vector field of seal movements. — seals","title":"Vector field of seal movements. — seals","text":"vector field produced data described Brillinger, D.R., Preisler, H.K., Ager, .. Kie, J.G. \"exploratory data analysis (EDA) paths moving animals\". J. Statistical Planning Inference 122 (2004), 43-63, using methods Brillinger, D.R., \"Learning potential function trajectory\", Signal Processing Letters. December (2007).","code":""},{"path":"https://animint.github.io/animint2/reference/seals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vector field of seal movements. — seals","text":"","code":"seals"},{"path":"https://animint.github.io/animint2/reference/seals.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Vector field of seal movements. — seals","text":"data frame 1155 rows 4 variables","code":""},{"path":"https://animint.github.io/animint2/reference/seals.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Vector field of seal movements. — seals","text":"https://www.stat.berkeley.edu/~brill/Papers/jspifinal.pdf","code":""},{"path":"https://animint.github.io/animint2/reference/selectSSandCS.html","id":null,"dir":"Reference","previous_headings":"","what":"Separate .variable/.value selectors — selectSSandCS","title":"Separate .variable/.value selectors — selectSSandCS","text":"Separate .variable/.value selectors","code":""},{"path":"https://animint.github.io/animint2/reference/selectSSandCS.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Separate .variable/.value selectors — selectSSandCS","text":"","code":"selectSSandCS(aesthetics_list)"},{"path":"https://animint.github.io/animint2/reference/selectSSandCS.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Separate .variable/.value selectors — selectSSandCS","text":"aesthetics_list aesthetics mapping layer","code":""},{"path":"https://animint.github.io/animint2/reference/selectSSandCS.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Separate .variable/.value selectors — selectSSandCS","text":"Modified aes.list list separated showSelected.variable/value","code":""},{"path":"https://animint.github.io/animint2/reference/setPlotSizes.html","id":null,"dir":"Reference","previous_headings":"","what":"Set plot width and height for all plots — setPlotSizes","title":"Set plot width and height for all plots — setPlotSizes","text":"Set plot width height plots","code":""},{"path":"https://animint.github.io/animint2/reference/setPlotSizes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set plot width and height for all plots — setPlotSizes","text":"","code":"setPlotSizes(meta, AllPlotsInfo)"},{"path":"https://animint.github.io/animint2/reference/setPlotSizes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set plot width and height for all plots — setPlotSizes","text":"meta meta object information AllPlotsInfo plot info list","code":""},{"path":"https://animint.github.io/animint2/reference/setPlotSizes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set plot width and height for all plots — setPlotSizes","text":"NULL. Sizes stored meta object","code":""},{"path":"https://animint.github.io/animint2/reference/should_stop.html","id":null,"dir":"Reference","previous_headings":"","what":"Used in examples to illustrate when errors should occur. — should_stop","title":"Used in examples to illustrate when errors should occur. — should_stop","text":"Used examples illustrate errors occur.","code":""},{"path":"https://animint.github.io/animint2/reference/should_stop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Used in examples to illustrate when errors should occur. — should_stop","text":"","code":"should_stop(expr)"},{"path":"https://animint.github.io/animint2/reference/should_stop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Used in examples to illustrate when errors should occur. — should_stop","text":"expr code evaluate.","code":""},{"path":"https://animint.github.io/animint2/reference/should_stop.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Used in examples to illustrate when errors should occur. — should_stop","text":"","code":"should_stop(stop(\"Hi!\")) should_stop(should_stop(\"Hi!\")) #> [1] \"Hi!\""},{"path":"https://animint.github.io/animint2/reference/split_recursive.html","id":null,"dir":"Reference","previous_headings":"","what":"Split data.frame into recursive list of data.frame. — split_recursive","title":"Split data.frame into recursive list of data.frame. — split_recursive","text":"Split data.frame recursive list data.frame.","code":""},{"path":"https://animint.github.io/animint2/reference/split_recursive.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Split data.frame into recursive list of data.frame. — split_recursive","text":"","code":"split_recursive(x, vars)"},{"path":"https://animint.github.io/animint2/reference/split_recursive.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Split data.frame into recursive list of data.frame. — split_recursive","text":"x data.frame. vars character vector variable names split .","code":""},{"path":"https://animint.github.io/animint2/reference/split_recursive.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Split data.frame into recursive list of data.frame. — split_recursive","text":"recursive list data.frame.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ecdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Empirical Cumulative Density Function — stat_ecdf","title":"Empirical Cumulative Density Function — stat_ecdf","text":"Empirical Cumulative Density Function","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ecdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Empirical Cumulative Density Function — stat_ecdf","text":"","code":"stat_ecdf( mapping = NULL, data = NULL, geom = \"step\", position = \"identity\", ..., n = NULL, pad = TRUE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_ecdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Empirical Cumulative Density Function — stat_ecdf","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. n NULL, interpolate. NULL, number points interpolate . pad TRUE, pad ecdf additional points (-Inf, 0) (Inf, 1) na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ecdf.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Empirical Cumulative Density Function — stat_ecdf","text":"x x data y cumulative density corresponding x","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ecdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Empirical Cumulative Density Function — stat_ecdf","text":"","code":"# \\donttest{ df <- data.frame(x = rnorm(1000)) ggplot(df, aes(x)) + stat_ecdf(geom = \"step\") df <- data.frame(x = c(rnorm(100, 0, 3), rnorm(100, 0, 10)), g = gl(2, 100)) ggplot(df, aes(x, colour = g)) + stat_ecdf() # }"},{"path":"https://animint.github.io/animint2/reference/stat_ellipse.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot data ellipses. — stat_ellipse","title":"Plot data ellipses. — stat_ellipse","text":"method calculating ellipses modified car::ellipse (Fox Weisberg, 2011)","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ellipse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot data ellipses. — stat_ellipse","text":"","code":"stat_ellipse( mapping = NULL, data = NULL, geom = \"path\", position = \"identity\", ..., type = \"t\", level = 0.95, segments = 51, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_ellipse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot data ellipses. — stat_ellipse","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. type type ellipse. default \"t\" assumes multivariate t-distribution, \"norm\" assumes multivariate normal distribution. \"euclid\" draws circle radius equal level, representing euclidean distance center. ellipse probably appear circular unless coord_fixed() applied. level confidence level draw ellipse (default 0.95), , type=\"euclid\", radius circle drawn. segments number segments used drawing ellipse. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ellipse.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot data ellipses. — stat_ellipse","text":"John Fox Sanford Weisberg (2011). R Companion Applied Regression, Second Edition. Thousand Oaks CA: Sage.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_ellipse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot data ellipses. — stat_ellipse","text":"","code":"ggplot(faithful, aes(waiting, eruptions)) + geom_point() + stat_ellipse() ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) + geom_point() + stat_ellipse() ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) + geom_point() + stat_ellipse(type = \"norm\", linetype = 2) + stat_ellipse(type = \"t\") ggplot(faithful, aes(waiting, eruptions, color = eruptions > 3)) + geom_point() + stat_ellipse(type = \"norm\", linetype = 2) + stat_ellipse(type = \"euclid\", level = 3) + coord_fixed() ggplot(faithful, aes(waiting, eruptions, fill = eruptions > 3)) + stat_ellipse(geom = \"polygon\")"},{"path":"https://animint.github.io/animint2/reference/stat_function.html","id":null,"dir":"Reference","previous_headings":"","what":"Superimpose a function. — stat_function","title":"Superimpose a function. — stat_function","text":"Superimpose function.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_function.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Superimpose a function. — stat_function","text":"","code":"stat_function( mapping = NULL, data = NULL, geom = \"path\", position = \"identity\", ..., fun, xlim = NULL, n = 101, args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_function.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Superimpose a function. — stat_function","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. fun function use xlim Optionally, restrict range function range. n number points interpolate along args list additional arguments pass fun na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_function.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Superimpose a function. — stat_function","text":"stat_function understands following aesthetics (required aesthetics bold): y","code":""},{"path":"https://animint.github.io/animint2/reference/stat_function.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Superimpose a function. — stat_function","text":"x x's along grid y value function evaluated corresponding x","code":""},{"path":"https://animint.github.io/animint2/reference/stat_function.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Superimpose a function. — stat_function","text":"","code":"set.seed(1492) df <- data.frame( x = rnorm(100) ) x <- df$x base <- ggplot(df, aes(x)) + geom_density() base + stat_function(fun = dnorm, colour = \"red\") base + stat_function(fun = dnorm, colour = \"red\", args = list(mean = 3)) # Plot functions without data # Examples adapted from Kohske Takahashi # Specify range of x-axis ggplot(data.frame(x = c(0, 2)), aes(x)) + stat_function(fun = exp, geom = \"line\") # Plot a normal curve ggplot(data.frame(x = c(-5, 5)), aes(x)) + stat_function(fun = dnorm) # To specify a different mean or sd, use the args parameter to supply new values ggplot(data.frame(x = c(-5, 5)), aes(x)) + stat_function(fun = dnorm, args = list(mean = 2, sd = .5)) # Two functions on the same plot f <- ggplot(data.frame(x = c(0, 10)), aes(x)) f + stat_function(fun = sin, colour = \"red\") + stat_function(fun = cos, colour = \"blue\") # Using a custom function test <- function(x) {x ^ 2 + x + 20} f + stat_function(fun = test)"},{"path":"https://animint.github.io/animint2/reference/stat_identity.html","id":null,"dir":"Reference","previous_headings":"","what":"Identity statistic. — stat_identity","title":"Identity statistic. — stat_identity","text":"identity statistic leaves data unchanged.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_identity.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identity statistic. — stat_identity","text":"","code":"stat_identity( mapping = NULL, data = NULL, geom = \"point\", position = \"identity\", ..., show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_identity.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identity statistic. — stat_identity","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_identity.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identity statistic. — stat_identity","text":"","code":"p <- ggplot(mtcars, aes(wt, mpg)) p + stat_identity()"},{"path":"https://animint.github.io/animint2/reference/stat_qq.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculation for quantile-quantile plot. — stat_qq","title":"Calculation for quantile-quantile plot. — stat_qq","text":"Calculation quantile-quantile plot.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_qq.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculation for quantile-quantile plot. — stat_qq","text":"","code":"stat_qq( mapping = NULL, data = NULL, geom = \"point\", position = \"identity\", ..., distribution = stats::qnorm, dparams = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_qq( mapping = NULL, data = NULL, geom = \"point\", position = \"identity\", ..., distribution = stats::qnorm, dparams = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_qq.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculation for quantile-quantile plot. — stat_qq","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. distribution Distribution function use, x specified dparams Additional parameters passed distribution function. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_qq.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Calculation for quantile-quantile plot. — stat_qq","text":"stat_qq understands following aesthetics (required aesthetics bold): sample x y","code":""},{"path":"https://animint.github.io/animint2/reference/stat_qq.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Calculation for quantile-quantile plot. — stat_qq","text":"sample sample quantiles theoretical theoretical quantiles","code":""},{"path":"https://animint.github.io/animint2/reference/stat_qq.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculation for quantile-quantile plot. — stat_qq","text":"","code":"# \\donttest{ df <- data.frame(y = rt(200, df = 5)) p <- ggplot(df, aes(sample = y)) p + stat_qq() p + geom_point(stat = \"qq\") # Use fitdistr from MASS to estimate distribution params params <- as.list(MASS::fitdistr(df$y, \"t\")$estimate) #> Warning: NaNs produced #> Warning: NaNs produced ggplot(df, aes(sample = y)) + stat_qq(distribution = qt, dparams = params[\"df\"]) # Using to explore the distribution of a variable ggplot(mtcars) + stat_qq(aes(sample = mpg)) ggplot(mtcars) + stat_qq(aes(sample = mpg, colour = factor(cyl))) # }"},{"path":"https://animint.github.io/animint2/reference/stat_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarise y values at unique/binned x x. — stat_summary_bin","title":"Summarise y values at unique/binned x x. — stat_summary_bin","text":"stat_summary operates unique x; stat_summary_bin operators binned x. flexible versions stat_bin: instead just counting, can compute aggregate.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarise y values at unique/binned x x. — stat_summary_bin","text":"","code":"stat_summary_bin( mapping = NULL, data = NULL, geom = \"pointrange\", position = \"identity\", ..., fun.data = NULL, fun.y = NULL, fun.ymax = NULL, fun.ymin = NULL, fun.args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_summary( mapping = NULL, data = NULL, geom = \"pointrange\", position = \"identity\", ..., fun.data = NULL, fun.y = NULL, fun.ymax = NULL, fun.ymin = NULL, fun.args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarise y values at unique/binned x x. — stat_summary_bin","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. fun.data function given complete data return data frame variables ymin, y, ymax. fun.ymin, fun.y, fun.ymax Alternatively, supply three individual functions passed vector x's return single number. fun.args Optional additional arguments passed functions. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_summary.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Summarise y values at unique/binned x x. — stat_summary_bin","text":"stat_summary understands following aesthetics (required aesthetics bold): x y","code":""},{"path":"https://animint.github.io/animint2/reference/stat_summary.html","id":"summary-functions","dir":"Reference","previous_headings":"","what":"Summary functions","title":"Summarise y values at unique/binned x x. — stat_summary_bin","text":"can either supply summary functions individually (fun.y, fun.ymax, fun.ymin), single function (fun.data): fun.data Complete summary function. take numeric vector input return data frame output fun.ymin ymin summary function (take numeric vector return single number) fun.y y summary function (take numeric vector return single number) fun.ymax ymax summary function (take numeric vector return single number) simple vector function easiest work can return single number, somewhat less flexible. summary function computes multiple values (e.g. ymin ymax), use fun.data. aggregation functions suppled, default mean_se.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/stat_summary_2d.html","id":null,"dir":"Reference","previous_headings":"","what":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","title":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","text":"stat_summary_2d 2d variation stat_summary. stat_summary_hex hexagonal variation stat_summary_2d. data divided bins defined x y, values z cell summarised fun.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_summary_2d.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","text":"","code":"stat_summary_2d( mapping = NULL, data = NULL, geom = \"tile\", position = \"identity\", ..., bins = 30, binwidth = NULL, drop = TRUE, fun = \"mean\", fun.args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_summary_hex( mapping = NULL, data = NULL, geom = \"hex\", position = \"identity\", ..., bins = 30, binwidth = NULL, drop = TRUE, fun = \"mean\", fun.args = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_summary_2d.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. bins numeric vector giving number bins vertical horizontal directions. Set 30 default. binwidth Numeric vector giving bin width vertical horizontal directions. Overrides bins set. drop drop output fun NA. fun function summary. fun.args list extra arguments pass fun na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_summary_2d.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","text":"x: horizontal position y: vertical position z: value passed summary function","code":""},{"path":"https://animint.github.io/animint2/reference/stat_summary_2d.html","id":"computed-variables","dir":"Reference","previous_headings":"","what":"Computed variables","title":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","text":"x,y Location value Value summary statistic.","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/stat_summary_2d.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bin and summarise in 2d (rectangle & hexagons) — stat_summary_2d","text":"","code":"d <- ggplot(diamonds, aes(carat, depth, z = price)) d + stat_summary_2d() # Specifying function d + stat_summary_2d(fun = function(x) sum(x^2)) d + stat_summary_2d(fun = var) d + stat_summary_2d(fun = \"quantile\", fun.args = list(probs = 0.1)) if (requireNamespace(\"hexbin\")) { d + stat_summary_hex() }"},{"path":"https://animint.github.io/animint2/reference/stat_unique.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove duplicates. — stat_unique","title":"Remove duplicates. — stat_unique","text":"Remove duplicates.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_unique.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove duplicates. — stat_unique","text":"","code":"stat_unique( mapping = NULL, data = NULL, geom = \"point\", position = \"identity\", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )"},{"path":"https://animint.github.io/animint2/reference/stat_unique.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove duplicates. — stat_unique","text":"mapping Set aesthetic mappings created aes aes_. specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot. data.frame, object, override plot data. objects fortified produce data frame. See fortify variables created. function called single argument, plot data. return value must data.frame., used layer data. geom geometric object use display data position Position adjustment, either string, result call position adjustment function. ... arguments passed layer. often aesthetics, used set aesthetic fixed value, like color = \"red\" size = 3. may also parameters paired geom/stat. na.rm FALSE (default), removes missing values warning. TRUE silently removes missing values. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders.","code":""},{"path":"https://animint.github.io/animint2/reference/stat_unique.html","id":"aesthetics","dir":"Reference","previous_headings":"","what":"Aesthetics","title":"Remove duplicates. — stat_unique","text":"stat_unique understands following aesthetics (required aesthetics bold):","code":""},{"path":"https://animint.github.io/animint2/reference/stat_unique.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove duplicates. — stat_unique","text":"","code":"ggplot(mtcars, aes(vs, am)) + geom_point(alpha = 0.1) ggplot(mtcars, aes(vs, am)) + geom_point(alpha = 0.1, stat=\"unique\")"},{"path":"https://animint.github.io/animint2/reference/summary.gganimintplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Displays a useful description of a ggplot object — summary.gganimintplot","title":"Displays a useful description of a ggplot object — summary.gganimintplot","text":"Displays useful description ggplot object","code":""},{"path":"https://animint.github.io/animint2/reference/summary.gganimintplot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Displays a useful description of a ggplot object — summary.gganimintplot","text":"","code":"# S3 method for gganimintplot summary(object, ...)"},{"path":"https://animint.github.io/animint2/reference/summary.gganimintplot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Displays a useful description of a ggplot object — summary.gganimintplot","text":"object ggplot2 object summarise ... arguments ignored (compatibility generic)","code":""},{"path":"https://animint.github.io/animint2/reference/summary.gganimintplot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Displays a useful description of a ggplot object — summary.gganimintplot","text":"","code":"p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() summary(p) #> data: mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb [32x11] #> mapping: x = mpg, y = wt #> faceting: facet_null() #> ----------------------------------- #> geom_point: na.rm = FALSE #> stat_identity: na.rm = FALSE #> position_identity #>"},{"path":"https://animint.github.io/animint2/reference/switch_axes.html","id":null,"dir":"Reference","previous_headings":"","what":"Flip axes in case of coord_flip\r\nSwitches column names. Eg. xmin to ymin, yntercept to xintercept etc. — switch_axes","title":"Flip axes in case of coord_flip\r\nSwitches column names. Eg. xmin to ymin, yntercept to xintercept etc. — switch_axes","text":"Flip axes case coord_flip Switches column names. Eg. xmin ymin, yntercept xintercept etc.","code":""},{"path":"https://animint.github.io/animint2/reference/switch_axes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flip axes in case of coord_flip\r\nSwitches column names. Eg. xmin to ymin, yntercept to xintercept etc. — switch_axes","text":"","code":"switch_axes(col.names)"},{"path":"https://animint.github.io/animint2/reference/switch_axes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flip axes in case of coord_flip\r\nSwitches column names. Eg. xmin to ymin, yntercept to xintercept etc. — switch_axes","text":"col.names Column names need switched","code":""},{"path":"https://animint.github.io/animint2/reference/switch_axes.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flip axes in case of coord_flip\r\nSwitches column names. Eg. xmin to ymin, yntercept to xintercept etc. — switch_axes","text":"Column names x y axes switched","code":""},{"path":"https://animint.github.io/animint2/reference/TestROC.html","id":null,"dir":"Reference","previous_headings":"","what":"Test ROC curves — TestROC","title":"Test ROC curves — TestROC","text":"Five peak detection models evaluated.","code":""},{"path":"https://animint.github.io/animint2/reference/TestROC.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test ROC curves — TestROC","text":"","code":"data(\"TestROC\")"},{"path":"https://animint.github.io/animint2/reference/TestROC.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Test ROC curves — TestROC","text":"list two data frames.","code":""},{"path":"https://animint.github.io/animint2/reference/TestROC.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Test ROC curves — TestROC","text":"https://bitbucket.org/mugqic/chip-seq-paper/src/master/figure-roc-test.R","code":""},{"path":"https://animint.github.io/animint2/reference/theme.html","id":null,"dir":"Reference","previous_headings":"","what":"Set theme elements — theme","title":"Set theme elements — theme","text":"Use function modify theme settings.","code":""},{"path":"https://animint.github.io/animint2/reference/theme.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set theme elements — theme","text":"","code":"theme(..., complete = FALSE, validate = TRUE)"},{"path":"https://animint.github.io/animint2/reference/theme.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set theme elements — theme","text":"... list element name, element pairings modify existing theme. complete set TRUE complete theme, one returned theme_grey(). Complete themes behave differently added ggplot object. validate TRUE run validate_element, FALSE bypass checks.","code":""},{"path":"https://animint.github.io/animint2/reference/theme.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set theme elements — theme","text":"Theme elements can inherit properties theme elements. example, axis.title.x inherits axis.title, turn inherits text. text elements inherit directly indirectly text; lines inherit line, rectangular objects inherit rect. examples modifying properties using inheritance, %+replace%. see graphical representation inheritance tree, see last example .","code":""},{"path":"https://animint.github.io/animint2/reference/theme.html","id":"theme-elements","dir":"Reference","previous_headings":"","what":"Theme elements","title":"Set theme elements — theme","text":"individual theme elements :","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/theme.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set theme elements — theme","text":"","code":"# \\donttest{ p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p p + theme(panel.background = element_rect(colour = \"pink\")) p + theme_bw() # Scatter plot of gas mileage by vehicle weight p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() # Calculate slope and intercept of line of best fit coef(lm(mpg ~ wt, data = mtcars)) #> (Intercept) wt #> 37.285126 -5.344472 p + geom_abline(intercept = 37, slope = -5) # Calculate correlation coefficient with(mtcars, cor(wt, mpg, use = \"everything\", method = \"pearson\")) #> [1] -0.8676594 #annotate the plot p + geom_abline(intercept = 37, slope = -5) + geom_text(data = data.frame(), aes(4.5, 30, label = \"Pearson-R = -.87\")) # Change the axis labels # Original plot p p + labs(x = \"Vehicle Weight\", y = \"Miles per Gallon\") # Or p + labs(x = \"Vehicle Weight\", y = \"Miles per Gallon\") # Change title appearance p <- p + labs(title = \"Vehicle Weight-Gas Mileage Relationship\") # Set title to twice the base font size p + theme(plot.title = element_text(size = rel(2))) p + theme(plot.title = element_text(size = rel(2), colour = \"blue\")) # Add a subtitle and adjust bottom margin p + labs(title = \"Vehicle Weight-Gas Mileage Relationship\", subtitle = \"You need to wrap long subtitleson manually\") + theme(plot.subtitle = element_text(margin = margin(b = 20))) # Changing plot look with themes DF <- data.frame(x = rnorm(400)) m <- ggplot(DF, aes(x = x)) + geom_histogram() # Default is theme_grey() m #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. # Compare with m + theme_bw() #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. # Manipulate Axis Attributes m + theme(axis.line = element_line(size = 3, colour = \"red\", linetype = \"dotted\")) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. m + theme(axis.text = element_text(colour = \"blue\")) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. m + theme(axis.text.y = element_blank()) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. m + theme(axis.ticks = element_line(size = 2)) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. m + theme(axis.title.y = element_text(size = rel(1.5), angle = 90)) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. m + theme(axis.title.x = element_blank()) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. m + theme(axis.ticks.length = unit(.85, \"cm\")) #> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. # Legend Attributes z <- ggplot(mtcars, aes(wt, mpg)) + geom_point(aes(colour = factor(cyl))) z z + theme(legend.position = \"none\") z + theme(legend.position = \"bottom\") # Or use relative coordinates between 0 and 1 z + theme(legend.position = c(.5, .5)) # Add a border to the whole legend z + theme(legend.background = element_rect(colour = \"black\")) # Legend margin controls extra space around outside of legend: z + theme(legend.background = element_rect(), legend.margin = unit(1, \"cm\")) z + theme(legend.background = element_rect(), legend.margin = unit(0, \"cm\")) # Or to just the keys z + theme(legend.key = element_rect(colour = \"black\")) z + theme(legend.key = element_rect(fill = \"yellow\")) z + theme(legend.key.size = unit(2.5, \"cm\")) z + theme(legend.text = element_text(size = 20, colour = \"red\", angle = 45)) z + theme(legend.title = element_text(face = \"italic\")) # To change the title of the legend use the name argument # in one of the scale options z + scale_colour_brewer(name = \"My Legend\") z + scale_colour_grey(name = \"Number of \\nCylinders\") # Panel and Plot Attributes z + theme(panel.background = element_rect(fill = \"black\")) z + theme(panel.border = element_rect(linetype = \"dashed\", colour = \"black\")) z + theme(panel.grid.major = element_line(colour = \"blue\")) z + theme(panel.grid.minor = element_line(colour = \"red\", linetype = \"dotted\")) z + theme(panel.grid.major = element_line(size = 2)) z + theme(panel.grid.major.y = element_blank(), panel.grid.minor.y = element_blank()) z + theme(plot.background = element_rect()) z + theme(plot.background = element_rect(fill = \"green\")) # Faceting Attributes set.seed(4940) dsmall <- diamonds[sample(nrow(diamonds), 1000), ] k <- ggplot(dsmall, aes(carat, ..density..)) + geom_histogram(binwidth = 0.2) + facet_grid(. ~ cut) k + theme(strip.background = element_rect(colour = \"purple\", fill = \"pink\", size = 3, linetype = \"dashed\")) k + theme(strip.text.x = element_text(colour = \"red\", angle = 45, size = 10, hjust = 0.5, vjust = 0.5)) k + theme(panel.margin = unit(5, \"lines\")) k + theme(panel.margin.y = unit(0, \"lines\")) # Put gridlines on top meanprice <- tapply(diamonds$price, diamonds$cut, mean) cut <- factor(levels(diamonds$cut), levels = levels(diamonds$cut)) df <- data.frame(meanprice, cut) g <- ggplot(df, aes(cut, meanprice)) + geom_bar(stat = \"identity\") g + geom_bar(stat = \"identity\") + theme(panel.background = element_blank(), panel.grid.major.x = element_blank(), panel.grid.minor.x = element_blank(), panel.grid.minor.y = element_blank(), panel.ontop = TRUE) # Modify a theme and save it mytheme <- theme_grey() + theme(plot.title = element_text(colour = \"red\")) p + mytheme # }"},{"path":"https://animint.github.io/animint2/reference/theme_animint.html","id":null,"dir":"Reference","previous_headings":"","what":"theme for passing animint specific params — theme_animint","title":"theme for passing animint specific params — theme_animint","text":"Theme without checks. allows us write theme_animint(width=500), instead theme(animint.width=500) gives error ggplot2 users informed mis-type standard theme element names. https://github.com/hadley/ggplot2/issues/938","code":""},{"path":"https://animint.github.io/animint2/reference/theme_animint.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"theme for passing animint specific params — theme_animint","text":"","code":"theme_animint(...)"},{"path":"https://animint.github.io/animint2/reference/theme_animint.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"theme for passing animint specific params — theme_animint","text":"... theme options width. Use update_axes=c(\"x\", \"y\") update axes plots. Works single selection variables.","code":""},{"path":"https://animint.github.io/animint2/reference/theme_animint.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"theme for passing animint specific params — theme_animint","text":"ggplot theme list names animint.width.","code":""},{"path":"https://animint.github.io/animint2/reference/theme_animint.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"theme for passing animint specific params — theme_animint","text":"Toby Dylan Hocking","code":""},{"path":"https://animint.github.io/animint2/reference/theme_animint.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"theme for passing animint specific params — theme_animint","text":"","code":"mtcars$cyl <- as.factor(mtcars$cyl) p <- ggplot() + geom_point(aes(x=wt, y=mpg, colour=cyl), data=mtcars) + ## set width and height values and update both axes theme_animint(width=600, height=600, update_axes=c(\"x\", \"y\")) viz <- list(plot=p, selector.types=list(cyl=\"single\")) animint2dir(viz)"},{"path":"https://animint.github.io/animint2/reference/theme_update.html","id":null,"dir":"Reference","previous_headings":"","what":"Get, set and update themes. — theme_update","title":"Get, set and update themes. — theme_update","text":"Use theme_get get current theme, theme_set completely override . theme_update theme_replace shorthands changing individual elements current theme. theme_update uses + operator, unspecified values theme element default values set theme. theme_replace completely replace element, unspecified values overwrite current value theme NULLs.","code":""},{"path":"https://animint.github.io/animint2/reference/theme_update.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get, set and update themes. — theme_update","text":"","code":"theme_update(...) theme_replace(...) theme_get() theme_set(new)"},{"path":"https://animint.github.io/animint2/reference/theme_update.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get, set and update themes. — theme_update","text":"... named list theme settings new new theme (list theme elements)","code":""},{"path":[]},{"path":"https://animint.github.io/animint2/reference/theme_update.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get, set and update themes. — theme_update","text":"","code":"p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p old <- theme_set(theme_bw()) p theme_set(old) p #theme_replace NULLs out the fill attribute of panel.background, #resulting in a white background: theme_get()$panel.background #> List of 4 #> $ fill : chr \"grey92\" #> $ colour : logi NA #> $ size : NULL #> $ linetype: NULL #> - attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" old <- theme_replace(panel.background = element_rect(colour = \"pink\")) theme_get()$panel.background #> List of 4 #> $ fill : NULL #> $ colour : chr \"pink\" #> $ size : NULL #> $ linetype: NULL #> - attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" p theme_set(old) #theme_update only changes the colour attribute, leaving the others intact: old <- theme_update(panel.background = element_rect(colour = \"pink\")) theme_get()$panel.background #> List of 4 #> $ fill : chr \"grey92\" #> $ colour : chr \"pink\" #> $ size : NULL #> $ linetype: NULL #> - attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" p theme_set(old) theme_get() #> List of 46 #> $ line :List of 4 #> ..$ colour : chr \"black\" #> ..$ size : num 0.5 #> ..$ linetype: num 1 #> ..$ lineend : chr \"butt\" #> ..- attr(*, \"class\")= chr [1:2] \"element_line\" \"element\" #> $ rect :List of 4 #> ..$ fill : chr \"white\" #> ..$ colour : chr \"black\" #> ..$ size : num 0.5 #> ..$ linetype: num 1 #> ..- attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" #> $ text :List of 10 #> ..$ family : chr \"\" #> ..$ face : chr \"plain\" #> ..$ colour : chr \"black\" #> ..$ size : num 11 #> ..$ hjust : num 0.5 #> ..$ vjust : num 0.5 #> ..$ angle : num 0 #> ..$ lineheight: num 0.9 #> ..$ margin : 'margin' num [1:4] 0points 0points 0points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : logi FALSE #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ axis.line :List of 4 #> ..$ colour : NULL #> ..$ size : NULL #> ..$ linetype: NULL #> ..$ lineend : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_line\" \"element\" #> $ axis.line.x : list() #> ..- attr(*, \"class\")= chr [1:2] \"element_blank\" \"element\" #> $ axis.line.y : list() #> ..- attr(*, \"class\")= chr [1:2] \"element_blank\" \"element\" #> $ axis.text :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : chr \"grey30\" #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : NULL #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ axis.text.x :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : num 1 #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ axis.text.y :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : num 1 #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ axis.ticks :List of 4 #> ..$ colour : chr \"grey20\" #> ..$ size : NULL #> ..$ linetype: NULL #> ..$ lineend : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_line\" \"element\" #> $ axis.ticks.length : 'simpleUnit' num 2.75points #> ..- attr(*, \"unit\")= int 8 #> $ axis.title.x :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 4.4points 0points 2.2points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ axis.title.y :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : num 90 #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 0points 4.4points 0points 2.2points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ legend.background :List of 4 #> ..$ fill : NULL #> ..$ colour : logi NA #> ..$ size : NULL #> ..$ linetype: NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" #> $ legend.margin : 'simpleUnit' num 0.2cm #> ..- attr(*, \"unit\")= int 1 #> $ legend.key :List of 4 #> ..$ fill : chr \"grey95\" #> ..$ colour : chr \"white\" #> ..$ size : NULL #> ..$ linetype: NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" #> $ legend.key.size : 'simpleUnit' num 1.2lines #> ..- attr(*, \"unit\")= int 3 #> $ legend.key.height : NULL #> $ legend.key.width : NULL #> $ legend.text :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : 'rel' num 0.8 #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : NULL #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ legend.text.align : NULL #> $ legend.title :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : num 0 #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : NULL #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ legend.title.align : NULL #> $ legend.position : chr \"right\" #> $ legend.direction : NULL #> $ legend.justification : chr \"center\" #> $ legend.box : NULL #> $ panel.background :List of 4 #> ..$ fill : chr \"grey92\" #> ..$ colour : logi NA #> ..$ size : NULL #> ..$ linetype: NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" #> $ panel.border : list() #> ..- attr(*, \"class\")= chr [1:2] \"element_blank\" \"element\" #> $ panel.grid.major :List of 4 #> ..$ colour : chr \"white\" #> ..$ size : NULL #> ..$ linetype: NULL #> ..$ lineend : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_line\" \"element\" #> $ panel.grid.minor :List of 4 #> ..$ colour : chr \"white\" #> ..$ size : num 0.25 #> ..$ linetype: NULL #> ..$ lineend : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_line\" \"element\" #> $ panel.margin : 'simpleUnit' num 5.5points #> ..- attr(*, \"unit\")= int 8 #> $ panel.margin.x : NULL #> $ panel.margin.y : NULL #> $ panel.ontop : logi FALSE #> $ strip.background :List of 4 #> ..$ fill : chr \"grey85\" #> ..$ colour : logi NA #> ..$ size : NULL #> ..$ linetype: NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" #> $ strip.text :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : chr \"grey10\" #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : NULL #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ strip.text.x :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 5.5points 0points 5.5points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ strip.text.y :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : NULL #> ..$ hjust : NULL #> ..$ vjust : NULL #> ..$ angle : num -90 #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 0points 5.5points 0points 5.5points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ strip.switch.pad.grid: 'simpleUnit' num 0.1cm #> ..- attr(*, \"unit\")= int 1 #> $ strip.switch.pad.wrap: 'simpleUnit' num 0.1cm #> ..- attr(*, \"unit\")= int 1 #> $ plot.background :List of 4 #> ..$ fill : NULL #> ..$ colour : chr \"white\" #> ..$ size : NULL #> ..$ linetype: NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_rect\" \"element\" #> $ plot.title :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : 'rel' num 1.2 #> ..$ hjust : num 0 #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 0points 0points 6.6points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ plot.subtitle :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : 'rel' num 0.9 #> ..$ hjust : num 0 #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 0points 0points 4.95points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ plot.caption :List of 10 #> ..$ family : NULL #> ..$ face : NULL #> ..$ colour : NULL #> ..$ size : 'rel' num 0.9 #> ..$ hjust : num 1 #> ..$ vjust : NULL #> ..$ angle : NULL #> ..$ lineheight: NULL #> ..$ margin : 'margin' num [1:4] 0points 0points 4.95points 0points #> .. ..- attr(*, \"unit\")= int 8 #> ..$ debug : NULL #> ..- attr(*, \"class\")= chr [1:2] \"element_text\" \"element\" #> $ plot.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points #> ..- attr(*, \"unit\")= int 8 #> - attr(*, \"class\")= chr [1:2] \"theme\" \"gganimint\" #> - attr(*, \"complete\")= logi TRUE #> - attr(*, \"validate\")= logi TRUE ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(color = mpg)) + theme(legend.position = c(0.95, 0.95), legend.justification = c(1, 1)) last_plot() + theme(legend.background = element_rect(fill = \"white\", colour = \"white\", size = 3))"},{"path":"https://animint.github.io/animint2/reference/toRGB.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert R colors to RGB hexadecimal color values — toRGB","title":"Convert R colors to RGB hexadecimal color values — toRGB","text":"Convert R colors RGB hexadecimal color values","code":""},{"path":"https://animint.github.io/animint2/reference/toRGB.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert R colors to RGB hexadecimal color values — toRGB","text":"","code":"toRGB(x)"},{"path":"https://animint.github.io/animint2/reference/toRGB.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert R colors to RGB hexadecimal color values — toRGB","text":"x character","code":""},{"path":"https://animint.github.io/animint2/reference/toRGB.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert R colors to RGB hexadecimal color values — toRGB","text":"hexadecimal color value \"transparent\" .na","code":""},{"path":"https://animint.github.io/animint2/reference/train_position.html","id":null,"dir":"Reference","previous_headings":"","what":"Train position scales with data — train_position","title":"Train position scales with data — train_position","text":"panel-specific scales already present, clone scales provided parameter","code":""},{"path":"https://animint.github.io/animint2/reference/train_position.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Train position scales with data — train_position","text":"","code":"train_position(panel, data, x_scale, y_scale)"},{"path":"https://animint.github.io/animint2/reference/train_position.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Train position scales with data — train_position","text":"panel panel object train data list data frames (one layer) x_scale x scale plot y_scale y scale plot","code":""},{"path":"https://animint.github.io/animint2/reference/transform_position.html","id":null,"dir":"Reference","previous_headings":"","what":"Convenience function to transform all position variables. — transform_position","title":"Convenience function to transform all position variables. — transform_position","text":"Convenience function transform position variables.","code":""},{"path":"https://animint.github.io/animint2/reference/transform_position.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convenience function to transform all position variables. — transform_position","text":"","code":"transform_position(df, trans_x = NULL, trans_y = NULL, ...)"},{"path":"https://animint.github.io/animint2/reference/transform_position.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convenience function to transform all position variables. — transform_position","text":"trans_x, trans_y Transformation functions x y aesthetics. (transform x, xmin, xmax, xend etc) ... Additional arguments passed trans_x trans_y.","code":""},{"path":"https://animint.github.io/animint2/reference/transform_shape.html","id":null,"dir":"Reference","previous_headings":"","what":"Function to transform R shapes into d3 shapes... — transform_shape","title":"Function to transform R shapes into d3 shapes... — transform_shape","text":"Function transform R shapes d3 shapes...","code":""},{"path":"https://animint.github.io/animint2/reference/transform_shape.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function to transform R shapes into d3 shapes... — transform_shape","text":"","code":"transform_shape(dframe)"},{"path":"https://animint.github.io/animint2/reference/transform_shape.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function to transform R shapes into d3 shapes... — transform_shape","text":"dframe Data frame columns shape, fill, colour.","code":""},{"path":"https://animint.github.io/animint2/reference/transform_shape.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function to transform R shapes into d3 shapes... — transform_shape","text":"Data frame transformed shape corresponds d3 shape. Also includes Rshape column debugging.","code":""},{"path":"https://animint.github.io/animint2/reference/translate_qplot_ggplot.html","id":null,"dir":"Reference","previous_headings":"","what":"Translating between qplot and ggplot — translate_qplot_ggplot","title":"Translating between qplot and ggplot — translate_qplot_ggplot","text":"Within ggplot2, two basic methods create plots, qplot() ggplot(). qplot() designed primarily interactive use: makes number assumptions speed cases, designing multilayered plots different data sources can get way. section describes defaults , map fuller ggplot() syntax.","code":""},{"path":"https://animint.github.io/animint2/reference/translate_qplot_ggplot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translating between qplot and ggplot — translate_qplot_ggplot","text":"","code":"# By default, qplot() assumes that you want a scatterplot, # i.e., you want to use geom_point() # qplot(x, y, data = data) # ggplot(data, aes(x, y)) + geom_point() # Using Aesthetics # If you map additional aesthetics, these will be added to the defaults. With # qplot() there is no way to use different aesthetic mappings (or data) in # different layers # qplot(x, y, data = data, shape = shape, colour = colour) # ggplot(data, aes(x, y, shape = shape, colour = colour)) + geom_point() # # Aesthetic parameters in qplot() always try to map the aesthetic to a # variable. If the argument is not a variable but a value, effectively a new column # is added to the original dataset with that value. To set an aesthetic to a # value and override the default appearance, you surround the value with I() in # qplot(), or pass it as a parameter to the layer. # qplot(x, y, data = data, colour = I(\"red\")) # ggplot(data, aes(x, y)) + geom_point(colour = \"red\") # Changing the geom parameter changes the geom added to the plot # qplot(x, y, data = data, geom = \"line\") # ggplot(data, aes(x, y)) + geom_line() # Not all geoms require both x and y, e.g., geom_bar() and geom_histogram(). # For these two geoms, if the y aesthetic is not supplied, both qplot and # ggplot commands default to \"count\" on the y-axis # ggplot(data, aes(x)) + geom_bar() # qplot(x, data = data, geom = \"bar\") # If a vector of multiple geom names is supplied to the geom argument, each # geom will be added in turn # qplot(x, y, data = data, geom = c(\"point\", \"smooth\")) # ggplot(data, aes(x, y)) + geom_point() + geom_smooth() # Unlike the rest of ggplot2, stats and geoms are independent # qplot(x, y, data = data, stat = \"bin\") # ggplot(data, aes(x, y)) + geom_point(stat = \"bin\") # # Any layer parameters will be passed on to all layers. Most layers will ignore # parameters that they don't need # qplot(x, y, data = data, geom = c(\"point\", \"smooth\"), method = \"lm\") # ggplot(data, aes(x, y)) + geom_point(method = \"lm\") + geom_smooth(method = \"lm\") # Scales and axes # You can control basic properties of the x and y scales with the xlim, ylim, # xlab and ylab arguments # qplot(x, y, data = data, xlim = c(1, 5), xlab = \"my label\") # ggplot(data, aes(x, y)) + geom_point() + # scale_x_continuous(\"my label\", limits = c(1, 5)) # qplot(x, y, data = data, xlim = c(1, 5), ylim = c(10, 20)) # ggplot(data, aes(x, y)) + geom_point() + # scale_x_continuous(limits = c(1, 5)) + scale_y_continuous(limits = c(10, 20)) # Like plot(), qplot() has a convenient way of log transforming the axes. # qplot(x, y, data = data, log = \"xy\") # ggplot(data, aes(x, y)) + geom_point() + scale_x_log10() + scale_y_log10() # There are many other possible transformations, but not all are # accessible from within qplot(), see ?scale_continuous for more # Plot options # qplot() recognises the same options as plot does, and converts them to their # ggplot2 equivalents. See ?theme for more on ggplot options # qplot(x, y, data = data, main=\"title\", asp = 1) # ggplot(data, aes(x, y)) + geom_point() + labs(title = \"title\") + theme(aspect.ratio = 1)"},{"path":"https://animint.github.io/animint2/reference/translate_qplot_lattice.html","id":null,"dir":"Reference","previous_headings":"","what":"Translating between qplot and lattice — translate_qplot_lattice","title":"Translating between qplot and lattice — translate_qplot_lattice","text":"major difference lattice ggplot2 lattice uses formula based interface. ggplot2 formula generalise well complicated situations.","code":""},{"path":"https://animint.github.io/animint2/reference/translate_qplot_lattice.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translating between qplot and lattice — translate_qplot_lattice","text":"","code":"# \\donttest{ library(lattice) if (require(\"ggplot2movies\")) { xyplot(rating ~ year, data=movies) qplot(year, rating, data=movies) xyplot(rating ~ year | Comedy + Action, data = movies) qplot(year, rating, data = movies, facets = ~ Comedy + Action) # Or maybe qplot(year, rating, data = movies, facets = Comedy ~ Action) # While lattice has many different functions to produce different types of # graphics (which are all basically equivalent to setting the panel argument), # ggplot2 has qplot(). stripplot(~ rating, data = movies, jitter.data = TRUE) qplot(rating, 1, data = movies, geom = \"jitter\") histogram(~ rating, data = movies) qplot(rating, data = movies, geom = \"histogram\") xyplot(wt ~ mpg, mtcars, type = c(\"p\",\"smooth\")) qplot(mpg, wt, data = mtcars, geom = c(\"point\",\"smooth\")) } # The capabilities for scale manipulations are similar in both ggplot2 and # lattice, although the syntax is a little different. xyplot(wt ~ mpg | cyl, mtcars, scales = list(y = list(relation = \"free\"))) qplot(mpg, wt, data = mtcars) + facet_wrap(~ cyl, scales = \"free\") xyplot(wt ~ mpg | cyl, mtcars, scales = list(log = 10)) qplot(mpg, wt, data = mtcars, log = \"xy\") xyplot(wt ~ mpg | cyl, mtcars, scales = list(log = 2)) qplot(mpg, wt, data = mtcars) + scale_x_continuous(trans = scales::log2_trans()) + scale_y_continuous(trans = scales::log2_trans()) xyplot(wt ~ mpg, mtcars, group = cyl, auto.key = TRUE) # Map directly to an aesthetic like colour, size, or shape. qplot(mpg, wt, data = mtcars, colour = cyl) xyplot(wt ~ mpg, mtcars, xlim = c(20,30)) # Works like lattice, except you can't specify a different limit # for each panel/facet qplot(mpg, wt, data = mtcars, xlim = c(20,30)) #> Warning: Removed 22 rows containing missing values (geom_point). # Both lattice and ggplot2 have similar options for controlling labels on the plot. xyplot(wt ~ mpg, mtcars, xlab = \"Miles per gallon\", ylab = \"Weight\", main = \"Weight-efficiency tradeoff\") qplot(mpg, wt, data = mtcars, xlab = \"Miles per gallon\", ylab = \"Weight\", main = \"Weight-efficiency tradeoff\") xyplot(wt ~ mpg, mtcars, aspect = 1) qplot(mpg, wt, data = mtcars, asp = 1) # par.settings() is equivalent to + theme() and trellis.options.set() # and trellis.par.get() to theme_set() and theme_get(). # More complicated lattice formulas are equivalent to rearranging the data # before using ggplot2. # }"},{"path":"https://animint.github.io/animint2/reference/txhousing.html","id":null,"dir":"Reference","previous_headings":"","what":"Housing sales in TX. — txhousing","title":"Housing sales in TX. — txhousing","text":"Information housing market Texas provided TAMU real estate center, https://www.recenter.tamu.edu/.","code":""},{"path":"https://animint.github.io/animint2/reference/txhousing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Housing sales in TX. — txhousing","text":"","code":"txhousing"},{"path":"https://animint.github.io/animint2/reference/txhousing.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Housing sales in TX. — txhousing","text":"data frame 8602 observations 9 variables: cityName MLS area year,month,dateDate salesNumber sales volumeTotal value sales medianMedian sale price listingsTotal active listings inventory\"Months inventory\": amount time take sell current listings current pace sales.","code":""},{"path":"https://animint.github.io/animint2/reference/update_defaults.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify geom/stat aesthetic defaults for future plots — update_geom_defaults","title":"Modify geom/stat aesthetic defaults for future plots — update_geom_defaults","text":"Modify geom/stat aesthetic defaults future plots","code":""},{"path":"https://animint.github.io/animint2/reference/update_defaults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify geom/stat aesthetic defaults for future plots — update_geom_defaults","text":"","code":"update_geom_defaults(geom, new) update_stat_defaults(stat, new)"},{"path":"https://animint.github.io/animint2/reference/update_defaults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify geom/stat aesthetic defaults for future plots — update_geom_defaults","text":"new Named list aesthetics. stat, geom Name geom/stat modify (like \"point\" \"bin\"), Geom/Stat object (like GeomPoint StatBin).","code":""},{"path":"https://animint.github.io/animint2/reference/update_defaults.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify geom/stat aesthetic defaults for future plots — update_geom_defaults","text":"","code":"update_geom_defaults(\"point\", list(colour = \"darkblue\")) ggplot(mtcars, aes(mpg, wt)) + geom_point() update_geom_defaults(\"point\", list(colour = \"black\"))"},{"path":"https://animint.github.io/animint2/reference/update_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Update axis/legend labels — update_labels","title":"Update axis/legend labels — update_labels","text":"Update axis/legend labels","code":""},{"path":"https://animint.github.io/animint2/reference/update_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update axis/legend labels — update_labels","text":"","code":"update_labels(p, labels)"},{"path":"https://animint.github.io/animint2/reference/update_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update axis/legend labels — update_labels","text":"p plot modify labels named list new labels","code":""},{"path":"https://animint.github.io/animint2/reference/update_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Update axis/legend labels — update_labels","text":"","code":"p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() update_labels(p, list(x = \"New x\")) update_labels(p, list(x = expression(x / y ^ 2))) update_labels(p, list(x = \"New x\", y = \"New Y\")) update_labels(p, list(colour = \"Fail silently\"))"},{"path":"https://animint.github.io/animint2/reference/UStornadoes.html","id":null,"dir":"Reference","previous_headings":"","what":"Tornadoes in the United States from 1950 to 2012 — UStornadoes","title":"Tornadoes in the United States from 1950 to 2012 — UStornadoes","text":"row documents 1 tornado.","code":""},{"path":"https://animint.github.io/animint2/reference/UStornadoes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tornadoes in the United States from 1950 to 2012 — UStornadoes","text":"","code":"data(UStornadoes)"},{"path":"https://animint.github.io/animint2/reference/UStornadoes.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Tornadoes in the United States from 1950 to 2012 — UStornadoes","text":"data frame 41620 observations following 32 variables. fips numeric vector ID numeric vector year numeric vector month numeric vector day numeric vector date factor time numeric vector tz numeric vector state factor state.tnum numeric vector f numeric vector injuries numeric vector fatalities numeric vector propertyLoss numeric vector cropLoss numeric vector startLat numeric vector startLong numeric vector endLat numeric vector endLong numeric vector trackLength numeric vector trackWidth numeric vector numStatesAffected numeric vector stateNumber numeric vector segmentNumber numeric vector FipsCounty1 numeric vector FipsCounty2 numeric vector FipsCounty3 numeric vector FipsCounty4 numeric vector TotalPop2012 numeric vector LandArea numeric vector TornadoesSqMile numeric vector weight numeric vector","code":""},{"path":"https://animint.github.io/animint2/reference/UStornadoes.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Tornadoes in the United States from 1950 to 2012 — UStornadoes","text":"NOAA SVRGIS data (Severe Report Database + Geographic Information System) http://www.spc.noaa.gov/gis/svrgis/","code":""},{"path":"https://animint.github.io/animint2/reference/VariantModels.html","id":null,"dir":"Reference","previous_headings":"","what":"Error rates of supervised learning methods for variant calling — VariantModels","title":"Error rates of supervised learning methods for variant calling — VariantModels","text":"Several supervised machine learning models applied binary classification task predicting True Positive False Positive variants, using several filtering scores input.","code":""},{"path":"https://animint.github.io/animint2/reference/VariantModels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Error rates of supervised learning methods for variant calling — VariantModels","text":"","code":"data(\"VariantModels\")"},{"path":"https://animint.github.io/animint2/reference/VariantModels.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Error rates of supervised learning methods for variant calling — VariantModels","text":"List 6 data.frames: roc, auc, error, ranks, thresholds, minima.","code":""},{"path":"https://animint.github.io/animint2/reference/VariantModels.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Error rates of supervised learning methods for variant calling — VariantModels","text":"https://github.com/tdhock/malaria-evolution-viz/blob/master/figure-folds.R","code":""},{"path":"https://animint.github.io/animint2/reference/varied.chunk.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract subset for each data.frame in a list of data.frame — varied.chunk","title":"Extract subset for each data.frame in a list of data.frame — varied.chunk","text":"Extract subset data.frame list data.frame","code":""},{"path":"https://animint.github.io/animint2/reference/varied.chunk.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract subset for each data.frame in a list of data.frame — varied.chunk","text":"","code":"varied.chunk(dt.or.list, cols)"},{"path":"https://animint.github.io/animint2/reference/varied.chunk.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract subset for each data.frame in a list of data.frame — varied.chunk","text":"dt..list data.table list data.table. cols cols data.frame keep.","code":""},{"path":"https://animint.github.io/animint2/reference/varied.chunk.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract subset for each data.frame in a list of data.frame — varied.chunk","text":"list data.frame.","code":""},{"path":"https://animint.github.io/animint2/reference/vervet.html","id":null,"dir":"Reference","previous_headings":"","what":"Vervet monkey intestinal microbiome — vervet","title":"Vervet monkey intestinal microbiome — vervet","text":"DNA sequences (55mers) bacteria gastrointestinal tract 23 vervet (African green) monkeys Wake Forest University Primate Center Vervet Research Colony. monkeys measured several locations, total 64 samples. goal analyzing data determine whether similar bacteria detected nearby locations, assuming 55mer uniquely identifies bacterium.","code":""},{"path":"https://animint.github.io/animint2/reference/vervet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vervet monkey intestinal microbiome — vervet","text":"","code":"data(vervet)"},{"path":"https://animint.github.io/animint2/reference/vervet.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Vervet monkey intestinal microbiome — vervet","text":"format named list data.frames: samples contains 64 rows sample-specific info, counts contains 1190208 rows counts 55mers observed sample, monkeys contains 23 rows monkey-specific information.","code":""},{"path":"https://animint.github.io/animint2/reference/vervet.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Vervet monkey intestinal microbiome — vervet","text":"DNA sequencing funded Genome Quebec generated McGill Innovation Center. info Vervet Microbiome project http://www.genomequebec.mcgill.ca/compgen/vervet_research/ http://genome.wustl.edu/projects/detail/vervet-microbiome/","code":""},{"path":"https://animint.github.io/animint2/reference/waiver.html","id":null,"dir":"Reference","previous_headings":"","what":"A waiver object. — waiver","title":"A waiver object. — waiver","text":"waiver \"flag\" object, similar NULL, indicates calling function just use default value. used certain functions distinguish displaying nothing (NULL) displaying default value calculated elsewhere (waiver())","code":""},{"path":"https://animint.github.io/animint2/reference/waiver.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A waiver object. — waiver","text":"","code":"waiver()"},{"path":"https://animint.github.io/animint2/reference/WorldBank.html","id":null,"dir":"Reference","previous_headings":"","what":"Demographics by country from 1960 to 2012 — WorldBank","title":"Demographics by country from 1960 to 2012 — WorldBank","text":"row one year demographics one country.","code":""},{"path":"https://animint.github.io/animint2/reference/WorldBank.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Demographics by country from 1960 to 2012 — WorldBank","text":"","code":"data(WorldBank)"},{"path":"https://animint.github.io/animint2/reference/WorldBank.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Demographics by country from 1960 to 2012 — WorldBank","text":"data frame 11342 observations following 15 variables. iso2c character vector country character vector year numeric vector fertility.rate numeric vector life.expectancy numeric vector population numeric vector GDP.per.capita.Current.USD numeric vector 15..25.yr.female.literacy numeric vector iso3c factor region factor capital factor longitude factor latitude factor income factor lending factor","code":""},{"path":"https://animint.github.io/animint2/reference/WorldBank.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Demographics by country from 1960 to 2012 — WorldBank","text":"Copied googleVis package.","code":""},{"path":"https://animint.github.io/animint2/reference/worldPop.html","id":null,"dir":"Reference","previous_headings":"","what":"World population by subcontinent — worldPop","title":"World population by subcontinent — worldPop","text":"World population data used simple example polychart.js website, data can used recreate example using animint.","code":""},{"path":"https://animint.github.io/animint2/reference/worldPop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"World population by subcontinent — worldPop","text":"","code":"data(worldPop)"},{"path":"https://animint.github.io/animint2/reference/worldPop.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"World population by subcontinent — worldPop","text":"data frame 294 observations following 4 variables. subcontinent factor: subcontinent name year integer: year measurement population integer: number people subcontinent year type factor levels actual estimate","code":""},{"path":"https://animint.github.io/animint2/reference/worldPop.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"World population by subcontinent — worldPop","text":"https://github.com/Polychart/polychart2/blob/master/example/population.coffee","code":""},{"path":"https://animint.github.io/animint2/reference/zeroGrob.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero grob draws nothing and has zero size. — zeroGrob","title":"The zero grob draws nothing and has zero size. — zeroGrob","text":"zero grob draws nothing zero size.","code":""},{"path":"https://animint.github.io/animint2/reference/zeroGrob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero grob draws nothing and has zero size. — zeroGrob","text":"","code":"zeroGrob()"},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2023611","dir":"Changelog","previous_headings":"","what":"Changes in 2023.6.11","title":"Changes in 2023.6.11","text":"Remove maptools dependency. split.x -> split_recursive silence new CRAN check. setDTthreads(1) examples CRAN.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2023314","dir":"Changelog","previous_headings":"","what":"Changes in 2023.3.14","title":"Changes in 2023.3.14","text":"Changes satisfy CRAN (import , consistent function args, graphical-units.Rd, rm Fox book URL stat_ellipse.Rd). facet plot title text size configurable via theme(strip.text, axis.text).","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022914","dir":"Changelog","previous_headings":"","what":"Changes in 2022.9.14","title":"Changes in 2022.9.14","text":"Include Yufan Fei contributor DESCRIPTION.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022914-1","dir":"Changelog","previous_headings":"","what":"Changes in 2022.9.14","title":"Changes in 2022.9.14","text":"Allow configurable legend/axis text size via theme.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022831","dir":"Changelog","previous_headings":"","what":"Changes in 2022.8.31","title":"Changes in 2022.8.31","text":"User-configurable selection styles, alpha_off colour_off.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022825","dir":"Changelog","previous_headings":"","what":"Changes in 2022.8.25","title":"Changes in 2022.8.25","text":"import data.table, faster compilation.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022525","dir":"Changelog","previous_headings":"","what":"Changes in 2022.5.25","title":"Changes in 2022.5.25","text":"Add ability rotate geom_text labels, following ggplot2’s semantics rotation direction.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022524","dir":"Changelog","previous_headings":"","what":"Changes in 2022.5.24","title":"Changes in 2022.5.24","text":"Fixed small test regression set Github Actions. Neither user facing.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-202222","dir":"Changelog","previous_headings":"","what":"Changes in 2022.2.2","title":"Changes in 2022.2.2","text":"Default x/y axis text size increased 16px 11px animint.js. Suggest RColorBrewer avoid CRAN NOTE “Undeclared package RColorBrewer Rd xrefs”.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2022125","dir":"Changelog","previous_headings":"","what":"Changes in 2022.1.25","title":"Changes in 2022.1.25","text":"Remove geom/stat_boxplot/quantile due errors CRAN check.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2020918","dir":"Changelog","previous_headings":"","what":"Changes in 2020.9.18","title":"Changes in 2020.9.18","text":"update moved mcmaster URL docs.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2020819","dir":"Changelog","previous_headings":"","what":"Changes in 2020.8.19","title":"Changes in 2020.8.19","text":"Move geom-specific code saveLayer/-else Geom$export_animint pre_process methods Geom sub-classes.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-202079","dir":"Changelog","previous_headings":"","what":"Changes in 2020.7.9","title":"Changes in 2020.7.9","text":"Using RSelenium 1.7.4. Removed Defunct Redundant code/examples. User can test using docker avoid incompatibility issues. imports knitr knit_print imported namespace. Use new grid::unitType() determine unit type margin pt/points line conversion.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-202032","dir":"Changelog","previous_headings":"","what":"Changes in 2020.3.2","title":"Changes in 2020.3.2","text":"data.frame(stringsAsFactors=TRUE) tests.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2019712","dir":"Changelog","previous_headings":"","what":"Changes in 2019.7.12","title":"Changes in 2019.7.12","text":"Added three authors mentioned Rd/R files.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-201973","dir":"Changelog","previous_headings":"","what":"Changes in 2019.7.3","title":"Changes in 2019.7.3","text":"ggsave(file.path(tempdir(), f)) examples.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-201972","dir":"Changelog","previous_headings":"","what":"Changes in 2019.7.2","title":"Changes in 2019.7.2","text":"animint2dir writes temp dir rather user dir examples/tests.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-201964","dir":"Changelog","previous_headings":"","what":"Changes in 2019.6.4","title":"Changes in 2019.6.4","text":"bugfix facet_grid(scales/space=“free”) bugfix update_axes geom_abline bugfix graph height computation, showed lots rows facet spec.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-20181214","dir":"Changelog","previous_headings":"","what":"Changes in 2018.12.14","title":"Changes in 2018.12.14","text":"animint fun, export print method. infinite values converted range min/max saving tsv files.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-2018104","dir":"Changelog","previous_headings":"","what":"Changes in 2018.10.4","title":"Changes in 2018.10.4","text":"DEP: longer depend branch ggplot2. train_layout ggplot2 - R/panel.r function now g_train_layout. train_layout animint2 - R/z_facet.R function . internal functions.","code":""},{"path":"https://animint.github.io/animint2/news/index.html","id":"changes-in-20170824","dir":"Changelog","previous_headings":"","what":"Changes in 2017.08.24","title":"Changes in 2017.08.24","text":"DSL: clickSelects/showSelected now specified parameters rather aesthetics.","code":""}] diff --git a/docs/sitemap.xml b/docs/sitemap.xml deleted file mode 100644 index 067301f73..000000000 --- a/docs/sitemap.xml +++ /dev/null @@ -1,756 +0,0 @@ - - - - https://animint.github.io/animint2/404.html - - - https://animint.github.io/animint2/articles/animint2.html - - - https://animint.github.io/animint2/articles/basicscuteplotcolored/index.html - - - https://animint.github.io/animint2/articles/basicscuteplotcolored/scripts.html - - - https://animint.github.io/animint2/articles/basicscutepresent/index.html - - - https://animint.github.io/animint2/articles/basicscutepresent/scripts.html - - - https://animint.github.io/animint2/articles/clickselectscutecoloredagain/index.html - - - https://animint.github.io/animint2/articles/clickselectscutecoloredagain/scripts.html - - - https://animint.github.io/animint2/articles/clickselectscuteplotkind/index.html - - - https://animint.github.io/animint2/articles/clickselectscuteplotkind/scripts.html - - - https://animint.github.io/animint2/articles/index.html - - - https://animint.github.io/animint2/articles/linkedplots/index.html - - - https://animint.github.io/animint2/articles/linkedplots/scripts.html - - - https://animint.github.io/animint2/articles/showselectedanimatedassociations/index.html - - - https://animint.github.io/animint2/articles/showselectedanimatedassociations/scripts.html - - - https://animint.github.io/animint2/articles/showselectedassociations/index.html - - - https://animint.github.io/animint2/articles/showselectedassociations/scripts.html - - - https://animint.github.io/animint2/authors.html - - - https://animint.github.io/animint2/index.html - - - https://animint.github.io/animint2/news/index.html - - - https://animint.github.io/animint2/readme_website.html - - - https://animint.github.io/animint2/reference/absoluteGrob.html - - - https://animint.github.io/animint2/reference/addShowSelectedForLegend.html - - - https://animint.github.io/animint2/reference/addSSandCSasAesthetics.html - - - https://animint.github.io/animint2/reference/add_theme.html - - - https://animint.github.io/animint2/reference/aes.html - - - https://animint.github.io/animint2/reference/aes_.html - - - https://animint.github.io/animint2/reference/aes_all.html - - - https://animint.github.io/animint2/reference/aes_auto.html - - - https://animint.github.io/animint2/reference/aes_colour_fill_alpha.html - - - https://animint.github.io/animint2/reference/aes_linetype_size_shape.html - - - https://animint.github.io/animint2/reference/aes_position.html - - - https://animint.github.io/animint2/reference/animint.html - - - https://animint.github.io/animint2/reference/animint2-gganimintproto.html - - - https://animint.github.io/animint2/reference/animint2dir.html - - - https://animint.github.io/animint2/reference/animint2gist.html - - - https://animint.github.io/animint2/reference/animintOutput.html - - - https://animint.github.io/animint2/reference/annotate.html - - - https://animint.github.io/animint2/reference/annotation_custom.html - - - https://animint.github.io/animint2/reference/annotation_logticks.html - - - https://animint.github.io/animint2/reference/annotation_map.html - - - https://animint.github.io/animint2/reference/annotation_raster.html - - - https://animint.github.io/animint2/reference/as.list.gganimintproto.html - - - https://animint.github.io/animint2/reference/as_labeller.html - - - https://animint.github.io/animint2/reference/autoplot.html - - - https://animint.github.io/animint2/reference/benchplot.html - - - https://animint.github.io/animint2/reference/borders.html - - - https://animint.github.io/animint2/reference/breakpoints.html - - - https://animint.github.io/animint2/reference/calc_element.html - - - https://animint.github.io/animint2/reference/change.html - - - https://animint.github.io/animint2/reference/checkAnimationTimeVar.html - - - https://animint.github.io/animint2/reference/checkExtraParams.html - - - https://animint.github.io/animint2/reference/checkForSSandCSasAesthetics.html - - - https://animint.github.io/animint2/reference/checkPlotForAnimintExtensions.html - - - https://animint.github.io/animint2/reference/checkPlotList.html - - - https://animint.github.io/animint2/reference/checkSingleShowSelectedValue.html - - - https://animint.github.io/animint2/reference/ChromHMMiterations.html - - - https://animint.github.io/animint2/reference/climate.html - - - https://animint.github.io/animint2/reference/colsNotToCopy.html - - - https://animint.github.io/animint2/reference/compare.html - - - https://animint.github.io/animint2/reference/continuous_scale.html - - - https://animint.github.io/animint2/reference/coord_cartesian.html - - - https://animint.github.io/animint2/reference/coord_fixed.html - - - https://animint.github.io/animint2/reference/coord_flip.html - - - https://animint.github.io/animint2/reference/coord_map.html - - - https://animint.github.io/animint2/reference/coord_munch.html - - - https://animint.github.io/animint2/reference/coord_polar.html - - - https://animint.github.io/animint2/reference/coord_trans.html - - - https://animint.github.io/animint2/reference/cut_interval.html - - - https://animint.github.io/animint2/reference/diamonds.html - - - https://animint.github.io/animint2/reference/discrete_scale.html - - - https://animint.github.io/animint2/reference/draw_key.html - - - https://animint.github.io/animint2/reference/economics.html - - - https://animint.github.io/animint2/reference/element_blank.html - - - https://animint.github.io/animint2/reference/element_grob.html - - - https://animint.github.io/animint2/reference/element_line.html - - - https://animint.github.io/animint2/reference/element_rect.html - - - https://animint.github.io/animint2/reference/element_text.html - - - https://animint.github.io/animint2/reference/expand_limits.html - - - https://animint.github.io/animint2/reference/facet.html - - - https://animint.github.io/animint2/reference/facet_grid.html - - - https://animint.github.io/animint2/reference/facet_null.html - - - https://animint.github.io/animint2/reference/facet_wrap.html - - - https://animint.github.io/animint2/reference/faithfuld.html - - - https://animint.github.io/animint2/reference/FluView.html - - - https://animint.github.io/animint2/reference/format.gganimintproto.html - - - https://animint.github.io/animint2/reference/fortify.html - - - https://animint.github.io/animint2/reference/fortify.lm.html - - - https://animint.github.io/animint2/reference/fortify.map.html - - - https://animint.github.io/animint2/reference/fortify.sp.html - - - https://animint.github.io/animint2/reference/FunctionalPruning.html - - - https://animint.github.io/animint2/reference/generation.loci.html - - - https://animint.github.io/animint2/reference/geom_abline.html - - - https://animint.github.io/animint2/reference/geom_bar.html - - - https://animint.github.io/animint2/reference/geom_bin2d.html - - - https://animint.github.io/animint2/reference/geom_blank.html - - - https://animint.github.io/animint2/reference/geom_contour.html - - - https://animint.github.io/animint2/reference/geom_count.html - - - https://animint.github.io/animint2/reference/geom_density.html - - - https://animint.github.io/animint2/reference/geom_density_2d.html - - - https://animint.github.io/animint2/reference/geom_dotplot.html - - - https://animint.github.io/animint2/reference/geom_errorbarh.html - - - https://animint.github.io/animint2/reference/geom_hex.html - - - https://animint.github.io/animint2/reference/geom_histogram.html - - - https://animint.github.io/animint2/reference/geom_jitter.html - - - https://animint.github.io/animint2/reference/geom_linerange.html - - - https://animint.github.io/animint2/reference/geom_map.html - - - https://animint.github.io/animint2/reference/geom_path.html - - - https://animint.github.io/animint2/reference/geom_point.html - - - https://animint.github.io/animint2/reference/geom_polygon.html - - - https://animint.github.io/animint2/reference/geom_ribbon.html - - - https://animint.github.io/animint2/reference/geom_rug.html - - - https://animint.github.io/animint2/reference/geom_segment.html - - - https://animint.github.io/animint2/reference/geom_smooth.html - - - https://animint.github.io/animint2/reference/geom_spoke.html - - - https://animint.github.io/animint2/reference/geom_tallrect.html - - - https://animint.github.io/animint2/reference/geom_text.html - - - https://animint.github.io/animint2/reference/geom_tile.html - - - https://animint.github.io/animint2/reference/geom_violin.html - - - https://animint.github.io/animint2/reference/geom_widerect.html - - - https://animint.github.io/animint2/reference/getCommonChunk.html - - - https://animint.github.io/animint2/reference/getLayerName.html - - - https://animint.github.io/animint2/reference/getLayerParams.html - - - https://animint.github.io/animint2/reference/getLegend.html - - - https://animint.github.io/animint2/reference/getLegendList.html - - - https://animint.github.io/animint2/reference/getTextSize.html - - - https://animint.github.io/animint2/reference/getUniqueAxisLabels.html - - - https://animint.github.io/animint2/reference/gg-add.html - - - https://animint.github.io/animint2/reference/gganimintproto.html - - - https://animint.github.io/animint2/reference/ggplot.html - - - https://animint.github.io/animint2/reference/ggplotGrob.html - - - https://animint.github.io/animint2/reference/ggplot_build.html - - - https://animint.github.io/animint2/reference/ggplot_gtable.html - - - https://animint.github.io/animint2/reference/ggsave.html - - - https://animint.github.io/animint2/reference/ggtheme.html - - - https://animint.github.io/animint2/reference/gg_dep.html - - - https://animint.github.io/animint2/reference/graphical-units.html - - - https://animint.github.io/animint2/reference/guides.html - - - https://animint.github.io/animint2/reference/guide_colourbar.html - - - https://animint.github.io/animint2/reference/guide_legend.html - - - https://animint.github.io/animint2/reference/g_train_layout.html - - - https://animint.github.io/animint2/reference/hmisc.html - - - https://animint.github.io/animint2/reference/index.html - - - https://animint.github.io/animint2/reference/intreg.html - - - https://animint.github.io/animint2/reference/is.Coord.html - - - https://animint.github.io/animint2/reference/is.facet.html - - - https://animint.github.io/animint2/reference/is.gganimintproto.html - - - https://animint.github.io/animint2/reference/is.ggplot.html - - - https://animint.github.io/animint2/reference/is.rel.html - - - https://animint.github.io/animint2/reference/is.rgb.html - - - https://animint.github.io/animint2/reference/is.theme.html - - - https://animint.github.io/animint2/reference/issueSelectorWarnings.html - - - https://animint.github.io/animint2/reference/knit_print.animint.html - - - https://animint.github.io/animint2/reference/labeller.html - - - https://animint.github.io/animint2/reference/labellers.html - - - https://animint.github.io/animint2/reference/label_bquote.html - - - https://animint.github.io/animint2/reference/labs.html - - - https://animint.github.io/animint2/reference/last_plot.html - - - https://animint.github.io/animint2/reference/layer.html - - - https://animint.github.io/animint2/reference/limits.html - - - https://animint.github.io/animint2/reference/lims.html - - - https://animint.github.io/animint2/reference/luv_colours.html - - - https://animint.github.io/animint2/reference/make_bar.html - - - https://animint.github.io/animint2/reference/make_tallrect.html - - - https://animint.github.io/animint2/reference/make_tallrect_or_widerect.html - - - https://animint.github.io/animint2/reference/make_text.html - - - https://animint.github.io/animint2/reference/make_widerect.html - - - https://animint.github.io/animint2/reference/malaria.html - - - https://animint.github.io/animint2/reference/map_data.html - - - https://animint.github.io/animint2/reference/margin.html - - - https://animint.github.io/animint2/reference/mean_se.html - - - https://animint.github.io/animint2/reference/merge_recurse.html - - - https://animint.github.io/animint2/reference/midwest.html - - - https://animint.github.io/animint2/reference/mixtureKNN.html - - - https://animint.github.io/animint2/reference/montreal.bikes.html - - - https://animint.github.io/animint2/reference/mpg.html - - - https://animint.github.io/animint2/reference/msleep.html - - - https://animint.github.io/animint2/reference/newEnvironment.html - - - https://animint.github.io/animint2/reference/parsePlot.html - - - https://animint.github.io/animint2/reference/PeakConsistency.html - - - https://animint.github.io/animint2/reference/pirates.html - - - https://animint.github.io/animint2/reference/position_dodge.html - - - https://animint.github.io/animint2/reference/position_identity.html - - - https://animint.github.io/animint2/reference/position_jitter.html - - - https://animint.github.io/animint2/reference/position_jitterdodge.html - - - https://animint.github.io/animint2/reference/position_nudge.html - - - https://animint.github.io/animint2/reference/position_stack.html - - - https://animint.github.io/animint2/reference/presidential.html - - - https://animint.github.io/animint2/reference/print.animint.html - - - https://animint.github.io/animint2/reference/print.gganimintplot.html - - - https://animint.github.io/animint2/reference/print.gganimintproto.html - - - https://animint.github.io/animint2/reference/prior.html - - - https://animint.github.io/animint2/reference/prostateLasso.html - - - https://animint.github.io/animint2/reference/pt.to.lines.html - - - https://animint.github.io/animint2/reference/qplot.html - - - https://animint.github.io/animint2/reference/reexports.html - - - https://animint.github.io/animint2/reference/rel.html - - - https://animint.github.io/animint2/reference/remove_missing.html - - - https://animint.github.io/animint2/reference/renderAnimint.html - - - https://animint.github.io/animint2/reference/resolution.html - - - https://animint.github.io/animint2/reference/saveChunks.html - - - https://animint.github.io/animint2/reference/scale_alpha.html - - - https://animint.github.io/animint2/reference/scale_brewer.html - - - https://animint.github.io/animint2/reference/scale_continuous.html - - - https://animint.github.io/animint2/reference/scale_date.html - - - https://animint.github.io/animint2/reference/scale_discrete.html - - - https://animint.github.io/animint2/reference/scale_gradient.html - - - https://animint.github.io/animint2/reference/scale_grey.html - - - https://animint.github.io/animint2/reference/scale_hue.html - - - https://animint.github.io/animint2/reference/scale_identity.html - - - https://animint.github.io/animint2/reference/scale_linetype.html - - - https://animint.github.io/animint2/reference/scale_manual.html - - - https://animint.github.io/animint2/reference/scale_shape.html - - - https://animint.github.io/animint2/reference/scale_size.html - - - https://animint.github.io/animint2/reference/scale_size_animint.html - - - https://animint.github.io/animint2/reference/seals.html - - - https://animint.github.io/animint2/reference/selectSSandCS.html - - - https://animint.github.io/animint2/reference/setPlotSizes.html - - - https://animint.github.io/animint2/reference/should_stop.html - - - https://animint.github.io/animint2/reference/split_recursive.html - - - https://animint.github.io/animint2/reference/stat_ecdf.html - - - https://animint.github.io/animint2/reference/stat_ellipse.html - - - https://animint.github.io/animint2/reference/stat_function.html - - - https://animint.github.io/animint2/reference/stat_identity.html - - - https://animint.github.io/animint2/reference/stat_qq.html - - - https://animint.github.io/animint2/reference/stat_summary.html - - - https://animint.github.io/animint2/reference/stat_summary_2d.html - - - https://animint.github.io/animint2/reference/stat_unique.html - - - https://animint.github.io/animint2/reference/summary.gganimintplot.html - - - https://animint.github.io/animint2/reference/switch_axes.html - - - https://animint.github.io/animint2/reference/TestROC.html - - - https://animint.github.io/animint2/reference/theme.html - - - https://animint.github.io/animint2/reference/theme_animint.html - - - https://animint.github.io/animint2/reference/theme_update.html - - - https://animint.github.io/animint2/reference/toRGB.html - - - https://animint.github.io/animint2/reference/train_position.html - - - https://animint.github.io/animint2/reference/transform_position.html - - - https://animint.github.io/animint2/reference/transform_shape.html - - - https://animint.github.io/animint2/reference/translate_qplot_ggplot.html - - - https://animint.github.io/animint2/reference/translate_qplot_lattice.html - - - https://animint.github.io/animint2/reference/txhousing.html - - - https://animint.github.io/animint2/reference/update_defaults.html - - - https://animint.github.io/animint2/reference/update_labels.html - - - https://animint.github.io/animint2/reference/UStornadoes.html - - - https://animint.github.io/animint2/reference/VariantModels.html - - - https://animint.github.io/animint2/reference/varied.chunk.html - - - https://animint.github.io/animint2/reference/vervet.html - - - https://animint.github.io/animint2/reference/waiver.html - - - https://animint.github.io/animint2/reference/WorldBank.html - - - https://animint.github.io/animint2/reference/worldPop.html - - - https://animint.github.io/animint2/reference/zeroGrob.html - - diff --git a/docs/articles/basicscutepresent/animint.js b/vignettes/basicscuteplotcolored/animint.js similarity index 78% rename from docs/articles/basicscutepresent/animint.js rename to vignettes/basicscuteplotcolored/animint.js index 01dd1e740..3097224df 100644 --- a/docs/articles/basicscutepresent/animint.js +++ b/vignettes/basicscuteplotcolored/animint.js @@ -148,6 +148,10 @@ var animint = function (to_select, json_file) { var element = d3.select(to_select); this.element = element; var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); var Widgets = {}; this.Widgets = Widgets; var Selectors = {}; @@ -180,29 +184,6 @@ var animint = function (to_select, json_file) { ".axis text {font-family: sans-serif;font-size: 11px;}"]; var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; // Determine if data will be an object or an array. if(g_info.geom in data_object_geoms){ g_info.data_is_object = true; @@ -228,8 +209,8 @@ var animint = function (to_select, json_file) { g_info.common_tsv = common_tsv; var common_path = getTSVpath(common_tsv); d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); }); } else { g_info.common_tsv = null; @@ -241,7 +222,7 @@ var animint = function (to_select, json_file) { // Each plot may have one or more legends. To make space for the // legends, we put each plot in a table with one row and two // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); + var plot_table = plot_td.append("table").style("display", "inline-block"); var plot_tr = plot_table.append("tr"); var tdLeft = plot_tr.append("td"); var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); @@ -326,7 +307,7 @@ var animint = function (to_select, json_file) { return measureText(entry, p_info.ysize).width + 5; })); } - var axispaddingx = 10 + 20; + var axispaddingx = 30; // distance between tick marks and x axis name. if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ // TODO: throw warning if text height is large portion of plot height? axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ @@ -1054,141 +1035,118 @@ var animint = function (to_select, json_file) { var layer_g_element = svg.select("g." + g_info.classed); var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); }; + var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; + var get_style_on_stroke_width = get_size; // stroke_width for geom_point var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; } var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } + var get_dasharray = function(d){ + var lt = get_linetype(d); return linetypesize2dasharray(lt, get_size(d)); }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; } - const get_angle = function(d) { + var get_rotate = function(d){ // x and y are the coordinates to rotate around, we choose the center // point of the text because otherwise it will rotate around (0,0) of its // coordinate system, which is the top left of the plot x = scales["x"](d["x"]); y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } + var angle = get_angle(d); // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so // we negate the angle. return `rotate(${-angle}, ${x}, ${y})`; }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - // For aes(hjust) the compiler should make an "anchor" column. var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } var get_text_anchor; if(g_info.aes.hasOwnProperty("hjust")) { get_text_anchor = function(d){ @@ -1200,26 +1158,20 @@ var animint = function (to_select, json_file) { } } - var eActions, eAppend, linkActions; + var eActions, eAppend; var key_fun = null; - var id_fun = function(d){ - return d.id; - }; if(g_info.aes.hasOwnProperty("key")){ key_fun = function(d){ return d.key; }; } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; if(g_info.data_is_object) { // Lines, paths, polygons, and ribbons are a bit special. For @@ -1313,27 +1265,19 @@ var animint = function (to_select, json_file) { .x(toXY("x", "x")) .y(toXY("y", "y")); } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } // select the correct group before returning anything. key_fun = function(group_info){ return group_info.value; }; - id_fun = function(group_info){ + data_to_bind = kv; + get_one_row = function(group_info) { var one_group = keyed_data[group_info.value]; var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; + return one_row; }; eActions = function (e) { e.attr("d", function (d) { @@ -1348,304 +1292,256 @@ var animint = function (to_select, json_file) { }); return lineThing(no_na); }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } }; eAppend = "path"; }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { return scales.x(d["x"]); }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); elements.exit().remove(); var enter = elements.enter(); if(g_info.aes.hasOwnProperty("href")){ @@ -1653,81 +1549,11 @@ var animint = function (to_select, json_file) { .append("svg:"+eAppend); }else{ enter = enter.append(eAppend) - .attr("class", "geom"); + .attr("class", "geom"); } + var moreActions = function(e){}; if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; + moreActions = out_fun; elements.call(out_fun) .on("mouseover", function (d) { d3.select(this).call(over_fun); @@ -1738,9 +1564,6 @@ var animint = function (to_select, json_file) { ; if(has_clickSelects){ elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. var s_name = g_info.aes.clickSelects; update_selector(s_name, d.clickSelects); }); @@ -1751,25 +1574,19 @@ var animint = function (to_select, json_file) { update_selector(s_name, s_value); }); } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } + var text_fun; if(has_tooltip){ text_fun = function(d){ return d.tooltip; @@ -1787,37 +1604,29 @@ var animint = function (to_select, json_file) { // if elements have an existing title, remove it. elements.selectAll("title").remove(); elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) + .text(get_fun(text_fun)) ; } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! if(Selectors.hasOwnProperty(selector_name)){ var milliseconds = Selectors[selector_name].duration; elements = elements.transition().duration(milliseconds); } if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); + elements.attr("id", get_attr("id")); } if(g_info.aes.hasOwnProperty("href")){ // elements are , children are e.g. var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); }else{ // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) + doActions(elements); // Set the attributes of all elements (enter/exit/stay) } }; - - var value_tostring = function(selected_values) { //function that is helpful to change the format of the string var selector_url="#" @@ -1852,19 +1661,6 @@ var animint = function (to_select, json_file) { return selected_values; }; - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - // update scales for the plots that have update_axes option in // theme_animint function update_scales(p_name, axes, v_name, value){ @@ -2257,10 +2053,14 @@ var animint = function (to_select, json_file) { //////////////////////////////////////////// // Widgets at bottom of page //////////////////////////////////////////// - element.append("br"); - + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } // loading table. - var show_hide_table = element.append("button") + var show_hide_table = widget_td.append("button") .text("Show download status table"); show_hide_table .on("click", function(){ @@ -2272,7 +2072,7 @@ var animint = function (to_select, json_file) { show_hide_table.text("Show download status table"); } }); - var loading = element.append("table") + var loading = widget_td.append("table") .style("display", "none"); Widgets["loading"] = loading; var tr = loading.append("tr"); @@ -2290,7 +2090,7 @@ var animint = function (to_select, json_file) { // Animation control widgets. var show_message = "Show animation controls"; // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") + var show_hide_animation_controls = widget_td.append("button") .text(show_message) .attr("id", viz_id + "_show_hide_animation_controls") .on("click", function(){ @@ -2304,7 +2104,7 @@ var animint = function (to_select, json_file) { }) ; // table of the animint widgets - var time_table = element.append("table") + var time_table = widget_td.append("table") .style("display", "none"); var first_tr = time_table.append("tr"); var first_th = first_tr.append("th"); @@ -2381,13 +2181,13 @@ var animint = function (to_select, json_file) { d3.select(".urltable").style("display","none") } } - var show_hide_selector_widgets = element.append("button") + var show_hide_selector_widgets = widget_td.append("button") .text(toggle_message) .attr("class", "show_hide_selector_widgets") .on("click", show_or_hide_fun) ; // adding a table for selector widgets - var selector_table = element.append("table") + var selector_table = widget_td.append("table") .style("display", "none") .attr("class", "table_selector_widgets") ; diff --git a/docs/articles/basicscuteplotcolored/geom1_point_cuteplotcolored_chunk1.tsv b/vignettes/basicscuteplotcolored/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/basicscuteplotcolored/geom1_point_cuteplotcolored_chunk1.tsv rename to vignettes/basicscuteplotcolored/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/basicscuteplotcolored/index.html b/vignettes/basicscuteplotcolored/index.html similarity index 100% rename from docs/articles/basicscuteplotcolored/index.html rename to vignettes/basicscuteplotcolored/index.html diff --git a/docs/articles/basicscuteplotcolored/plot.json b/vignettes/basicscuteplotcolored/plot.json similarity index 96% rename from docs/articles/basicscuteplotcolored/plot.json rename to vignettes/basicscuteplotcolored/plot.json index 4aeef1f02..60c739ebb 100644 --- a/docs/articles/basicscuteplotcolored/plot.json +++ b/vignettes/basicscuteplotcolored/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_cuteplotcolored": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_cuteplotcolored", +"classed": "geom1_point_plot1", "aes": { "x": "Day", "y": "Cuteness", @@ -43,12 +43,12 @@ "selected": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_cuteplotcolored" + "geom1_point_plot1" ] } }, "plots": { - "cuteplotcolored": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -287,7 +287,7 @@ "height": 400 }, "geoms": [ - "geom1_point_cuteplotcolored" + "geom1_point_plot1" ] } } diff --git a/docs/articles/basicscuteplotcolored/scripts.html b/vignettes/basicscuteplotcolored/scripts.html similarity index 100% rename from docs/articles/basicscuteplotcolored/scripts.html rename to vignettes/basicscuteplotcolored/scripts.html diff --git a/docs/articles/basicscuteplotcolored/styles.css b/vignettes/basicscuteplotcolored/styles.css similarity index 100% rename from docs/articles/basicscuteplotcolored/styles.css rename to vignettes/basicscuteplotcolored/styles.css diff --git a/docs/articles/basicscuteplotcolored/vendor/d3.v3.js b/vignettes/basicscuteplotcolored/vendor/d3.v3.js similarity index 100% rename from docs/articles/basicscuteplotcolored/vendor/d3.v3.js rename to vignettes/basicscuteplotcolored/vendor/d3.v3.js diff --git a/docs/articles/basicscuteplotcolored/vendor/jquery-1.11.3.min.js b/vignettes/basicscuteplotcolored/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/basicscuteplotcolored/vendor/jquery-1.11.3.min.js rename to vignettes/basicscuteplotcolored/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/basicscuteplotcolored/vendor/selectize.css b/vignettes/basicscuteplotcolored/vendor/selectize.css similarity index 100% rename from docs/articles/basicscuteplotcolored/vendor/selectize.css rename to vignettes/basicscuteplotcolored/vendor/selectize.css diff --git a/docs/articles/basicscuteplotcolored/vendor/selectize.min.js b/vignettes/basicscuteplotcolored/vendor/selectize.min.js similarity index 100% rename from docs/articles/basicscuteplotcolored/vendor/selectize.min.js rename to vignettes/basicscuteplotcolored/vendor/selectize.min.js diff --git a/docs/articles/basicscuteplotcolored/animint.js b/vignettes/basicscutepresent/animint.js similarity index 78% rename from docs/articles/basicscuteplotcolored/animint.js rename to vignettes/basicscutepresent/animint.js index 01dd1e740..3097224df 100644 --- a/docs/articles/basicscuteplotcolored/animint.js +++ b/vignettes/basicscutepresent/animint.js @@ -148,6 +148,10 @@ var animint = function (to_select, json_file) { var element = d3.select(to_select); this.element = element; var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); var Widgets = {}; this.Widgets = Widgets; var Selectors = {}; @@ -180,29 +184,6 @@ var animint = function (to_select, json_file) { ".axis text {font-family: sans-serif;font-size: 11px;}"]; var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; // Determine if data will be an object or an array. if(g_info.geom in data_object_geoms){ g_info.data_is_object = true; @@ -228,8 +209,8 @@ var animint = function (to_select, json_file) { g_info.common_tsv = common_tsv; var common_path = getTSVpath(common_tsv); d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); }); } else { g_info.common_tsv = null; @@ -241,7 +222,7 @@ var animint = function (to_select, json_file) { // Each plot may have one or more legends. To make space for the // legends, we put each plot in a table with one row and two // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); + var plot_table = plot_td.append("table").style("display", "inline-block"); var plot_tr = plot_table.append("tr"); var tdLeft = plot_tr.append("td"); var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); @@ -326,7 +307,7 @@ var animint = function (to_select, json_file) { return measureText(entry, p_info.ysize).width + 5; })); } - var axispaddingx = 10 + 20; + var axispaddingx = 30; // distance between tick marks and x axis name. if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ // TODO: throw warning if text height is large portion of plot height? axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ @@ -1054,141 +1035,118 @@ var animint = function (to_select, json_file) { var layer_g_element = svg.select("g." + g_info.classed); var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); }; + var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; + var get_style_on_stroke_width = get_size; // stroke_width for geom_point var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; } var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } + var get_dasharray = function(d){ + var lt = get_linetype(d); return linetypesize2dasharray(lt, get_size(d)); }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; } - const get_angle = function(d) { + var get_rotate = function(d){ // x and y are the coordinates to rotate around, we choose the center // point of the text because otherwise it will rotate around (0,0) of its // coordinate system, which is the top left of the plot x = scales["x"](d["x"]); y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } + var angle = get_angle(d); // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so // we negate the angle. return `rotate(${-angle}, ${x}, ${y})`; }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - // For aes(hjust) the compiler should make an "anchor" column. var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } var get_text_anchor; if(g_info.aes.hasOwnProperty("hjust")) { get_text_anchor = function(d){ @@ -1200,26 +1158,20 @@ var animint = function (to_select, json_file) { } } - var eActions, eAppend, linkActions; + var eActions, eAppend; var key_fun = null; - var id_fun = function(d){ - return d.id; - }; if(g_info.aes.hasOwnProperty("key")){ key_fun = function(d){ return d.key; }; } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; if(g_info.data_is_object) { // Lines, paths, polygons, and ribbons are a bit special. For @@ -1313,27 +1265,19 @@ var animint = function (to_select, json_file) { .x(toXY("x", "x")) .y(toXY("y", "y")); } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } // select the correct group before returning anything. key_fun = function(group_info){ return group_info.value; }; - id_fun = function(group_info){ + data_to_bind = kv; + get_one_row = function(group_info) { var one_group = keyed_data[group_info.value]; var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; + return one_row; }; eActions = function (e) { e.attr("d", function (d) { @@ -1348,304 +1292,256 @@ var animint = function (to_select, json_file) { }); return lineThing(no_na); }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } }; eAppend = "path"; }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { return scales.x(d["x"]); }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); elements.exit().remove(); var enter = elements.enter(); if(g_info.aes.hasOwnProperty("href")){ @@ -1653,81 +1549,11 @@ var animint = function (to_select, json_file) { .append("svg:"+eAppend); }else{ enter = enter.append(eAppend) - .attr("class", "geom"); + .attr("class", "geom"); } + var moreActions = function(e){}; if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; + moreActions = out_fun; elements.call(out_fun) .on("mouseover", function (d) { d3.select(this).call(over_fun); @@ -1738,9 +1564,6 @@ var animint = function (to_select, json_file) { ; if(has_clickSelects){ elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. var s_name = g_info.aes.clickSelects; update_selector(s_name, d.clickSelects); }); @@ -1751,25 +1574,19 @@ var animint = function (to_select, json_file) { update_selector(s_name, s_value); }); } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } + var text_fun; if(has_tooltip){ text_fun = function(d){ return d.tooltip; @@ -1787,37 +1604,29 @@ var animint = function (to_select, json_file) { // if elements have an existing title, remove it. elements.selectAll("title").remove(); elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) + .text(get_fun(text_fun)) ; } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! if(Selectors.hasOwnProperty(selector_name)){ var milliseconds = Selectors[selector_name].duration; elements = elements.transition().duration(milliseconds); } if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); + elements.attr("id", get_attr("id")); } if(g_info.aes.hasOwnProperty("href")){ // elements are , children are e.g. var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); }else{ // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) + doActions(elements); // Set the attributes of all elements (enter/exit/stay) } }; - - var value_tostring = function(selected_values) { //function that is helpful to change the format of the string var selector_url="#" @@ -1852,19 +1661,6 @@ var animint = function (to_select, json_file) { return selected_values; }; - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - // update scales for the plots that have update_axes option in // theme_animint function update_scales(p_name, axes, v_name, value){ @@ -2257,10 +2053,14 @@ var animint = function (to_select, json_file) { //////////////////////////////////////////// // Widgets at bottom of page //////////////////////////////////////////// - element.append("br"); - + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } // loading table. - var show_hide_table = element.append("button") + var show_hide_table = widget_td.append("button") .text("Show download status table"); show_hide_table .on("click", function(){ @@ -2272,7 +2072,7 @@ var animint = function (to_select, json_file) { show_hide_table.text("Show download status table"); } }); - var loading = element.append("table") + var loading = widget_td.append("table") .style("display", "none"); Widgets["loading"] = loading; var tr = loading.append("tr"); @@ -2290,7 +2090,7 @@ var animint = function (to_select, json_file) { // Animation control widgets. var show_message = "Show animation controls"; // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") + var show_hide_animation_controls = widget_td.append("button") .text(show_message) .attr("id", viz_id + "_show_hide_animation_controls") .on("click", function(){ @@ -2304,7 +2104,7 @@ var animint = function (to_select, json_file) { }) ; // table of the animint widgets - var time_table = element.append("table") + var time_table = widget_td.append("table") .style("display", "none"); var first_tr = time_table.append("tr"); var first_th = first_tr.append("th"); @@ -2381,13 +2181,13 @@ var animint = function (to_select, json_file) { d3.select(".urltable").style("display","none") } } - var show_hide_selector_widgets = element.append("button") + var show_hide_selector_widgets = widget_td.append("button") .text(toggle_message) .attr("class", "show_hide_selector_widgets") .on("click", show_or_hide_fun) ; // adding a table for selector widgets - var selector_table = element.append("table") + var selector_table = widget_td.append("table") .style("display", "none") .attr("class", "table_selector_widgets") ; diff --git a/docs/articles/basicscutepresent/geom1_point_cuteplot2_chunk1.tsv b/vignettes/basicscutepresent/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/basicscutepresent/geom1_point_cuteplot2_chunk1.tsv rename to vignettes/basicscutepresent/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/basicscutepresent/index.html b/vignettes/basicscutepresent/index.html similarity index 100% rename from docs/articles/basicscutepresent/index.html rename to vignettes/basicscutepresent/index.html diff --git a/docs/articles/basicscutepresent/plot.json b/vignettes/basicscutepresent/plot.json similarity index 96% rename from docs/articles/basicscutepresent/plot.json rename to vignettes/basicscutepresent/plot.json index a4266e4e8..e8c71c0fe 100644 --- a/docs/articles/basicscutepresent/plot.json +++ b/vignettes/basicscutepresent/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_cuteplotcolored": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_cuteplotcolored", +"classed": "geom1_point_plot1", "aes": { "x": "Day", "y": "Cuteness", @@ -43,12 +43,12 @@ "selected": [ "Archibald", "Muffin" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_cuteplotcolored" + "geom1_point_plot1" ] } }, "plots": { - "cuteplotcolored": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -287,7 +287,7 @@ "height": 400 }, "geoms": [ - "geom1_point_cuteplotcolored" + "geom1_point_plot1" ] } } diff --git a/docs/articles/basicscutepresent/scripts.html b/vignettes/basicscutepresent/scripts.html similarity index 100% rename from docs/articles/basicscutepresent/scripts.html rename to vignettes/basicscutepresent/scripts.html diff --git a/docs/articles/basicscutepresent/styles.css b/vignettes/basicscutepresent/styles.css similarity index 100% rename from docs/articles/basicscutepresent/styles.css rename to vignettes/basicscutepresent/styles.css diff --git a/docs/articles/basicscutepresent/vendor/d3.v3.js b/vignettes/basicscutepresent/vendor/d3.v3.js similarity index 100% rename from docs/articles/basicscutepresent/vendor/d3.v3.js rename to vignettes/basicscutepresent/vendor/d3.v3.js diff --git a/docs/articles/basicscutepresent/vendor/jquery-1.11.3.min.js b/vignettes/basicscutepresent/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/basicscutepresent/vendor/jquery-1.11.3.min.js rename to vignettes/basicscutepresent/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/basicscutepresent/vendor/selectize.css b/vignettes/basicscutepresent/vendor/selectize.css similarity index 100% rename from docs/articles/basicscutepresent/vendor/selectize.css rename to vignettes/basicscutepresent/vendor/selectize.css diff --git a/docs/articles/basicscutepresent/vendor/selectize.min.js b/vignettes/basicscutepresent/vendor/selectize.min.js similarity index 100% rename from docs/articles/basicscutepresent/vendor/selectize.min.js rename to vignettes/basicscutepresent/vendor/selectize.min.js diff --git a/docs/articles/clickselectscuteplotkind/animint.js b/vignettes/clickselectscutecoloredagain/animint.js similarity index 78% rename from docs/articles/clickselectscuteplotkind/animint.js rename to vignettes/clickselectscutecoloredagain/animint.js index 01dd1e740..3097224df 100644 --- a/docs/articles/clickselectscuteplotkind/animint.js +++ b/vignettes/clickselectscutecoloredagain/animint.js @@ -148,6 +148,10 @@ var animint = function (to_select, json_file) { var element = d3.select(to_select); this.element = element; var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); var Widgets = {}; this.Widgets = Widgets; var Selectors = {}; @@ -180,29 +184,6 @@ var animint = function (to_select, json_file) { ".axis text {font-family: sans-serif;font-size: 11px;}"]; var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; // Determine if data will be an object or an array. if(g_info.geom in data_object_geoms){ g_info.data_is_object = true; @@ -228,8 +209,8 @@ var animint = function (to_select, json_file) { g_info.common_tsv = common_tsv; var common_path = getTSVpath(common_tsv); d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); }); } else { g_info.common_tsv = null; @@ -241,7 +222,7 @@ var animint = function (to_select, json_file) { // Each plot may have one or more legends. To make space for the // legends, we put each plot in a table with one row and two // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); + var plot_table = plot_td.append("table").style("display", "inline-block"); var plot_tr = plot_table.append("tr"); var tdLeft = plot_tr.append("td"); var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); @@ -326,7 +307,7 @@ var animint = function (to_select, json_file) { return measureText(entry, p_info.ysize).width + 5; })); } - var axispaddingx = 10 + 20; + var axispaddingx = 30; // distance between tick marks and x axis name. if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ // TODO: throw warning if text height is large portion of plot height? axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ @@ -1054,141 +1035,118 @@ var animint = function (to_select, json_file) { var layer_g_element = svg.select("g." + g_info.classed); var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); }; + var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; + var get_style_on_stroke_width = get_size; // stroke_width for geom_point var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; } var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } + var get_dasharray = function(d){ + var lt = get_linetype(d); return linetypesize2dasharray(lt, get_size(d)); }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; } - const get_angle = function(d) { + var get_rotate = function(d){ // x and y are the coordinates to rotate around, we choose the center // point of the text because otherwise it will rotate around (0,0) of its // coordinate system, which is the top left of the plot x = scales["x"](d["x"]); y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } + var angle = get_angle(d); // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so // we negate the angle. return `rotate(${-angle}, ${x}, ${y})`; }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - // For aes(hjust) the compiler should make an "anchor" column. var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } var get_text_anchor; if(g_info.aes.hasOwnProperty("hjust")) { get_text_anchor = function(d){ @@ -1200,26 +1158,20 @@ var animint = function (to_select, json_file) { } } - var eActions, eAppend, linkActions; + var eActions, eAppend; var key_fun = null; - var id_fun = function(d){ - return d.id; - }; if(g_info.aes.hasOwnProperty("key")){ key_fun = function(d){ return d.key; }; } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; if(g_info.data_is_object) { // Lines, paths, polygons, and ribbons are a bit special. For @@ -1313,27 +1265,19 @@ var animint = function (to_select, json_file) { .x(toXY("x", "x")) .y(toXY("y", "y")); } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } // select the correct group before returning anything. key_fun = function(group_info){ return group_info.value; }; - id_fun = function(group_info){ + data_to_bind = kv; + get_one_row = function(group_info) { var one_group = keyed_data[group_info.value]; var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; + return one_row; }; eActions = function (e) { e.attr("d", function (d) { @@ -1348,304 +1292,256 @@ var animint = function (to_select, json_file) { }); return lineThing(no_na); }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } }; eAppend = "path"; }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { return scales.x(d["x"]); }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); elements.exit().remove(); var enter = elements.enter(); if(g_info.aes.hasOwnProperty("href")){ @@ -1653,81 +1549,11 @@ var animint = function (to_select, json_file) { .append("svg:"+eAppend); }else{ enter = enter.append(eAppend) - .attr("class", "geom"); + .attr("class", "geom"); } + var moreActions = function(e){}; if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; + moreActions = out_fun; elements.call(out_fun) .on("mouseover", function (d) { d3.select(this).call(over_fun); @@ -1738,9 +1564,6 @@ var animint = function (to_select, json_file) { ; if(has_clickSelects){ elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. var s_name = g_info.aes.clickSelects; update_selector(s_name, d.clickSelects); }); @@ -1751,25 +1574,19 @@ var animint = function (to_select, json_file) { update_selector(s_name, s_value); }); } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } + var text_fun; if(has_tooltip){ text_fun = function(d){ return d.tooltip; @@ -1787,37 +1604,29 @@ var animint = function (to_select, json_file) { // if elements have an existing title, remove it. elements.selectAll("title").remove(); elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) + .text(get_fun(text_fun)) ; } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! if(Selectors.hasOwnProperty(selector_name)){ var milliseconds = Selectors[selector_name].duration; elements = elements.transition().duration(milliseconds); } if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); + elements.attr("id", get_attr("id")); } if(g_info.aes.hasOwnProperty("href")){ // elements are , children are e.g. var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); }else{ // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) + doActions(elements); // Set the attributes of all elements (enter/exit/stay) } }; - - var value_tostring = function(selected_values) { //function that is helpful to change the format of the string var selector_url="#" @@ -1852,19 +1661,6 @@ var animint = function (to_select, json_file) { return selected_values; }; - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - // update scales for the plots that have update_axes option in // theme_animint function update_scales(p_name, axes, v_name, value){ @@ -2257,10 +2053,14 @@ var animint = function (to_select, json_file) { //////////////////////////////////////////// // Widgets at bottom of page //////////////////////////////////////////// - element.append("br"); - + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } // loading table. - var show_hide_table = element.append("button") + var show_hide_table = widget_td.append("button") .text("Show download status table"); show_hide_table .on("click", function(){ @@ -2272,7 +2072,7 @@ var animint = function (to_select, json_file) { show_hide_table.text("Show download status table"); } }); - var loading = element.append("table") + var loading = widget_td.append("table") .style("display", "none"); Widgets["loading"] = loading; var tr = loading.append("tr"); @@ -2290,7 +2090,7 @@ var animint = function (to_select, json_file) { // Animation control widgets. var show_message = "Show animation controls"; // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") + var show_hide_animation_controls = widget_td.append("button") .text(show_message) .attr("id", viz_id + "_show_hide_animation_controls") .on("click", function(){ @@ -2304,7 +2104,7 @@ var animint = function (to_select, json_file) { }) ; // table of the animint widgets - var time_table = element.append("table") + var time_table = widget_td.append("table") .style("display", "none"); var first_tr = time_table.append("tr"); var first_th = first_tr.append("th"); @@ -2381,13 +2181,13 @@ var animint = function (to_select, json_file) { d3.select(".urltable").style("display","none") } } - var show_hide_selector_widgets = element.append("button") + var show_hide_selector_widgets = widget_td.append("button") .text(toggle_message) .attr("class", "show_hide_selector_widgets") .on("click", show_or_hide_fun) ; // adding a table for selector widgets - var selector_table = element.append("table") + var selector_table = widget_td.append("table") .style("display", "none") .attr("class", "table_selector_widgets") ; diff --git a/docs/articles/clickselectscutecoloredagain/geom1_point_cutecoloredagain_chunk1.tsv b/vignettes/clickselectscutecoloredagain/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/clickselectscutecoloredagain/geom1_point_cutecoloredagain_chunk1.tsv rename to vignettes/clickselectscutecoloredagain/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/clickselectscutecoloredagain/index.html b/vignettes/clickselectscutecoloredagain/index.html similarity index 100% rename from docs/articles/clickselectscutecoloredagain/index.html rename to vignettes/clickselectscutecoloredagain/index.html diff --git a/docs/articles/clickselectscutecoloredagain/plot.json b/vignettes/clickselectscutecoloredagain/plot.json similarity index 96% rename from docs/articles/clickselectscutecoloredagain/plot.json rename to vignettes/clickselectscutecoloredagain/plot.json index 2f6d3a916..bc0a5c154 100644 --- a/docs/articles/clickselectscutecoloredagain/plot.json +++ b/vignettes/clickselectscutecoloredagain/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_cutecoloredagain": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_cutecoloredagain", +"classed": "geom1_point_plot1", "aes": { "x": "Day", "y": "Cuteness", @@ -47,12 +47,12 @@ "selected": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_cutecoloredagain" + "geom1_point_plot1" ] } }, "plots": { - "cutecoloredagain": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -290,7 +290,7 @@ "height": 400 }, "geoms": [ - "geom1_point_cutecoloredagain" + "geom1_point_plot1" ] } } diff --git a/docs/articles/clickselectscutecoloredagain/scripts.html b/vignettes/clickselectscutecoloredagain/scripts.html similarity index 100% rename from docs/articles/clickselectscutecoloredagain/scripts.html rename to vignettes/clickselectscutecoloredagain/scripts.html diff --git a/docs/articles/clickselectscutecoloredagain/styles.css b/vignettes/clickselectscutecoloredagain/styles.css similarity index 100% rename from docs/articles/clickselectscutecoloredagain/styles.css rename to vignettes/clickselectscutecoloredagain/styles.css diff --git a/docs/articles/clickselectscutecoloredagain/vendor/d3.v3.js b/vignettes/clickselectscutecoloredagain/vendor/d3.v3.js similarity index 100% rename from docs/articles/clickselectscutecoloredagain/vendor/d3.v3.js rename to vignettes/clickselectscutecoloredagain/vendor/d3.v3.js diff --git a/docs/articles/clickselectscutecoloredagain/vendor/jquery-1.11.3.min.js b/vignettes/clickselectscutecoloredagain/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/clickselectscutecoloredagain/vendor/jquery-1.11.3.min.js rename to vignettes/clickselectscutecoloredagain/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/clickselectscutecoloredagain/vendor/selectize.css b/vignettes/clickselectscutecoloredagain/vendor/selectize.css similarity index 100% rename from docs/articles/clickselectscutecoloredagain/vendor/selectize.css rename to vignettes/clickselectscutecoloredagain/vendor/selectize.css diff --git a/docs/articles/clickselectscutecoloredagain/vendor/selectize.min.js b/vignettes/clickselectscutecoloredagain/vendor/selectize.min.js similarity index 100% rename from docs/articles/clickselectscutecoloredagain/vendor/selectize.min.js rename to vignettes/clickselectscutecoloredagain/vendor/selectize.min.js diff --git a/docs/articles/clickselectscutecoloredagain/animint.js b/vignettes/clickselectscuteplotkind/animint.js similarity index 78% rename from docs/articles/clickselectscutecoloredagain/animint.js rename to vignettes/clickselectscuteplotkind/animint.js index 01dd1e740..3097224df 100644 --- a/docs/articles/clickselectscutecoloredagain/animint.js +++ b/vignettes/clickselectscuteplotkind/animint.js @@ -148,6 +148,10 @@ var animint = function (to_select, json_file) { var element = d3.select(to_select); this.element = element; var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); var Widgets = {}; this.Widgets = Widgets; var Selectors = {}; @@ -180,29 +184,6 @@ var animint = function (to_select, json_file) { ".axis text {font-family: sans-serif;font-size: 11px;}"]; var add_geom = function (g_name, g_info) { - // Determine what style to use to show the selection for this - // geom. This is a hack and should be removed when we implement - // the selected.color, selected.size, etc aesthetics. - // - // 2022.08.01 update: get rid of the hack of "rect stroke" to - // implement a general function for alpha_off, color_off. - // In order to have multiple styles functioning together - // so here use array to store the styles. - // Default using alpha/opacity style, execpt rect/tile geom - // rect/tile geom default using stroke style - let select_styles = []; - let has_colour_off = g_info.params.hasOwnProperty("colour_off") || g_info.aes.hasOwnProperty("colour_off"); - let has_alpha_off = g_info.params.hasOwnProperty("alpha_off") || g_info.aes.hasOwnProperty("alpha_off"); - if(has_colour_off || g_info.geom == "rect"){ - select_styles.push("stroke"); - } - if (has_alpha_off){ - select_styles.push("opacity"); - } - if (!has_colour_off && !has_alpha_off && !select_styles.length){ - select_styles = ["opacity"]; - } - g_info.select_style = select_styles; // Determine if data will be an object or an array. if(g_info.geom in data_object_geoms){ g_info.data_is_object = true; @@ -228,8 +209,8 @@ var animint = function (to_select, json_file) { g_info.common_tsv = common_tsv; var common_path = getTSVpath(common_tsv); d3.tsv(common_path, function (error, response) { - var converted = convert_R_types(response, g_info.types); - g_info.data[common_tsv] = nest_by_group.map(converted); + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); }); } else { g_info.common_tsv = null; @@ -241,7 +222,7 @@ var animint = function (to_select, json_file) { // Each plot may have one or more legends. To make space for the // legends, we put each plot in a table with one row and two // columns: tdLeft and tdRight. - var plot_table = element.append("table").style("display", "inline-block"); + var plot_table = plot_td.append("table").style("display", "inline-block"); var plot_tr = plot_table.append("tr"); var tdLeft = plot_tr.append("td"); var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); @@ -326,7 +307,7 @@ var animint = function (to_select, json_file) { return measureText(entry, p_info.ysize).width + 5; })); } - var axispaddingx = 10 + 20; + var axispaddingx = 30; // distance between tick marks and x axis name. if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ // TODO: throw warning if text height is large portion of plot height? axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ @@ -1054,141 +1035,118 @@ var animint = function (to_select, json_file) { var layer_g_element = svg.select("g." + g_info.classed); var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); var elements = panel_g_element.selectAll(".geom"); - // TODO: standardize this code across aes/styles. - let base_opacity; - let off_opacity; - // Explicitly check if it has the property, allows 0 as valid value - if (g_info.params.hasOwnProperty("alpha")) { - base_opacity = g_info.params.alpha; - } else { - base_opacity = 1; - } - if (g_info.params.hasOwnProperty("alpha_off")) { - off_opacity = g_info.params.alpha_off; - } else { - off_opacity = base_opacity - 0.5; - } - //alert(g_info.classed+" "+base_opacity); - var get_alpha = function (d) { - var a; - if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"]; - } else { - a = base_opacity; - } - return a; + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; }; - const get_alpha_off = function (d) { - let a; - if (aes.hasOwnProperty("alpha_off") && d.hasOwnProperty("alpha_off")) { - a = d["alpha_off"]; - } else if (g_info.params.hasOwnProperty("alpha_off")) { - a = g_info.params.alpha_off; - } else if (aes.hasOwnProperty("alpha") && d.hasOwnProperty("alpha")) { - a = d["alpha"] - 0.5; - } else { - a = off_opacity; - } - return a; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); }; + var size = 2; - if(g_info.geom == "text"){ - size = 12; - } - if (g_info.params.hasOwnProperty("size")) { - size = g_info.params.size; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; } - var get_size = function (d) { - if (aes.hasOwnProperty("size") && d.hasOwnProperty("size")) { - return d["size"]; - } - return size; - }; + var get_style_on_stroke_width = get_size; // stroke_width for geom_point var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 - if (g_info.params.hasOwnProperty("stroke")) { - stroke_width = g_info.params.stroke; - } - var get_stroke_width = function (d) { - if (aes.hasOwnProperty("stroke") && d.hasOwnProperty("stroke")) { - return d["stroke"]; - } - return stroke_width; + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; } var linetype = "solid"; - if (g_info.params.linetype) { - linetype = g_info.params.linetype; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; } - - var get_dasharray = function (d) { - var lt = linetype; - if (aes.hasOwnProperty("linetype") && d.hasOwnProperty("linetype")) { - lt = d["linetype"]; - } + var get_dasharray = function(d){ + var lt = get_linetype(d); return linetypesize2dasharray(lt, get_size(d)); }; - var colour = "black"; - var fill = "black"; - let angle = 0; - if (g_info.params.hasOwnProperty("angle")) { - angle = g_info.params["angle"]; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; } - const get_angle = function(d) { + var get_rotate = function(d){ // x and y are the coordinates to rotate around, we choose the center // point of the text because otherwise it will rotate around (0,0) of its // coordinate system, which is the top left of the plot x = scales["x"](d["x"]); y = scales["y"](d["y"]); - if (d.hasOwnProperty("angle")) { - angle = d["angle"]; - } + var angle = get_angle(d); // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so // we negate the angle. return `rotate(${-angle}, ${x}, ${y})`; }; - var get_colour = function (d) { - if (d.hasOwnProperty("colour")) { - return d["colour"] - } - return colour; - }; - if (g_info.geom == "rect" && has_clickSelects && g_info.params.colour == "transparent"){ - colour = "black"; - } else if(g_info.params.colour){ - colour = g_info.params.colour; - } - // Only "colour_off" params appears would call this function, - // so no default off_colour value - const get_colour_off = function (d) { - let off_colour; - if (aes.hasOwnProperty("colour_off") && d.hasOwnProperty("colour_off")) { - off_colour = d["colour_off"]; - } else if(g_info.params.hasOwnProperty("colour_off")){ - off_colour = g_info.params.colour_off; - } - return off_colour; - }; - - var get_fill = function (d) { - if (d.hasOwnProperty("fill")) { - return d["fill"]; - } - return fill; - }; - if (g_info.params.fill) { - fill = g_info.params.fill; - }else if(g_info.params.colour){ - fill = g_info.params.colour; - } - // For aes(hjust) the compiler should make an "anchor" column. var text_anchor = "middle"; - if(g_info.params.hasOwnProperty("anchor")){ - text_anchor = g_info.params["anchor"]; - } var get_text_anchor; if(g_info.aes.hasOwnProperty("hjust")) { get_text_anchor = function(d){ @@ -1200,26 +1158,20 @@ var animint = function (to_select, json_file) { } } - var eActions, eAppend, linkActions; + var eActions, eAppend; var key_fun = null; - var id_fun = function(d){ - return d.id; - }; if(g_info.aes.hasOwnProperty("key")){ key_fun = function(d){ return d.key; }; } - - // Apply user-configurable selection style into each geom later. - var select_style_fun = function(g_info, e){ - if(!g_info.select_style.includes("stroke")){ - e.style("stroke", get_colour); - } - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", get_alpha); - } - }; + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; if(g_info.data_is_object) { // Lines, paths, polygons, and ribbons are a bit special. For @@ -1313,27 +1265,19 @@ var animint = function (to_select, json_file) { .x(toXY("x", "x")) .y(toXY("y", "y")); } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } // select the correct group before returning anything. key_fun = function(group_info){ return group_info.value; }; - id_fun = function(group_info){ + data_to_bind = kv; + get_one_row = function(group_info) { var one_group = keyed_data[group_info.value]; var one_row = one_group[0]; - // take key from first value in the group. - return one_row.id; - }; - elements = elements.data(kv, key_fun); - linkActions = function(a_elements){ - a_elements - .attr("xlink:href", function(group_info){ - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - return one_row.href; - }) - .attr("target", "_blank") - .attr("class", "geom") - ; + return one_row; }; eActions = function (e) { e.attr("d", function (d) { @@ -1348,304 +1292,256 @@ var animint = function (to_select, json_file) { }); return lineThing(no_na); }) - .style("fill", function (group_info) { - if (g_info.geom == "line" || g_info.geom == "path") { - return "none"; - } - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - return get_fill(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take size for first value in the group - return get_size(one_row); - }) - .style("stroke", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take color for first value in the group - // Since line/path geom are using group to draw, - // so it is different from other geom - // and cannot call select_style_fun function here - if ((has_clickSelects || has_clickSelects_variable) && g_info.select_style.includes("stroke")){ - const v_name = g_info.aes['clickSelects.variable'] || g_info.aes['clickSelects']; - const s_info = Selectors[v_name]; - if(s_info.selected == one_row.clickSelects){ - return get_colour(one_row); - } else{ - return get_colour_off(one_row); - }; - }; - return get_colour(one_row); - }) - .style("stroke-dasharray", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take linetype for first value in the group - return get_dasharray(one_row); - }) - .style("stroke-width", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_size(one_row); - }); - if(!g_info.select_style.includes("opacity")){ - e.style("opacity", function (group_info) { - var one_group = keyed_data[group_info.value]; - var one_row = one_group[0]; - // take line size for first value in the group - return get_alpha(one_row); - }) - } }; eAppend = "path"; }else{ - linkActions = function(a_elements){ - a_elements.attr("xlink:href", function(d){ return d.href; }) - .attr("target", "_blank") - .attr("class", "geom"); - }; - } - if (g_info.geom == "segment") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["xend"]); - }) - .attr("y1", function (d) { - return scales.y(d["y"]); - }) - .attr("y2", function (d) { - return scales.y(d["yend"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; - } - if (g_info.geom == "linerange") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { return scales.x(d["x"]); }) - .attr("y1", function (d) { - return scales.y(d["ymax"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymin"]); + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } } - if (g_info.geom == "vline") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x1", toXY("x", "xintercept")) - .attr("x2", toXY("x", "xintercept")) - .attr("y1", scales.y.range()[0]) - .attr("y2", scales.y.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; } - if (g_info.geom == "hline") { - // pretty much a copy of geom_vline with obvious modifications - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y1", toXY("y", "yintercept")) - .attr("y2", toXY("y", "yintercept")) - .attr("x1", scales.x.range()[0]) - .attr("x2", scales.x.range()[1]) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "line"; + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; } - if (g_info.geom == "text") { - elements = elements.data(data, key_fun); - // TODO: how to support vjust? firefox doensn't support - // baseline-shift... use paths? - // http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Text - eActions = function (e) { - e.attr("x", toXY("x", "x")) - .attr("y", toXY("y", "y")) - .style("fill", get_colour) - .attr("font-size", get_size) - .style("text-anchor", get_text_anchor) - .attr("transform", get_angle) - .text(function (d) { - return d.label; - }); - }; - eAppend = "text"; + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 } - if (g_info.geom == "point") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("cx", toXY("x", "x")) - .attr("cy", toXY("y", "y")) - .attr("r", get_size) - .style("fill", get_fill) - .style("stroke-width", get_stroke_width); - select_style_fun(g_info, e); - }; - eAppend = "circle"; + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; } - if (g_info.geom == "tallrect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", scales.y.range()[1]) - .attr("height", scales.y.range()[0] - scales.y.range()[1]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; } - if (g_info.geom == "widerect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return scales.y(d["ymin"]) - scales.y(d["ymax"]); - }) - .attr("x", scales.x.range()[0]) - .attr("width", scales.x.range()[1] - scales.x.range()[0]) - .style("fill", get_fill) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; - eAppend = "rect"; - } - // geom_rect/geom_tile selection style logic: - // 1. in geom-tile.R we specify if the colour parameter, not aes, is null - // - it shall be transparent when there is no clickSelects - // - it is black when clickSelects is specified, and no params colour - // 2. When colour param is not null, whether it has clickSelects or not - // the colour/stroke is the RGB value of colour params - if (g_info.geom == "rect") { - elements = elements.data(data, key_fun); - eActions = function (e) { - e.attr("x", toXY("x", "xmin")) - .attr("width", function (d) { - return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); - }) - .attr("y", toXY("y", "ymax")) - .attr("height", function (d) { - return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - }; - eAppend = "rect"; + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; } - if (g_info.geom == "boxplot") { - - // TODO: currently boxplots are unsupported (we intentionally - // stop with an error in the R code). The reason why is that - // boxplots are drawn using multiple geoms and it is not - // straightforward to deal with that using our current JS - // code. After all, a boxplot could be produced by combing 3 - // other geoms (rects, lines, and points) if you really wanted - // it. - - fill = "white"; - - elements = elements.data(data); - eActions = function (e) { - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["ymin"]); - }) - .attr("y2", function (d) { - return scales.y(d["lower"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["x"]); - }) - .attr("x2", function (d) { - return scales.x(d["x"]); - }) - .attr("y1", function (d) { - return scales.y(d["upper"]); - }) - .attr("y2", function (d) { - return scales.y(d["ymax"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - e.append("rect") - .attr("x", function (d) { - return scales.x(d["xmin"]); - }) - .attr("width", function (d) { - return scales.x(d["xmax"]) - scales.x(d["xmin"]); - }) - .attr("y", function (d) { - return scales.y(d["upper"]); - }) - .attr("height", function (d) { - return Math.abs(scales.y(d["upper"]) - scales.y(d["lower"])); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size) - .style("fill", get_fill); - select_style_fun(g_info, e); - e.append("line") - .attr("x1", function (d) { - return scales.x(d["xmin"]); - }) - .attr("x2", function (d) { - return scales.x(d["xmax"]); - }) - .attr("y1", function (d) { - return scales.y(d["middle"]); - }) - .attr("y2", function (d) { - return scales.y(d["middle"]); - }) - .style("stroke-dasharray", get_dasharray) - .style("stroke-width", get_size); - select_style_fun(g_info, e); - }; + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); elements.exit().remove(); var enter = elements.enter(); if(g_info.aes.hasOwnProperty("href")){ @@ -1653,81 +1549,11 @@ var animint = function (to_select, json_file) { .append("svg:"+eAppend); }else{ enter = enter.append(eAppend) - .attr("class", "geom"); + .attr("class", "geom"); } + var moreActions = function(e){}; if (has_clickSelects || has_clickSelects_variable) { - var selected_funs = function(style_name, select_fun){ - style_on_funs = { - "opacity": get_alpha, - "stroke": get_colour - }; - style_off_funs = { - "opacity": get_alpha_off, - "stroke": get_colour_off - }; - if(select_fun == "mouseout"){ - return function (d) { - var select_on = style_on_funs[style_name](d); - var select_off = style_off_funs[style_name](d); - if(has_clickSelects){ - return ifSelectedElse(d.clickSelects, g_info.aes.clickSelects, - select_on, select_off); - }else if(has_clickSelects_variable){ - return ifSelectedElse(d["clickSelects.value"], - d["clickSelects.variable"], - select_on, select_off); - } - } - } else if(select_fun == "mouseover"){ - return function (d) { - return style_on_funs[style_name](d); - } - }; - }; //selected_funs. - // My original design for clicking/interactivity/transparency: - // Basically I wanted a really simple way to show which element - // in a group of clickable geom elements is currently - // selected. So I decided that all the non-selected elements - // should have alpha transparency 0.5 less than normal, and the - // selected element should have normal alpha transparency. Also, - // the element currently under the mouse has normal alpha - // transparency, to visually indicate that it can be - // clicked. Looking at my examples, you will see that I - // basically use this in two ways: - - // 1. By specifying - // geom_vline(aes(clickSelects=variable),alpha=0.5), which - // implies a normal alpha transparency of 0.5. So all the vlines - // are hidden (normal alpha 0.5 - 0.5 = 0), except the current - // selection and the current element under the mouse pointer are - // drawn a bit faded with alpha=0.5. - - // 2. By specifying e.g. geom_point(aes(clickSelects=variable)), - // that implies a normal alpha=1. Thus the current selection and - // the current element under the mouse pointer are fully drawn - // with alpha=1 and the others are shown but a bit faded with - // alpha=0.5 (normal alpha 1 - 0.5 = 0.5). - - // Edit 19 March 2014: Now there are two styles to show the - // selection, depending on the geom. For most geoms it is as - // described above. But for geoms like rects with - // aes(fill=numericVariable), using opacity to indicate the - // selection results in a misleading decoding of the fill - // variable. So in this case we set stroke to "black" for the - // current selection. - - // TODO: user-configurable selection styles. - - var over_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseover")); - }) - }; - var out_fun = function(e){ - g_info.select_style.forEach(function(s){ - e.style(s, selected_funs(s, "mouseout")); - }) - }; + moreActions = out_fun; elements.call(out_fun) .on("mouseover", function (d) { d3.select(this).call(over_fun); @@ -1738,9 +1564,6 @@ var animint = function (to_select, json_file) { ; if(has_clickSelects){ elements.on("click", function (d) { - // The main idea of how clickSelects works: when we click - // something, we call update_selector with the clicked - // value. var s_name = g_info.aes.clickSelects; update_selector(s_name, d.clickSelects); }); @@ -1751,25 +1574,19 @@ var animint = function (to_select, json_file) { update_selector(s_name, s_value); }); } - }else{//has neither clickSelects nor clickSelects.variable. - elements.style("opacity", get_alpha) - if(g_info.geom != "text"){ - elements.style("stroke", get_colour); - } } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); if(has_clickSelects || has_tooltip || has_clickSelects_variable){ - var text_fun, get_one; - if(g_info.data_is_object){ - get_one = function(d_or_kv){ - var one_group = keyed_data[d_or_kv.value]; - return one_group[0]; - }; - }else{ - get_one = function(d_or_kv){ - return d_or_kv; - }; - } + var text_fun; if(has_tooltip){ text_fun = function(d){ return d.tooltip; @@ -1787,37 +1604,29 @@ var animint = function (to_select, json_file) { // if elements have an existing title, remove it. elements.selectAll("title").remove(); elements.append("svg:title") - .text(function(d_or_kv){ - var d = get_one(d_or_kv); - return text_fun(d); - }) + .text(get_fun(text_fun)) ; } - // Set attributes of only the entering elements. This is needed to - // prevent things from flying around from the upper left when they - // enter the plot. - eActions(enter); // DO NOT DELETE! if(Selectors.hasOwnProperty(selector_name)){ var milliseconds = Selectors[selector_name].duration; elements = elements.transition().duration(milliseconds); } if(g_info.aes.hasOwnProperty("id")){ - elements.attr("id", id_fun); + elements.attr("id", get_attr("id")); } if(g_info.aes.hasOwnProperty("href")){ // elements are , children are e.g. var linked_geoms = elements.select(eAppend); - // d3.select(linked_geoms).data(data, key_fun); // WHY did we need this? - eActions(linked_geoms); - linkActions(elements); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); }else{ // elements are e.g. - eActions(elements); // Set the attributes of all elements (enter/exit/stay) + doActions(elements); // Set the attributes of all elements (enter/exit/stay) } }; - - var value_tostring = function(selected_values) { //function that is helpful to change the format of the string var selector_url="#" @@ -1852,19 +1661,6 @@ var animint = function (to_select, json_file) { return selected_values; }; - // var counter=-1; - // var update_selector_url = function() { - // var selected_values=get_values(); - // var url=value_tostring(selected_values); - // if(counter===-1){ - // $(".table_selector_widgets").after(""); - // $(".selectorurl").append("

Current URL

"); - // $(".selectorurl").append("
"); - // counter++; - // } - // $(".selectorurl a").attr("href",url).text(url); - // }; - // update scales for the plots that have update_axes option in // theme_animint function update_scales(p_name, axes, v_name, value){ @@ -2257,10 +2053,14 @@ var animint = function (to_select, json_file) { //////////////////////////////////////////// // Widgets at bottom of page //////////////////////////////////////////// - element.append("br"); - + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } // loading table. - var show_hide_table = element.append("button") + var show_hide_table = widget_td.append("button") .text("Show download status table"); show_hide_table .on("click", function(){ @@ -2272,7 +2072,7 @@ var animint = function (to_select, json_file) { show_hide_table.text("Show download status table"); } }); - var loading = element.append("table") + var loading = widget_td.append("table") .style("display", "none"); Widgets["loading"] = loading; var tr = loading.append("tr"); @@ -2290,7 +2090,7 @@ var animint = function (to_select, json_file) { // Animation control widgets. var show_message = "Show animation controls"; // add a button to view the animation widgets - var show_hide_animation_controls = element.append("button") + var show_hide_animation_controls = widget_td.append("button") .text(show_message) .attr("id", viz_id + "_show_hide_animation_controls") .on("click", function(){ @@ -2304,7 +2104,7 @@ var animint = function (to_select, json_file) { }) ; // table of the animint widgets - var time_table = element.append("table") + var time_table = widget_td.append("table") .style("display", "none"); var first_tr = time_table.append("tr"); var first_th = first_tr.append("th"); @@ -2381,13 +2181,13 @@ var animint = function (to_select, json_file) { d3.select(".urltable").style("display","none") } } - var show_hide_selector_widgets = element.append("button") + var show_hide_selector_widgets = widget_td.append("button") .text(toggle_message) .attr("class", "show_hide_selector_widgets") .on("click", show_or_hide_fun) ; // adding a table for selector widgets - var selector_table = element.append("table") + var selector_table = widget_td.append("table") .style("display", "none") .attr("class", "table_selector_widgets") ; diff --git a/docs/articles/clickselectscuteplotkind/geom1_point_cuteplotkind_chunk1.tsv b/vignettes/clickselectscuteplotkind/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/clickselectscuteplotkind/geom1_point_cuteplotkind_chunk1.tsv rename to vignettes/clickselectscuteplotkind/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/clickselectscuteplotkind/index.html b/vignettes/clickselectscuteplotkind/index.html similarity index 100% rename from docs/articles/clickselectscuteplotkind/index.html rename to vignettes/clickselectscuteplotkind/index.html diff --git a/docs/articles/clickselectscuteplotkind/plot.json b/vignettes/clickselectscuteplotkind/plot.json similarity index 96% rename from docs/articles/clickselectscuteplotkind/plot.json rename to vignettes/clickselectscuteplotkind/plot.json index f9490e313..12ccd321b 100644 --- a/docs/articles/clickselectscuteplotkind/plot.json +++ b/vignettes/clickselectscuteplotkind/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_cuteplotkind": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_cuteplotkind", +"classed": "geom1_point_plot1", "aes": { "x": "Day", "y": "Cuteness", @@ -46,7 +46,7 @@ "selected": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_cuteplotkind" + "geom1_point_plot1" ] }, "Kind": { @@ -56,12 +56,12 @@ "selected": "Domestic Shorthair", "levels": [ "Domestic Shorthair", "Domestic Longhair", "Cornish Rex", "Siamese", "Maine Coon" ], "update": [ - "geom1_point_cuteplotkind" + "geom1_point_plot1" ] } }, "plots": { - "cuteplotkind": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -299,7 +299,7 @@ "height": 400 }, "geoms": [ - "geom1_point_cuteplotkind" + "geom1_point_plot1" ] } } diff --git a/docs/articles/clickselectscuteplotkind/scripts.html b/vignettes/clickselectscuteplotkind/scripts.html similarity index 100% rename from docs/articles/clickselectscuteplotkind/scripts.html rename to vignettes/clickselectscuteplotkind/scripts.html diff --git a/docs/articles/clickselectscuteplotkind/styles.css b/vignettes/clickselectscuteplotkind/styles.css similarity index 100% rename from docs/articles/clickselectscuteplotkind/styles.css rename to vignettes/clickselectscuteplotkind/styles.css diff --git a/docs/articles/clickselectscuteplotkind/vendor/d3.v3.js b/vignettes/clickselectscuteplotkind/vendor/d3.v3.js similarity index 100% rename from docs/articles/clickselectscuteplotkind/vendor/d3.v3.js rename to vignettes/clickselectscuteplotkind/vendor/d3.v3.js diff --git a/docs/articles/clickselectscuteplotkind/vendor/jquery-1.11.3.min.js b/vignettes/clickselectscuteplotkind/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/clickselectscuteplotkind/vendor/jquery-1.11.3.min.js rename to vignettes/clickselectscuteplotkind/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/clickselectscuteplotkind/vendor/selectize.css b/vignettes/clickselectscuteplotkind/vendor/selectize.css similarity index 100% rename from docs/articles/clickselectscuteplotkind/vendor/selectize.css rename to vignettes/clickselectscuteplotkind/vendor/selectize.css diff --git a/docs/articles/clickselectscuteplotkind/vendor/selectize.min.js b/vignettes/clickselectscuteplotkind/vendor/selectize.min.js similarity index 100% rename from docs/articles/clickselectscuteplotkind/vendor/selectize.min.js rename to vignettes/clickselectscuteplotkind/vendor/selectize.min.js diff --git a/vignettes/linkedplots/animint.js b/vignettes/linkedplots/animint.js new file mode 100644 index 000000000..3097224df --- /dev/null +++ b/vignettes/linkedplots/animint.js @@ -0,0 +1,2490 @@ +// Define functions to render linked interactive plots using d3. +// Another script should define e.g. +// +// Constructor for animint Object. +var animint = function (to_select, json_file) { + + var default_axis_px = 16; + + function wait_until_then(timeout, condFun, readyFun) { + var args=arguments + function checkFun() { + if(condFun()) { + readyFun(args[3],args[4]); + } else{ + setTimeout(checkFun, timeout); + } + } + checkFun(); + } + + function convert_R_types(resp_array, types){ + return resp_array.map(function (d) { + for (var v_name in d) { + if(!is_interactive_aes(v_name)){ + var r_type = types[v_name]; + if (r_type == "integer") { + d[v_name] = parseInt(d[v_name]); + } else if (r_type == "numeric") { + d[v_name] = parseFloat(d[v_name]); + } else if (r_type == "factor" || r_type == "rgb" + || r_type == "linetype" || r_type == "label" + || r_type == "character") { + // keep it as a character + } else if (r_type == "character" & v_name == "outliers") { + d[v_name] = parseFloat(d[v_name].split(" @ ")); + } + } + } + return d; + }); + } + + // replacing periods in variable with an underscore this makes sure + // that selector doesn't confuse . in name with css selectors + function safe_name(unsafe_name){ + return unsafe_name.replace(/[ .]/g, '_'); + } + function legend_class_name(selector_name){ + return safe_name(selector_name) + "_variable"; + } + + function is_interactive_aes(v_name){ + if(v_name.indexOf("clickSelects") > -1){ + return true; + } + if(v_name.indexOf("showSelected") > -1){ + return true; + } + return false; + } + + var linetypesize2dasharray = function (lt, size) { + var isInt = function(n) { + return typeof n === 'number' && parseFloat(n) == parseInt(n, 10) && !isNaN(n); + }; + if(isInt(lt)){ // R integer line types. + if(lt == 1){ + return null; + } + var o = { + 0: size * 0 + "," + size * 10, + 2: size * 4 + "," + size * 4, + 3: size + "," + size * 2, + 4: size + "," + size * 2 + "," + size * 4 + "," + size * 2, + 5: size * 8 + "," + size * 4, + 6: size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2 + }; + } else { // R defined line types + if(lt == "solid" || lt === null){ + return null; + } + var o = { + "blank": size * 0 + "," + size * 10, + "none": size * 0 + "," + size * 10, + "dashed": size * 4 + "," + size * 4, + "dotted": size + "," + size * 2, + "dotdash": size + "," + size * 2 + "," + size * 4 + "," + size * 2, + "longdash": size * 8 + "," + size * 4, + "twodash": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, + "22": size * 2 + "," + size * 2, + "42": size * 4 + "," + size * 2, + "44": size * 4 + "," + size * 4,"13": size + "," + size * 3, + "1343": size + "," + size * 3 + "," + size * 4 + "," + size * 3, + "73": size * 7 + "," + size * 3, + "2262": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, + "12223242": size + "," + size * 2 + "," + size * 2 + "," + size * 2 + "," + size * 3 + "," + size * 2 + "," + size * 4 + "," + size * 2, + "F282": size * 15 + "," + size * 2 + "," + size * 8 + "," + size * 2, + "F4448444": size * 15 + "," + size * 4 + "," + size * 4 + "," + size * 4 + "," + size * 8 + "," + size * 4 + "," + size * 4 + "," + size * 4, + "224282F2": size * 2 + "," + size * 2 + "," + size * 4 + "," + size * 2 + "," + size * 8 + "," + size * 2 + "," + size * 16 + "," + size * 2, + "F1": size * 16 + "," + size + }; + } + + if (lt in o){ + return o[lt]; + } else{ // manually specified line types + str = lt.split(""); + strnum = str.map(function (d) { + return size * parseInt(d, 16); + }); + return strnum; + } + }; + + var isArray = function(o) { + return Object.prototype.toString.call(o) === '[object Array]'; + }; + + // create a dummy element, apply the appropriate classes, + // and then measure the element + // Inspired from http://jsfiddle.net/uzddx/2/ + var measureText = function(pText, pFontSize, pAngle, pStyle) { + if (!pText || pText.length === 0) return {height: 0, width: 0}; + if (pAngle === null || isNaN(pAngle)) pAngle = 0; + + var container = element.append('svg'); + // do we need to set the class so that styling is applied? + //.attr('class', classname); + + container.append('text') + .attr({x: -1000, y: -1000}) + .attr("transform", "rotate(" + pAngle + ")") + .attr("style", pStyle) + .attr("font-size", pFontSize) + .text(pText); + + var bbox = container.node().getBBox(); + container.remove(); + + return {height: bbox.height, width: bbox.width}; + }; + + var nest_by_group = d3.nest().key(function(d){ return d.group; }); + var dirs = json_file.split("/"); + dirs.pop(); //if a directory path exists, remove the JSON file from dirs + var element = d3.select(to_select); + this.element = element; + var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); + var Widgets = {}; + this.Widgets = Widgets; + var Selectors = {}; + this.Selectors = Selectors; + var Plots = {}; + this.Plots = Plots; + var Geoms = {}; + this.Geoms = Geoms; + // SVGs must be stored separately from Geoms since they are + // initialized first, with the Plots. + var SVGs = {}; + this.SVGs = SVGs; + var Animation = {}; + this.Animation = Animation; + var all_geom_names = {}; + this.all_geom_names = all_geom_names; + + //creating an array to contain the selectize widgets + var selectized_array = []; + var data_object_geoms = { + "line":true, + "path":true, + "ribbon":true, + "polygon":true + }; + var css = document.createElement('style'); + css.type = 'text/css'; + var styles = [".axis path{fill: none;stroke: black;shape-rendering: crispEdges;}", + ".axis line{fill: none;stroke: black;shape-rendering: crispEdges;}", + ".axis text {font-family: sans-serif;font-size: 11px;}"]; + + var add_geom = function (g_name, g_info) { + // Determine if data will be an object or an array. + if(g_info.geom in data_object_geoms){ + g_info.data_is_object = true; + }else{ + g_info.data_is_object = false; + } + // Add a row to the loading table. + g_info.tr = Widgets["loading"].append("tr"); + g_info.tr.append("td").text(g_name); + g_info.tr.append("td").attr("class", "chunk"); + g_info.tr.append("td").attr("class", "downloaded").text(0); + g_info.tr.append("td").text(g_info.total); + g_info.tr.append("td").attr("class", "status").text("initialized"); + + // load chunk tsv + g_info.data = {}; + g_info.download_status = {}; + Geoms[g_name] = g_info; + // Determine whether common chunk tsv exists + // If yes, load it + if(g_info.hasOwnProperty("columns") && g_info.columns.common){ + var common_tsv = get_tsv(g_info, "_common"); + g_info.common_tsv = common_tsv; + var common_path = getTSVpath(common_tsv); + d3.tsv(common_path, function (error, response) { + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); + }); + } else { + g_info.common_tsv = null; + } + // Save this geom and load it! + update_geom(g_name, null); + }; + var add_plot = function (p_name, p_info) { + // Each plot may have one or more legends. To make space for the + // legends, we put each plot in a table with one row and two + // columns: tdLeft and tdRight. + var plot_table = plot_td.append("table").style("display", "inline-block"); + var plot_tr = plot_table.append("tr"); + var tdLeft = plot_tr.append("td"); + var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); + if(viz_id === null){ + p_info.plot_id = p_name; + }else{ + p_info.plot_id = viz_id + "_" + p_name; + } + var svg = tdLeft.append("svg") + .attr("id", p_info.plot_id) + .attr("height", p_info.options.height) + .attr("width", p_info.options.width); + + // divvy up width/height based on the panel layout + var nrows = Math.max.apply(null, p_info.layout.ROW); + var ncols = Math.max.apply(null, p_info.layout.COL); + var panel_names = p_info.layout.PANEL; + var npanels = Math.max.apply(null, panel_names); + + // Note axis names are "shared" across panels (just like the title) + var xtitlepadding = 5 + measureText(p_info["xtitle"], default_axis_px).height; + var ytitlepadding = 5 + measureText(p_info["ytitle"], default_axis_px).height; + + // 'margins' are fixed across panels and do not + // include title/axis/label padding (since these are not + // fixed across panels). They do, however, account for + // spacing between panels + var text_height_pixels = measureText("foo", 11).height; + var margin = { + left: 0, + right: text_height_pixels * p_info.panel_margin_lines, + top: text_height_pixels * p_info.panel_margin_lines, + bottom: 0 + }; + var plotdim = { + width: 0, + height: 0, + xstart: 0, + xend: 0, + ystart: 0, + yend: 0, + graph: { + width: 0, + height: 0 + }, + margin: margin, + xlab: { + x: 0, + y: 0 + }, + ylab: { + x: 0, + y: 0 + }, + title: { + x: 0, + y: 0 + } + }; + + // Draw the title + var titlepadding = measureText(p_info.title, p_info.title_size).height; + // why are we giving the title padding if it is undefined? + if (p_info.title === undefined) titlepadding = 0; + plotdim.title.x = p_info.options.width / 2; + plotdim.title.y = titlepadding; + svg.append("text") + .text(p_info.title) + .attr("class", "plottitle") + .attr("font-family", "sans-serif") + .attr("font-size", p_info.title_size) + .attr("transform", "translate(" + plotdim.title.x + "," + + plotdim.title.y + ")") + .style("text-anchor", "middle"); + + // grab max text size over axis labels and facet strip labels + var axispaddingy = 5; + if(p_info.hasOwnProperty("ylabs") && p_info.ylabs.length){ + axispaddingy += Math.max.apply(null, p_info.ylabs.map(function(entry){ + // + 5 to give a little extra space to avoid bad axis labels + // in shiny. + return measureText(entry, p_info.ysize).width + 5; + })); + } + var axispaddingx = 30; // distance between tick marks and x axis name. + if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ + // TODO: throw warning if text height is large portion of plot height? + axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ + return measureText(entry, p_info.xsize, p_info.xangle).height; + })); + // TODO: carefully calculating this gets complicated with rotating xlabs + //margin.right += 5; + } + plotdim.margin = margin; + + var strip_heights = p_info.strips.top.map(function(entry){ + return measureText(entry, p_info.strip_text_xsize).height; + }); + var strip_widths = p_info.strips.right.map(function(entry){ + return measureText(entry, p_info.strip_text_ysize).height; + }); + + // compute the number of x/y axes, max strip height per row, and + // max strip width per columns, for calculating height/width of + // graphing region. + var row_strip_heights = []; + var col_strip_widths = []; + var n_xaxes = 0; + var n_yaxes = 0; + var current_row, current_col; + for (var layout_i = 0; layout_i < npanels; layout_i++) { + current_row = p_info.layout.ROW[layout_i] - 1; + current_col = p_info.layout.COL[layout_i] - 1; + if(row_strip_heights[current_row] === undefined){ + row_strip_heights[current_row] = []; + } + if(col_strip_widths[current_col] === undefined){ + col_strip_widths[current_col] = []; + } + row_strip_heights[current_row].push(strip_heights[layout_i]); + col_strip_widths[current_col].push(strip_widths[layout_i]); + if (p_info.layout.COL[layout_i] == 1) { + n_xaxes += p_info.layout.AXIS_X[layout_i]; + } + if (p_info.layout.ROW[layout_i] == 1) { + n_yaxes += p_info.layout.AXIS_Y[layout_i]; + } + } + function cumsum_array(array_of_arrays){ + var cumsum = [], max_value, cumsum_value = 0; + for(var i=0; i 1) { + background.append("rect") + .attr("x", plotdim.xstart) + .attr("y", plotdim.ystart) + .attr("width", plotdim.xend - plotdim.xstart) + .attr("height", plotdim.yend - plotdim.ystart) + .attr("class", "background_rect") + .style("fill", p_info.panel_background.fill) + .style("stroke", p_info.panel_background.colour) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(p_info.panel_background.linetype, + p_info.panel_background.size); + }); + } + + // drawing the grid lines + ["grid_minor", "grid_major"].forEach(function(grid_class){ + var grid_background = p_info[grid_class]; + // if grid lines are defined + if(grid_background.hasOwnProperty("size")) { + var grid = background.append("g") + .attr("class", grid_class); + ["x","y"].forEach(function(scale_var){ + var const_var; + if(scale_var == "x"){ + const_var = "y"; + }else{ + const_var = "x"; + } + grid.append("g") + .attr("class", scale_var) + .selectAll("line") + .data(grid_background.loc[scale_var][layout_i]) + .enter() + .append("line") + .attr(const_var + "1", plotdim[const_var + "start"]) + .attr(const_var + "2", plotdim[const_var + "end"]) + .attr(scale_var + "1", function(d) { + return scales[panel_i][scale_var](d); + }) + .attr(scale_var + "2", function(d) { + return scales[panel_i][scale_var](d); + }) + .style("stroke", grid_background.colour) + .style("stroke-linecap", grid_background.lineend) + .style("stroke-width", grid_background.size) + .style("stroke-dasharray", linetypesize2dasharray( + grid_background.linetype, grid_background.size)) + ; + }); + } + }); + + // drawing border + // uses insert to draw it right before the #plottitle + if(Object.keys(p_info.panel_border).length > 1) { + background.append("rect") + .attr("x", plotdim.xstart) + .attr("y", plotdim.ystart) + .attr("width", plotdim.xend - plotdim.xstart) + .attr("height", plotdim.yend - plotdim.ystart) + .attr("class", "border_rect") + .style("fill", p_info.panel_border.fill) + .style("stroke", p_info.panel_border.colour) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(p_info.panel_border.linetype, + p_info.panel_border.size); + }); + } + + } //end of for(layout_i + // After drawing all backgrounds, we can draw the axis labels. + if(p_info["ytitle"]){ + svg.append("text") + .text(p_info["ytitle"]) + .attr("class", "ytitle") + .style("text-anchor", "middle") + .style("font-size", default_axis_px + "px") + .attr("transform", "translate(" + + ytitle_x + + "," + + (ytitle_top + ytitle_bottom)/2 + + ")rotate(270)") + ; + } + if(p_info["xtitle"]){ + svg.append("text") + .text(p_info["xtitle"]) + .attr("class", "xtitle") + .style("text-anchor", "middle") + .style("font-size", default_axis_px + "px") + .attr("transform", "translate(" + + (xtitle_left + xtitle_right)/2 + + "," + + xtitle_y + + ")") + ; + } + Plots[p_name].scales = scales; + }; //end of add_plot() + + function update_legend_opacity(v_name){ + var s_info = Selectors[v_name]; + s_info.legend_tds.style("opacity", s_info.legend_update_fun); + } + + var add_selector = function (s_name, s_info) { + Selectors[s_name] = s_info; + if(s_info.type == "multiple"){ + if(!isArray(s_info.selected)){ + s_info.selected = [s_info.selected]; + } + // legend_update_fun is evaluated in the context of the + // td.legend_entry_label. + s_info.legend_update_fun = function(d){ + var i_value = s_info.selected.indexOf(this.textContent); + if(i_value == -1){ + return 0.5; + }else{ + return 1; + } + } + }else{ + s_info.legend_update_fun = function(d){ + if(this.textContent == s_info.selected){ + return 1; + }else{ + return 0.5; + } + } + } + s_info.legend_tds = + element.selectAll("tr."+legend_class_name(s_name)+" td.legend_entry_label") + ; + update_legend_opacity(s_name); + }; //end of add_selector() + + function get_tsv(g_info, chunk_id){ + return g_info.classed + "_chunk" + chunk_id + ".tsv"; + } + function getTSVpath(tsv_name){ + return dirs.concat(tsv_name).join("/"); + } + + /** + * copy common chunk tsv to varied chunk tsv, returning an array of + * objects. + */ + function copy_chunk(g_info, varied_chunk) { + var varied_by_group = nest_by_group.map(varied_chunk); + var common_by_group = g_info.data[g_info.common_tsv]; + var new_varied_chunk = []; + for(group_id in varied_by_group){ + var varied_one_group = varied_by_group[group_id]; + var common_one_group = common_by_group[group_id]; + var common_i = 0; + for(var varied_i=0; varied_i < varied_one_group.length; varied_i++){ + // there are two cases: each group of varied data is of length + // 1, or of length of the common data. + if(common_one_group.length == varied_one_group.length){ + common_i = varied_i; + } + var varied_obj = varied_one_group[varied_i]; + var common_obj = common_one_group[common_i]; + for(col in common_obj){ + if(col != "group"){ + varied_obj[col] = common_obj[col]; + } + } + new_varied_chunk.push(varied_obj); + } + } + return new_varied_chunk; + } + + // update_geom is called from add_geom and update_selector. It + // downloads data if necessary, and then calls draw_geom. + var update_geom = function (g_name, selector_name) { + var g_info = Geoms[g_name]; + // First apply chunk_order selector variables. + var chunk_id = g_info.chunks; + g_info.chunk_order.forEach(function (v_name) { + if(chunk_id == null){ + return; // no data in a higher up chunk var. + } + var value = Selectors[v_name].selected; + if(chunk_id.hasOwnProperty(value)){ + chunk_id = chunk_id[value]; + }else{ + chunk_id = null; // no data to show in this subset. + } + }); + if(chunk_id == null){ + draw_panels(g_info, [], selector_name); //draw nothing. + return; + } + var tsv_name = get_tsv(g_info, chunk_id); + // get the data if it has not yet been downloaded. + g_info.tr.select("td.chunk").text(tsv_name); + if(g_info.data.hasOwnProperty(tsv_name)){ + draw_panels(g_info, g_info.data[tsv_name], selector_name); + }else{ + g_info.tr.select("td.status").text("downloading"); + var svg = SVGs[g_name]; + var loading = svg.append("text") + .attr("class", "loading"+tsv_name) + .text("Downloading "+tsv_name+"...") + .attr("font-size", 9) + //.attr("x", svg.attr("width")/2) + .attr("y", 10) + .style("fill", "red"); + download_chunk(g_info, tsv_name, function(chunk){ + loading.remove(); + draw_panels(g_info, chunk, selector_name); + }); + } + }; + var draw_panels = function(g_info, chunk, selector_name) { + // derive the plot name from the geometry name + var g_names = g_info.classed.split("_"); + var p_name = g_names[g_names.length - 1]; + var panels = Plots[p_name].layout.PANEL; + panels.forEach(function(panel) { + draw_geom(g_info, chunk, selector_name, panel); + }); + }; + + function download_next(g_name){ + var g_info = Geoms[g_name]; + var selector_value = Animation.sequence[g_info.seq_i]; + var chunk_id = g_info.chunks[selector_value]; + var tsv_name = get_tsv(g_info, chunk_id); + g_info.seq_count += 1; + if(Animation.sequence.length == g_info.seq_count){ + Animation.done_geoms[g_name] = 1; + return; + } + g_info.seq_i += 1; + if(g_info.seq_i == Animation.sequence.length){ + g_info.seq_i = 0; + } + if(typeof(chunk_id) == "string"){ + download_chunk(g_info, tsv_name, function(chunk){ + download_next(g_name); + }) + }else{ + download_next(g_name); + } + } + + // download_chunk is called from update_geom and download_next. + function download_chunk(g_info, tsv_name, funAfter){ + if(g_info.download_status.hasOwnProperty(tsv_name)){ + var chunk; + if(g_info.data_is_object){ + chunk = {}; + }else{ + chunk = []; + } + funAfter(chunk); + return; // do not download twice. + } + g_info.download_status[tsv_name] = "downloading"; + // prefix tsv file with appropriate path + var tsv_file = getTSVpath(tsv_name); + d3.tsv(tsv_file, function (error, response) { + // First convert to correct types. + g_info.download_status[tsv_name] = "processing"; + response = convert_R_types(response, g_info.types); + wait_until_then(500, function(){ + if(g_info.common_tsv) { + return g_info.data.hasOwnProperty(g_info.common_tsv); + }else{ + return true; + } + }, function(){ + if(g_info.common_tsv) { + // copy data from common tsv to varied tsv + response = copy_chunk(g_info, response); + } + var nest = d3.nest(); + g_info.nest_order.forEach(function (v_name) { + nest.key(function (d) { + return d[v_name]; + }); + }); + var chunk = nest.map(response); + g_info.data[tsv_name] = chunk; + g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); + g_info.download_status[tsv_name] = "saved"; + funAfter(chunk); + }); + }); + }//download_chunk. + + // update_geom is responsible for obtaining a chunk of downloaded + // data, and then calling draw_geom to actually draw it. + var draw_geom = function(g_info, chunk, selector_name, PANEL){ + g_info.tr.select("td.status").text("displayed"); + var svg = SVGs[g_info.classed]; + // derive the plot name from the geometry name + var g_names = g_info.classed.split("_"); + var p_name = g_names[g_names.length - 1]; + var scales = Plots[p_name].scales[PANEL]; + var selected_arrays = [ [] ]; //double array necessary. + var has_clickSelects = g_info.aes.hasOwnProperty("clickSelects"); + var has_clickSelects_variable = + g_info.aes.hasOwnProperty("clickSelects.variable"); + g_info.subset_order.forEach(function (aes_name) { + var selected, values; + var new_arrays = []; + if(0 < aes_name.indexOf(".variable")){ + selected_arrays.forEach(function(old_array){ + var some_data = chunk; + old_array.forEach(function(value){ + if(some_data.hasOwnProperty(value)) { + some_data = some_data[value]; + } else { + some_data = {}; + } + }) + values = d3.keys(some_data); + values.forEach(function(s_name){ + var selected = Selectors[s_name].selected; + var new_array = old_array.concat(s_name).concat(selected); + new_arrays.push(new_array); + }) + }) + }else{//not .variable aes: + if(aes_name == "PANEL"){ + selected = PANEL; + }else{ + var s_name = g_info.aes[aes_name]; + selected = Selectors[s_name].selected; + } + if(isArray(selected)){ + values = selected; //multiple selection. + }else{ + values = [selected]; //single selection. + } + values.forEach(function(value){ + selected_arrays.forEach(function(old_array){ + var new_array = old_array.concat(value); + new_arrays.push(new_array); + }) + }) + } + selected_arrays = new_arrays; + }); + // data can be either an array[] if it will be directly involved + // in a data-bind, or an object{} if it will be involved in a + // data-bind by group (e.g. geom_line). + var data; + if(g_info.data_is_object){ + data = {}; + }else{ + data = []; + } + selected_arrays.forEach(function(value_array){ + var some_data = chunk; + value_array.forEach(function(value){ + if (some_data.hasOwnProperty(value)) { + some_data = some_data[value]; + } else { + if(g_info.data_is_object){ + some_data = {}; + }else{ + some_data = []; + } + } + }); + if(g_info.data_is_object){ + if(isArray(some_data) && some_data.length){ + data["0"] = some_data; + }else{ + for(k in some_data){ + data[k] = some_data[k]; + } + } + }else{//some_data is an array. + data = data.concat(some_data); + } + }); + var aes = g_info.aes; + var toXY = function (xy, a) { + return function (d) { + return scales[xy](d[a]); + }; + }; + var layer_g_element = svg.select("g." + g_info.classed); + var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); + var elements = panel_g_element.selectAll(".geom"); + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; + }; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); + }; + + var size = 2; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; + } + var get_style_on_stroke_width = get_size; + + // stroke_width for geom_point + var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; + } + + var linetype = "solid"; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; + } + var get_dasharray = function(d){ + var lt = get_linetype(d); + return linetypesize2dasharray(lt, get_size(d)); + }; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; + } + var get_rotate = function(d){ + // x and y are the coordinates to rotate around, we choose the center + // point of the text because otherwise it will rotate around (0,0) of its + // coordinate system, which is the top left of the plot + x = scales["x"](d["x"]); + y = scales["y"](d["y"]); + var angle = get_angle(d); + // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so + // we negate the angle. + return `rotate(${-angle}, ${x}, ${y})`; + }; + + // For aes(hjust) the compiler should make an "anchor" column. + var text_anchor = "middle"; + var get_text_anchor; + if(g_info.aes.hasOwnProperty("hjust")) { + get_text_anchor = function(d){ + return d["anchor"]; + } + }else{ + get_text_anchor = function(d){ + return text_anchor; + } + } + + var eActions, eAppend; + var key_fun = null; + if(g_info.aes.hasOwnProperty("key")){ + key_fun = function(d){ + return d.key; + }; + } + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; + if(g_info.data_is_object) { + + // Lines, paths, polygons, and ribbons are a bit special. For + // every unique value of the group variable, we take the + // corresponding data rows and make 1 path. The tricky part is + // that to use d3 I do a data-bind of some "fake" data which are + // just group ids, which is the kv variable in the code below + + // // case of only 1 line and no groups. + // if(!aes.hasOwnProperty("group")){ + // kv = [{"key":0,"value":0}]; + // data = {0:data}; + // }else{ + // // we need to use a path for each group. + // var kv = d3.entries(d3.keys(data)); + // kv = kv.map(function(d){ + // d[aes.group] = d.value; + // return d; + // }); + // } + + // For an example consider breakpointError$error which is + // defined using this R code + + // geom_line(aes(segments, error, group=bases.per.probe, + // clickSelects=bases.per.probe), data=only.error, lwd=4) + + // Inside update_geom the variables take the following values + // (pseudo-Javascript code) + + // var kv = [{"key":"0","value":"133","bases.per.probe":"133"}, + // {"key":"1","value":"2667","bases.per.probe":"2667"}]; + // var data = {"133":[array of 20 points used to draw the line for group 133], + // "2667":[array of 20 points used to draw the line for group 2667]}; + + // I do elements.data(kv) so that when I set the d attribute of + // each path, I need to select the correct group before + // returning anything. + + // e.attr("d",function(group_info){ + // var one_group = data[group_info.value]; + // return lineThing(one_group); + // }) + + // To make color work I think you just have to select the group + // and take the color of the first element, e.g. + + // .style("stroke",function(group_info){ + // var one_group = data[group_info.value]; + // var one_row = one_group[0]; + // return get_color(one_row); + // } + + // In order to get d3 lines to play nice, bind fake "data" (group + // id's) -- the kv variable. Then each separate object is plotted + // using path (case of only 1 thing and no groups). + + // we need to use a path for each group. + var keyed_data = {}, one_group, group_id, k; + for(group_id in data){ + one_group = data[group_id]; + one_row = one_group[0]; + if(one_row.hasOwnProperty("key")){ + k = one_row.key; + }else{ + k = group_id; + } + keyed_data[k] = one_group; + } + var kv_array = d3.entries(d3.keys(keyed_data)); + var kv = kv_array.map(function (d) { + //d[aes.group] = d.value; + + // Need to store the clickSelects value that will + // be passed to the selector when we click on this + // item. + d.clickSelects = keyed_data[d.value][0].clickSelects; + return d; + }); + + // line, path, and polygon use d3.svg.line(), + // ribbon uses d3.svg.area() + // we have to define lineThing accordingly. + if (g_info.geom == "ribbon") { + var lineThing = d3.svg.area() + .x(toXY("x", "x")) + .y(toXY("y", "ymax")) + .y0(toXY("y", "ymin")); + } else { + var lineThing = d3.svg.line() + .x(toXY("x", "x")) + .y(toXY("y", "y")); + } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } + // select the correct group before returning anything. + key_fun = function(group_info){ + return group_info.value; + }; + data_to_bind = kv; + get_one_row = function(group_info) { + var one_group = keyed_data[group_info.value]; + var one_row = one_group[0]; + return one_row; + }; + eActions = function (e) { + e.attr("d", function (d) { + var one_group = keyed_data[d.value]; + // filter NaN since they make the whole line disappear! + var no_na = one_group.filter(function(d){ + if(g_info.geom == "ribbon"){ + return !isNaN(d.x) && !isNaN(d.ymin) && !isNaN(d.ymax); + }else{ + return !isNaN(d.x) && !isNaN(d.y); + } + }); + return lineThing(no_na); + }) + }; + eAppend = "path"; + }else{ + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); + }) + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); + }) + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } + } + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; + } + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; + } + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 + } + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; + } + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; + } + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; + } + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; + } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); + elements.exit().remove(); + var enter = elements.enter(); + if(g_info.aes.hasOwnProperty("href")){ + enter = enter.append("svg:a") + .append("svg:"+eAppend); + }else{ + enter = enter.append(eAppend) + .attr("class", "geom"); + } + var moreActions = function(e){}; + if (has_clickSelects || has_clickSelects_variable) { + moreActions = out_fun; + elements.call(out_fun) + .on("mouseover", function (d) { + d3.select(this).call(over_fun); + }) + .on("mouseout", function (d) { + d3.select(this).call(out_fun); + }) + ; + if(has_clickSelects){ + elements.on("click", function (d) { + var s_name = g_info.aes.clickSelects; + update_selector(s_name, d.clickSelects); + }); + }else{ + elements.on("click", function(d){ + var s_name = d["clickSelects.variable"]; + var s_value = d["clickSelects.value"]; + update_selector(s_name, s_value); + }); + } + } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! + var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); + if(has_clickSelects || has_tooltip || has_clickSelects_variable){ + var text_fun; + if(has_tooltip){ + text_fun = function(d){ + return d.tooltip; + }; + }else if(has_clickSelects){ + text_fun = function(d){ + var v_name = g_info.aes.clickSelects; + return v_name + " " + d.clickSelects; + }; + }else{ //clickSelects_variable + text_fun = function(d){ + return d["clickSelects.variable"] + " " + d["clickSelects.value"]; + }; + } + // if elements have an existing title, remove it. + elements.selectAll("title").remove(); + elements.append("svg:title") + .text(get_fun(text_fun)) + ; + } + if(Selectors.hasOwnProperty(selector_name)){ + var milliseconds = Selectors[selector_name].duration; + elements = elements.transition().duration(milliseconds); + } + if(g_info.aes.hasOwnProperty("id")){ + elements.attr("id", get_attr("id")); + } + if(g_info.aes.hasOwnProperty("href")){ + // elements are , children are e.g. + var linked_geoms = elements.select(eAppend); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); + }else{ + // elements are e.g. + doActions(elements); // Set the attributes of all elements (enter/exit/stay) + } + }; + + var value_tostring = function(selected_values) { + //function that is helpful to change the format of the string + var selector_url="#" + for (var selc_var in selected_values){ + if(selected_values.hasOwnProperty(selc_var)){ + var values_str=selected_values[selc_var].join(); + var sub_url=selc_var.concat("=","{",values_str,"}"); + selector_url=selector_url.concat(sub_url); + } + } + var url_nohash=window.location.href.match(/(^[^#]*)/)[0]; + selector_url=url_nohash.concat(selector_url); + return selector_url; + }; + + var get_values=function(){ + // function that is useful to get the selected values + var selected_values={} + for(var s_name in Selectors){ + var s_info=Selectors[s_name]; + var initial_selections = []; + if(s_info.type==="single"){ + initial_selections=[s_info.selected]; + } + else{ + for(var i in s_info.selected) { + initial_selections[i] = s_info.selected[i]; + } + } + selected_values[s_name]=initial_selections; + } + return selected_values; + }; + + // update scales for the plots that have update_axes option in + // theme_animint + function update_scales(p_name, axes, v_name, value){ + // Get pre-computed domain + var axis_domains = Plots[p_name]["axis_domains"]; + if(!isArray(axes)){ + axes = [axes]; + } + if(axis_domains != null){ + axes.forEach(function(xyaxis){ + // For Each PANEL, update the axes + Plots[p_name].layout.PANEL.forEach(function(panel_i, i){ + // Determine whether this panel has a scale or not + // If not we just update the scales according to the common + // scale and skip the updating of axis + var draw_axes = Plots[p_name].layout["AXIS_"+ xyaxis.toUpperCase()][i]; + if(draw_axes){ + var use_panel = panel_i; + }else{ + var use_panel = Plots[p_name].layout.PANEL[0]; + } + // We update the current selection of the plot every time + // and use it to index the correct domain + var curr_select = axis_domains[xyaxis].curr_select; + if(axis_domains[xyaxis].selectors.indexOf(v_name) > -1){ + curr_select[v_name] = value; + var str = use_panel+"."; + for(selec in curr_select){ + str = str + curr_select[selec] + "_"; + } + str = str.substring(0, str.length - 1); // Strip off trailing underscore + var use_domain = axis_domains[xyaxis]["domains"][str]; + } + if(use_domain != null){ + Plots[p_name]["scales"][panel_i][xyaxis].domain(use_domain); + var scales = Plots[p_name]["scales"][panel_i][xyaxis]; + // major and minor grid lines as calculated in the compiler + var grid_vals = Plots[p_name]["axis_domains"][xyaxis]["grids"][str]; + + // Once scales are updated, update the axis ticks if needed + if(draw_axes){ + // Tick values are same as major grid lines + update_axes(p_name, xyaxis, panel_i, grid_vals[1]); + } + // Update major and minor grid lines + update_grids(p_name, xyaxis, panel_i, grid_vals, scales); + } + }); + }); + } + } + + // Update the axis ticks etc. once plot is zoomed in/out + // currently called from update_scales. + function update_axes(p_name, axes, panel_i, tick_vals){ + var orientation; + if(axes == "x"){ + orientation = "bottom"; + }else{ + orientation = "left"; + } + if(!isArray(tick_vals)){ + tick_vals = [tick_vals]; + } + var xyaxis = d3.svg.axis() + .scale(Plots[p_name]["scales"][panel_i][axes]) + .orient(orientation) + .tickValues(tick_vals); + // update existing axis + var xyaxis_g = element.select("#plot_"+p_name).select("."+axes+"axis_"+panel_i) + .transition() + .duration(1000) + .call(xyaxis); + } + + // Update major/minor grids once axes ticks have been updated + function update_grids(p_name, axes, panel_i, grid_vals, scales){ + // Select panel to update + var bgr = element.select("#plot_"+p_name).select(".bgr"+panel_i); + // Update major and minor grid lines + ["minor", "major"].forEach(function(grid_class, j){ + var lines = bgr.select(".grid_"+grid_class).select("."+axes); + var xy1, xy2; + if(axes == "x"){ + xy1 = lines.select("line").attr("y1"); + xy2 = lines.select("line").attr("y2"); + }else{ + xy1 = lines.select("line").attr("x1"); + xy2 = lines.select("line").attr("x2"); + } + + // Get default values for grid lines like colour, stroke etc. + var grid_background = Plots[p_name]["grid_"+grid_class]; + var col = grid_background.colour; + var lt = grid_background.linetype; + var size = grid_background.size; + var cap = grid_background.lineend; + + // Remove old lines + lines.selectAll("line") + .remove(); + + if(!isArray(grid_vals[j])){ + grid_vals[j] = [grid_vals[j]]; + } + + if(axes == "x"){ + lines.selectAll("line") + .data(grid_vals[j]) + .enter() + .append("line") + .attr("y1", xy1) + .attr("y2", xy2) + .attr("x1", function(d) { return scales(d); }) + .attr("x2", function(d) { return scales(d); }) + .style("stroke", col) + .style("stroke-linecap", cap) + .style("stroke-width", size) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(lt, size); + }); + }else{ + lines.selectAll("line") + .data(grid_vals[j]) + .enter() + .append("line") + .attr("x1", xy1) + .attr("x2", xy2) + .attr("y1", function(d) { return scales(d); }) + .attr("y2", function(d) { return scales(d); }) + .style("stroke", col) + .style("stroke-linecap", cap) + .style("stroke-width", size) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(lt, size); + }); + } + }); + } + + var update_selector = function (v_name, value) { + if(!Selectors.hasOwnProperty(v_name)){ + return; + } + value = value + ""; + var s_info = Selectors[v_name]; + if(s_info.type == "single"){ + // value is the new selection. + s_info.selected = value; + }else{ + // value should be added or removed from the selection. + var i_value = s_info.selected.indexOf(value); + if(i_value == -1){ + // not found, add to selection. + s_info.selected.push(value); + }else{ + // found, remove from selection. + s_info.selected.splice(i_value, 1); + } + } + // update_selector_url() + // if there are levels, then there is a selectize widget which + // should be updated. + if(isArray(s_info.levels)){ + // the jquery ids + if(s_info.type == "single") { + var selected_ids = v_name.concat("___", value); + } else { + var selected_ids = []; + for(i in s_info.selected) { + selected_ids[i] = v_name.concat("___", s_info.selected[i]); + } + } + // from + // https://github.com/brianreavis/selectize.js/blob/master/docs/api.md: + // setValue(value, silent) If "silent" is truthy, no change + // event will be fired on the original input. + selectized_array[v_name].setValue(selected_ids, true); + } + + // For each updated geom, check if the axes of the plot need to be + // updated and update them + s_info.update.forEach(function(g_name){ + var plot_name = g_name.split("_").pop(); + var axes = Plots[plot_name]["options"]["update_axes"]; + if(axes != null){ + update_scales(plot_name, axes, v_name, value); + } + }); + + update_legend_opacity(v_name); + s_info.update.forEach(function(g_name){ + update_geom(g_name, v_name); + }); + }; + + var ifSelectedElse = function (s_value, s_name, selected, not_selected) { + var is_selected; + var s_info = Selectors[s_name]; + if(s_info.type == "single"){ + is_selected = s_value == s_info.selected; + }else{ + is_selected = s_info.selected.indexOf(s_value) != -1; + } + if(is_selected){ + return selected; + } else { + return not_selected; + } + }; + + function update_next_animation(){ + var values = d3.values(Animation.done_geoms); + if(d3.sum(values) == values.length){ + // If the values in done_geoms are all 1, then we have loaded + // all of the animation-related chunks, and we can start + // playing the animation. + var v_name = Animation.variable; + var cur = Selectors[v_name].selected; + var next = Animation.next[cur]; + update_selector(v_name, next); + } + } + + // The main idea of how legends work: + + // 1. In getLegend in animint.R I export the legend entries as a + // list of rows that can be used in a data() bind in D3. + + // 2. Here in add_legend I create a for every legend, and + // then I bind the legend entries to ,
, and elements. + var add_legend = function(p_name, p_info){ + // case of multiple legends, d3 reads legend structure in as an array + var tdRight = element.select("td."+p_name+"_legend"); + var legendkeys = d3.keys(p_info.legend); + for(var i=0; i-1){ + // aesthetics that would draw a rect + legend_svgs.append("rect") + .attr("x", 2) + .attr("y", 2) + .attr("width", 10) + .attr("height", 10) + .style("stroke-width", function(d){return d["polygonsize"]||1;}) + .style("stroke-dasharray", function(d){ + return linetypesize2dasharray(d["polygonlinetype"], d["size"]||2); + }) + .style("stroke", function(d){return d["polygoncolour"] || "#000000";}) + .style("fill", function(d){return d["polygonfill"] || "#FFFFFF";}) + .style("opacity", function(d){return d["polygonalpha"]||1;}); + } + if(l_info.geoms.indexOf("text")>-1){ + // aesthetics that would draw a rect + legend_svgs.append("text") + .attr("x", 10) + .attr("y", 14) + .style("fill", function(d){return d["textcolour"]||1;}) + .style("text-anchor", "middle") + .attr("font-size", function(d){return d["textsize"]||1;}) + .text("a"); + } + if(l_info.geoms.indexOf("path")>-1){ + // aesthetics that would draw a line + legend_svgs.append("line") + .attr("x1", 1).attr("x2", 19).attr("y1", 7).attr("y2", 7) + .style("stroke-width", function(d){ + return linescale(d["pathsize"])||2; + }) + .style("stroke-dasharray", function(d){ + return linetypesize2dasharray(d["pathlinetype"], d["pathsize"] || 2); + }) + .style("stroke", function(d){return d["pathcolour"] || "#000000";}) + .style("opacity", function(d){return d["pathalpha"]||1;}); + } + if(l_info.geoms.indexOf("point")>-1){ + // aesthetics that would draw a point + legend_svgs.append("circle") + .attr("cx", 10) + .attr("cy", 7) + .attr("r", function(d){return pointscale(d["pointsize"])||4;}) + .style("stroke", function(d){return d["pointcolour"] || "#000000";}) + .style("fill", function(d){ + return d["pointfill"] || d["pointcolour"] || "#000000"; + }) + .style("opacity", function(d){return d["pointalpha"]||1;}); + } + legend_rows.append("td") + .attr("align", "left") // TODO: right for numbers? + .attr("class", "legend_entry_label") + .attr("id", function(d){ return d["id"]+"_label"; }) + .style("font-size", function(d){ return d["text_size"]}) + .text(function(d){ return d["label"];}); + } + } + + // Download the main description of the interactive plot. + d3.json(json_file, function (error, response) { + if(response.hasOwnProperty("title")){ + // This selects the title of the web page, outside of wherever + // the animint is defined, usually a
-- so it is OK to use + // global d3.select here. + d3.select("title").text(response.title); + } + // Add plots. + for (var p_name in response.plots) { + add_plot(p_name, response.plots[p_name]); + add_legend(p_name, response.plots[p_name]); + // Append style sheet to document head. + css.appendChild(document.createTextNode(styles.join(" "))); + document.head.appendChild(css); + } + // Then add selectors and start downloading the first data subset. + for (var s_name in response.selectors) { + add_selector(s_name, response.selectors[s_name]); + } + + // Update the scales/axes of the plots if needed + // We do this so that the plots zoom in initially after loading + for (var p_name in response.plots) { + if(response.plots[p_name].axis_domains !== null){ + for(var xy in response.plots[p_name].axis_domains){ + var selectors = response.plots[p_name].axis_domains[xy].selectors; + if(!isArray(selectors)){ + selectors = [selectors]; + } + update_scales(p_name, xy, selectors[0], + response.selectors[selectors[0]].selected); + } + } + } + + //////////////////////////////////////////// + // Widgets at bottom of page + //////////////////////////////////////////// + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } + // loading table. + var show_hide_table = widget_td.append("button") + .text("Show download status table"); + show_hide_table + .on("click", function(){ + if(this.textContent == "Show download status table"){ + loading.style("display", ""); + show_hide_table.text("Hide download status table"); + }else{ + loading.style("display", "none"); + show_hide_table.text("Show download status table"); + } + }); + var loading = widget_td.append("table") + .style("display", "none"); + Widgets["loading"] = loading; + var tr = loading.append("tr"); + tr.append("th").text("geom"); + tr.append("th").attr("class", "chunk").text("selected chunk"); + tr.append("th").attr("class", "downloaded").text("downloaded"); + tr.append("th").attr("class", "total").text("total"); + tr.append("th").attr("class", "status").text("status"); + + // Add geoms and construct nest operators. + for (var g_name in response.geoms) { + add_geom(g_name, response.geoms[g_name]); + } + + // Animation control widgets. + var show_message = "Show animation controls"; + // add a button to view the animation widgets + var show_hide_animation_controls = widget_td.append("button") + .text(show_message) + .attr("id", viz_id + "_show_hide_animation_controls") + .on("click", function(){ + if(this.textContent == show_message){ + time_table.style("display", ""); + show_hide_animation_controls.text("Hide animation controls"); + }else{ + time_table.style("display", "none"); + show_hide_animation_controls.text(show_message); + } + }) + ; + // table of the animint widgets + var time_table = widget_td.append("table") + .style("display", "none"); + var first_tr = time_table.append("tr"); + var first_th = first_tr.append("th"); + // if there's a time variable, add a button to pause the animint + if(response.time){ + Animation.next = {}; + Animation.ms = response.time.ms; + Animation.variable = response.time.variable; + Animation.sequence = response.time.sequence; + Widgets["play_pause"] = first_th.append("button") + .text("Play") + .attr("id", "play_pause") + .on("click", function(){ + if(this.textContent == "Play"){ + Animation.play(); + }else{ + Animation.pause(false); + } + }) + ; + } + first_tr.append("th").text("milliseconds"); + if(response.time){ + var second_tr = time_table.append("tr"); + second_tr.append("td").text("updates"); + second_tr.append("td").append("input") + .attr("id", "updates_ms") + .attr("type", "text") + .attr("value", Animation.ms) + .on("change", function(){ + Animation.pause(false); + Animation.ms = this.value; + Animation.play(); + }) + ; + } + for(s_name in Selectors){ + var s_info = Selectors[s_name]; + if(!s_info.hasOwnProperty("duration")){ + s_info.duration = 0; + } + } + var selector_array = d3.keys(Selectors); + var duration_rows = time_table.selectAll("tr.duration") + .data(selector_array) + .enter() + .append("tr"); + duration_rows + .append("td") + .text(function(s_name){return s_name;}); + var duration_tds = duration_rows.append("td"); + var duration_inputs = duration_tds + .append("input") + .attr("id", function(s_name){ + return viz_id + "_duration_ms_" + s_name; + }) + .attr("type", "text") + .on("change", function(s_name){ + Selectors[s_name].duration = this.value; + }) + .attr("value", function(s_name){ + return Selectors[s_name].duration; + }); + // selector widgets + var toggle_message = "Show selection menus"; + var show_or_hide_fun = function(){ + if(this.textContent == toggle_message){ + selector_table.style("display", ""); + show_hide_selector_widgets.text("Hide selection menus"); + d3.select(".urltable").style("display","") + }else{ + selector_table.style("display", "none"); + show_hide_selector_widgets.text(toggle_message); + d3.select(".urltable").style("display","none") + } + } + var show_hide_selector_widgets = widget_td.append("button") + .text(toggle_message) + .attr("class", "show_hide_selector_widgets") + .on("click", show_or_hide_fun) + ; + // adding a table for selector widgets + var selector_table = widget_td.append("table") + .style("display", "none") + .attr("class", "table_selector_widgets") + ; + var selector_first_tr = selector_table.append("tr"); + selector_first_tr + .append("th") + .text("Variable") + ; + selector_first_tr + .append("th") + .text("Selected value(s)") + ; + + // looping through and adding a row for each selector + for(s_name in Selectors) { + var s_info = Selectors[s_name]; + // for .variable .value selectors, levels is undefined and we do + // not want to make a selectize widget. + + // TODO: why does it take so long to initialize the selectize + // widget when there are many (>1000) values? + if(isArray(s_info.levels)){ + // If there were no geoms that specified clickSelects for this + // selector, then there is no way to select it other than the + // selectize widgets (and possibly legends). So in this case + // we show the selectize widgets by default. + var selector_widgets_hidden = + show_hide_selector_widgets.text() == toggle_message; + var has_no_clickSelects = + !Selectors[s_name].hasOwnProperty("clickSelects") + var has_no_legend = + !Selectors[s_name].hasOwnProperty("legend") + if(selector_widgets_hidden && has_no_clickSelects && has_no_legend){ + var node = show_hide_selector_widgets.node(); + show_or_hide_fun.apply(node); + } + // removing "." from name so it can be used in ids + var s_name_id = legend_class_name(s_name); + + // adding a row for each selector + var selector_widget_row = selector_table + .append("tr") + .attr("class", function() { return s_name_id + "_selector_widget"; }) + ; + selector_widget_row.append("td").text(s_name); + // adding the selector + var selector_widget_select = selector_widget_row + .append("td") + .append("select") + .attr("class", function() { return s_name_id + "_input"; }) + .attr("placeholder", function() { return "Toggle " + s_name; }); + // adding an option for each level of the variable + selector_widget_select.selectAll("option") + .data(s_info.levels) + .enter() + .append("option") + .attr("value", function(d) { return d; }) + .text(function(d) { return d; }); + // making sure that the first option is blank + selector_widget_select + .insert("option") + .attr("value", "") + .text(function() { return "Toggle " + s_name; }); + + // calling selectize + var selectize_selector = to_select + ' .' + s_name_id + "_input"; + if(s_info.type == "single") { + // setting up array of selector and options + var selector_values = []; + for(i in s_info.levels) { + selector_values[i] = { + id: s_name.concat("___", s_info.levels[i]), + text: s_info.levels[i] + }; + } + // the id of the first selector + var selected_id = s_name.concat("___", s_info.selected); + + // if single selection, only allow one item + var $temp = $(selectize_selector) + .selectize({ + create: false, + valueField: 'id', + labelField: 'text', + searchField: ['text'], + options: selector_values, + items: [selected_id], + maxItems: 1, + allowEmptyOption: true, + onChange: function(value) { + // extracting the name and the level to update + var selector_name = value.split("___")[0]; + var selected_level = value.split("___")[1]; + // updating the selector + update_selector(selector_name, selected_level); + } + }) + ; + } else { // multiple selection: + // setting up array of selector and options + var selector_values = []; + if(typeof s_info.levels == "object") { + for(i in s_info.levels) { + selector_values[i] = { + id: s_name.concat("___", s_info.levels[i]), + text: s_info.levels[i] + }; + } + } else { + selector_values[0] = { + id: s_name.concat("___", s_info.levels), + text: s_info.levels + }; + } + // setting up an array to contain the initally selected elements + var initial_selections = []; + for(i in s_info.selected) { + initial_selections[i] = s_name.concat("___", s_info.selected[i]); + } + + // construct the selectize + var $temp = $(selectize_selector) + .selectize({ + create: false, + valueField: 'id', + labelField: 'text', + searchField: ['text'], + options: selector_values, + items: initial_selections, + maxItems: s_info.levels.length, + allowEmptyOption: true, + onChange: function(value) { + // if nothing is selected, remove what is currently selected + if(value == null) { + // extracting the selector ids from the options + var the_ids = Object.keys($(this)[0].options); + // the name of the appropriate selector + var selector_name = the_ids[0].split("___")[0]; + // the previously selected elements + var old_selections = Selectors[selector_name].selected; + // updating the selector for each of the old selections + old_selections.forEach(function(element) { + update_selector(selector_name, element); + }); + } else { // value is not null: + // grabbing the name of the selector from the selected value + var selector_name = value[0].split("___")[0]; + // identifying the levels that should be selected + var specified_levels = []; + for(i in value) { + specified_levels[i] = value[i].split("___")[1]; + } + // the previously selected entries + old_selections = Selectors[selector_name].selected; + + // the levels that need to have selections turned on + specified_levels + .filter(function(n) { + return old_selections.indexOf(n) == -1; + }) + .forEach(function(element) { + update_selector(selector_name, element); + }) + ; + // the levels that need to be turned off + // - same approach + old_selections + .filter(function(n) { + return specified_levels.indexOf(n) == -1; + }) + .forEach(function(element) { + update_selector(selector_name, element); + }) + ; + }//value==null + }//onChange + })//selectize + ; + }//single or multiple selection. + selectized_array[s_name] = $temp[0].selectize; + }//levels, is.variable.value + } // close for loop through selector widgets + // If this is an animation, then start downloading all the rest of + // the data, and start the animation. + if (response.time) { + var i, prev, cur; + for (var i = 0; i < Animation.sequence.length; i++) { + if (i == 0) { + prev = Animation.sequence[Animation.sequence.length-1]; + } else { + prev = Animation.sequence[i - 1]; + } + cur = Animation.sequence[i]; + Animation.next[prev] = cur; + } + Animation.timer = null; + Animation.play = function(){ + if(Animation.timer == null){ // only play if not already playing. + // as shown on http://bl.ocks.org/mbostock/3808234 + Animation.timer = setInterval(update_next_animation, Animation.ms); + Widgets["play_pause"].text("Pause"); + } + }; + Animation.play_after_visible = false; + Animation.pause = function(play_after_visible){ + Animation.play_after_visible = play_after_visible; + clearInterval(Animation.timer); + Animation.timer = null; + Widgets["play_pause"].text("Play"); + }; + var s_info = Selectors[Animation.variable]; + Animation.done_geoms = {}; + s_info.update.forEach(function(g_name){ + var g_info = Geoms[g_name]; + if(g_info.chunk_order.length == 1 && + g_info.chunk_order[0] == Animation.variable){ + g_info.seq_i = Animation.sequence.indexOf(s_info.selected); + g_info.seq_count = 0; + Animation.done_geoms[g_name] = 0; + download_next(g_name); + } + }); + Animation.play(); + all_geom_names = d3.keys(response.geoms); + + // This code starts/stops the animation timer when the page is + // hidden, inspired by + // http://stackoverflow.com/questions/1060008 + function onchange (evt) { + if(document.visibilityState == "visible"){ + if(Animation.play_after_visible){ + Animation.play(); + } + }else{ + if(Widgets["play_pause"].text() == "Pause"){ + Animation.pause(true); + } + } + }; + document.addEventListener("visibilitychange", onchange); + } + // update_selector_url() + var check_func=function(){ + var status_array = $('.status').map(function(){ + return $.trim($(this).text()); + }).get(); + status_array=status_array.slice(1) + return status_array.every(function(elem){ return elem === "displayed"}); + } + if(window.location.hash) { + var fragment=window.location.hash; + fragment=fragment.slice(1); + fragment=decodeURI(fragment) + var frag_array=fragment.split(/(.*?})/); + frag_array=frag_array.filter(function(x){ return x!=""}) + frag_array.forEach(function(selector_string){ + var selector_hash=selector_string.split("="); + var selector_nam=selector_hash[0]; + var selector_values=selector_hash[1]; + var re = /\{(.*?)\}/; + selector_values = re.exec(selector_values)[1]; + var array_values = selector_values.split(','); + if(Selectors.hasOwnProperty(selector_nam)){ + var s_info = Selectors[selector_nam] + if(s_info.type=="single"){//TODO fix + array_values.forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time)Animation.pause(true) + }); + }else{ + var old_selections = Selectors[selector_nam].selected; + // the levels that need to have selections turned on + array_values + .filter(function(n) { + return old_selections.indexOf(n) == -1; + }) + .forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time){ + Animation.pause(true) + } + }); + old_selections + .filter(function(n) { + return array_values.indexOf(n) == -1; + }) + .forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time){ + Animation.pause(true) + } + }); + }//if(single) else multiple selection + }//if(Selectors.hasOwnProperty(selector_nam)) + })//frag_array.forEach + }//if(window.location.hash) + }); +}; + + diff --git a/docs/articles/linkedplots/geom1_point_associations2_chunk1.tsv b/vignettes/linkedplots/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/linkedplots/geom1_point_associations2_chunk1.tsv rename to vignettes/linkedplots/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/linkedplots/geom2_tallrect_overtime_chunk1.tsv b/vignettes/linkedplots/geom2_tallrect_overtime_chunk1.tsv similarity index 100% rename from docs/articles/linkedplots/geom2_tallrect_overtime_chunk1.tsv rename to vignettes/linkedplots/geom2_tallrect_overtime_chunk1.tsv diff --git a/docs/articles/linkedplots/geom3_point_overtime_chunk1.tsv b/vignettes/linkedplots/geom3_point_overtime_chunk1.tsv similarity index 100% rename from docs/articles/linkedplots/geom3_point_overtime_chunk1.tsv rename to vignettes/linkedplots/geom3_point_overtime_chunk1.tsv diff --git a/docs/articles/linkedplots/index.html b/vignettes/linkedplots/index.html similarity index 100% rename from docs/articles/linkedplots/index.html rename to vignettes/linkedplots/index.html diff --git a/docs/articles/linkedplots/plot.json b/vignettes/linkedplots/plot.json similarity index 97% rename from docs/articles/linkedplots/plot.json rename to vignettes/linkedplots/plot.json index 85788f664..cb608c8f0 100644 --- a/docs/articles/linkedplots/plot.json +++ b/vignettes/linkedplots/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_associationsagain": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_associationsagain", +"classed": "geom1_point_plot1", "aes": { "x": "Coolness", "y": "Cuteness", @@ -120,7 +120,7 @@ "selected": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_associationsagain", + "geom1_point_plot1", "geom3_point_overtime" ] }, @@ -131,7 +131,7 @@ "selected": "Domestic Shorthair", "levels": [ "Domestic Shorthair", "Domestic Longhair", "Cornish Rex", "Siamese", "Maine Coon" ], "update": [ - "geom1_point_associationsagain" + "geom1_point_plot1" ] }, "Day": { @@ -142,14 +142,14 @@ "selected": "1", "levels": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" ], "update": [ - "geom1_point_associationsagain", + "geom1_point_plot1", "geom2_tallrect_overtime" ], "duration": 1000 } }, "plots": { - "associationsagain": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -393,7 +393,7 @@ "height": 400 }, "geoms": [ - "geom1_point_associationsagain" + "geom1_point_plot1" ] }, "overtime": { diff --git a/docs/articles/linkedplots/scripts.html b/vignettes/linkedplots/scripts.html similarity index 100% rename from docs/articles/linkedplots/scripts.html rename to vignettes/linkedplots/scripts.html diff --git a/docs/articles/linkedplots/styles.css b/vignettes/linkedplots/styles.css similarity index 100% rename from docs/articles/linkedplots/styles.css rename to vignettes/linkedplots/styles.css diff --git a/docs/articles/linkedplots/vendor/d3.v3.js b/vignettes/linkedplots/vendor/d3.v3.js similarity index 100% rename from docs/articles/linkedplots/vendor/d3.v3.js rename to vignettes/linkedplots/vendor/d3.v3.js diff --git a/docs/articles/linkedplots/vendor/jquery-1.11.3.min.js b/vignettes/linkedplots/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/linkedplots/vendor/jquery-1.11.3.min.js rename to vignettes/linkedplots/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/linkedplots/vendor/selectize.css b/vignettes/linkedplots/vendor/selectize.css similarity index 100% rename from docs/articles/linkedplots/vendor/selectize.css rename to vignettes/linkedplots/vendor/selectize.css diff --git a/docs/articles/linkedplots/vendor/selectize.min.js b/vignettes/linkedplots/vendor/selectize.min.js similarity index 100% rename from docs/articles/linkedplots/vendor/selectize.min.js rename to vignettes/linkedplots/vendor/selectize.min.js diff --git a/vignettes/showselectedanimatedassociations/animint.js b/vignettes/showselectedanimatedassociations/animint.js new file mode 100644 index 000000000..3097224df --- /dev/null +++ b/vignettes/showselectedanimatedassociations/animint.js @@ -0,0 +1,2490 @@ +// Define functions to render linked interactive plots using d3. +// Another script should define e.g. +// +// Constructor for animint Object. +var animint = function (to_select, json_file) { + + var default_axis_px = 16; + + function wait_until_then(timeout, condFun, readyFun) { + var args=arguments + function checkFun() { + if(condFun()) { + readyFun(args[3],args[4]); + } else{ + setTimeout(checkFun, timeout); + } + } + checkFun(); + } + + function convert_R_types(resp_array, types){ + return resp_array.map(function (d) { + for (var v_name in d) { + if(!is_interactive_aes(v_name)){ + var r_type = types[v_name]; + if (r_type == "integer") { + d[v_name] = parseInt(d[v_name]); + } else if (r_type == "numeric") { + d[v_name] = parseFloat(d[v_name]); + } else if (r_type == "factor" || r_type == "rgb" + || r_type == "linetype" || r_type == "label" + || r_type == "character") { + // keep it as a character + } else if (r_type == "character" & v_name == "outliers") { + d[v_name] = parseFloat(d[v_name].split(" @ ")); + } + } + } + return d; + }); + } + + // replacing periods in variable with an underscore this makes sure + // that selector doesn't confuse . in name with css selectors + function safe_name(unsafe_name){ + return unsafe_name.replace(/[ .]/g, '_'); + } + function legend_class_name(selector_name){ + return safe_name(selector_name) + "_variable"; + } + + function is_interactive_aes(v_name){ + if(v_name.indexOf("clickSelects") > -1){ + return true; + } + if(v_name.indexOf("showSelected") > -1){ + return true; + } + return false; + } + + var linetypesize2dasharray = function (lt, size) { + var isInt = function(n) { + return typeof n === 'number' && parseFloat(n) == parseInt(n, 10) && !isNaN(n); + }; + if(isInt(lt)){ // R integer line types. + if(lt == 1){ + return null; + } + var o = { + 0: size * 0 + "," + size * 10, + 2: size * 4 + "," + size * 4, + 3: size + "," + size * 2, + 4: size + "," + size * 2 + "," + size * 4 + "," + size * 2, + 5: size * 8 + "," + size * 4, + 6: size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2 + }; + } else { // R defined line types + if(lt == "solid" || lt === null){ + return null; + } + var o = { + "blank": size * 0 + "," + size * 10, + "none": size * 0 + "," + size * 10, + "dashed": size * 4 + "," + size * 4, + "dotted": size + "," + size * 2, + "dotdash": size + "," + size * 2 + "," + size * 4 + "," + size * 2, + "longdash": size * 8 + "," + size * 4, + "twodash": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, + "22": size * 2 + "," + size * 2, + "42": size * 4 + "," + size * 2, + "44": size * 4 + "," + size * 4,"13": size + "," + size * 3, + "1343": size + "," + size * 3 + "," + size * 4 + "," + size * 3, + "73": size * 7 + "," + size * 3, + "2262": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, + "12223242": size + "," + size * 2 + "," + size * 2 + "," + size * 2 + "," + size * 3 + "," + size * 2 + "," + size * 4 + "," + size * 2, + "F282": size * 15 + "," + size * 2 + "," + size * 8 + "," + size * 2, + "F4448444": size * 15 + "," + size * 4 + "," + size * 4 + "," + size * 4 + "," + size * 8 + "," + size * 4 + "," + size * 4 + "," + size * 4, + "224282F2": size * 2 + "," + size * 2 + "," + size * 4 + "," + size * 2 + "," + size * 8 + "," + size * 2 + "," + size * 16 + "," + size * 2, + "F1": size * 16 + "," + size + }; + } + + if (lt in o){ + return o[lt]; + } else{ // manually specified line types + str = lt.split(""); + strnum = str.map(function (d) { + return size * parseInt(d, 16); + }); + return strnum; + } + }; + + var isArray = function(o) { + return Object.prototype.toString.call(o) === '[object Array]'; + }; + + // create a dummy element, apply the appropriate classes, + // and then measure the element + // Inspired from http://jsfiddle.net/uzddx/2/ + var measureText = function(pText, pFontSize, pAngle, pStyle) { + if (!pText || pText.length === 0) return {height: 0, width: 0}; + if (pAngle === null || isNaN(pAngle)) pAngle = 0; + + var container = element.append('svg'); + // do we need to set the class so that styling is applied? + //.attr('class', classname); + + container.append('text') + .attr({x: -1000, y: -1000}) + .attr("transform", "rotate(" + pAngle + ")") + .attr("style", pStyle) + .attr("font-size", pFontSize) + .text(pText); + + var bbox = container.node().getBBox(); + container.remove(); + + return {height: bbox.height, width: bbox.width}; + }; + + var nest_by_group = d3.nest().key(function(d){ return d.group; }); + var dirs = json_file.split("/"); + dirs.pop(); //if a directory path exists, remove the JSON file from dirs + var element = d3.select(to_select); + this.element = element; + var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); + var Widgets = {}; + this.Widgets = Widgets; + var Selectors = {}; + this.Selectors = Selectors; + var Plots = {}; + this.Plots = Plots; + var Geoms = {}; + this.Geoms = Geoms; + // SVGs must be stored separately from Geoms since they are + // initialized first, with the Plots. + var SVGs = {}; + this.SVGs = SVGs; + var Animation = {}; + this.Animation = Animation; + var all_geom_names = {}; + this.all_geom_names = all_geom_names; + + //creating an array to contain the selectize widgets + var selectized_array = []; + var data_object_geoms = { + "line":true, + "path":true, + "ribbon":true, + "polygon":true + }; + var css = document.createElement('style'); + css.type = 'text/css'; + var styles = [".axis path{fill: none;stroke: black;shape-rendering: crispEdges;}", + ".axis line{fill: none;stroke: black;shape-rendering: crispEdges;}", + ".axis text {font-family: sans-serif;font-size: 11px;}"]; + + var add_geom = function (g_name, g_info) { + // Determine if data will be an object or an array. + if(g_info.geom in data_object_geoms){ + g_info.data_is_object = true; + }else{ + g_info.data_is_object = false; + } + // Add a row to the loading table. + g_info.tr = Widgets["loading"].append("tr"); + g_info.tr.append("td").text(g_name); + g_info.tr.append("td").attr("class", "chunk"); + g_info.tr.append("td").attr("class", "downloaded").text(0); + g_info.tr.append("td").text(g_info.total); + g_info.tr.append("td").attr("class", "status").text("initialized"); + + // load chunk tsv + g_info.data = {}; + g_info.download_status = {}; + Geoms[g_name] = g_info; + // Determine whether common chunk tsv exists + // If yes, load it + if(g_info.hasOwnProperty("columns") && g_info.columns.common){ + var common_tsv = get_tsv(g_info, "_common"); + g_info.common_tsv = common_tsv; + var common_path = getTSVpath(common_tsv); + d3.tsv(common_path, function (error, response) { + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); + }); + } else { + g_info.common_tsv = null; + } + // Save this geom and load it! + update_geom(g_name, null); + }; + var add_plot = function (p_name, p_info) { + // Each plot may have one or more legends. To make space for the + // legends, we put each plot in a table with one row and two + // columns: tdLeft and tdRight. + var plot_table = plot_td.append("table").style("display", "inline-block"); + var plot_tr = plot_table.append("tr"); + var tdLeft = plot_tr.append("td"); + var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); + if(viz_id === null){ + p_info.plot_id = p_name; + }else{ + p_info.plot_id = viz_id + "_" + p_name; + } + var svg = tdLeft.append("svg") + .attr("id", p_info.plot_id) + .attr("height", p_info.options.height) + .attr("width", p_info.options.width); + + // divvy up width/height based on the panel layout + var nrows = Math.max.apply(null, p_info.layout.ROW); + var ncols = Math.max.apply(null, p_info.layout.COL); + var panel_names = p_info.layout.PANEL; + var npanels = Math.max.apply(null, panel_names); + + // Note axis names are "shared" across panels (just like the title) + var xtitlepadding = 5 + measureText(p_info["xtitle"], default_axis_px).height; + var ytitlepadding = 5 + measureText(p_info["ytitle"], default_axis_px).height; + + // 'margins' are fixed across panels and do not + // include title/axis/label padding (since these are not + // fixed across panels). They do, however, account for + // spacing between panels + var text_height_pixels = measureText("foo", 11).height; + var margin = { + left: 0, + right: text_height_pixels * p_info.panel_margin_lines, + top: text_height_pixels * p_info.panel_margin_lines, + bottom: 0 + }; + var plotdim = { + width: 0, + height: 0, + xstart: 0, + xend: 0, + ystart: 0, + yend: 0, + graph: { + width: 0, + height: 0 + }, + margin: margin, + xlab: { + x: 0, + y: 0 + }, + ylab: { + x: 0, + y: 0 + }, + title: { + x: 0, + y: 0 + } + }; + + // Draw the title + var titlepadding = measureText(p_info.title, p_info.title_size).height; + // why are we giving the title padding if it is undefined? + if (p_info.title === undefined) titlepadding = 0; + plotdim.title.x = p_info.options.width / 2; + plotdim.title.y = titlepadding; + svg.append("text") + .text(p_info.title) + .attr("class", "plottitle") + .attr("font-family", "sans-serif") + .attr("font-size", p_info.title_size) + .attr("transform", "translate(" + plotdim.title.x + "," + + plotdim.title.y + ")") + .style("text-anchor", "middle"); + + // grab max text size over axis labels and facet strip labels + var axispaddingy = 5; + if(p_info.hasOwnProperty("ylabs") && p_info.ylabs.length){ + axispaddingy += Math.max.apply(null, p_info.ylabs.map(function(entry){ + // + 5 to give a little extra space to avoid bad axis labels + // in shiny. + return measureText(entry, p_info.ysize).width + 5; + })); + } + var axispaddingx = 30; // distance between tick marks and x axis name. + if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ + // TODO: throw warning if text height is large portion of plot height? + axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ + return measureText(entry, p_info.xsize, p_info.xangle).height; + })); + // TODO: carefully calculating this gets complicated with rotating xlabs + //margin.right += 5; + } + plotdim.margin = margin; + + var strip_heights = p_info.strips.top.map(function(entry){ + return measureText(entry, p_info.strip_text_xsize).height; + }); + var strip_widths = p_info.strips.right.map(function(entry){ + return measureText(entry, p_info.strip_text_ysize).height; + }); + + // compute the number of x/y axes, max strip height per row, and + // max strip width per columns, for calculating height/width of + // graphing region. + var row_strip_heights = []; + var col_strip_widths = []; + var n_xaxes = 0; + var n_yaxes = 0; + var current_row, current_col; + for (var layout_i = 0; layout_i < npanels; layout_i++) { + current_row = p_info.layout.ROW[layout_i] - 1; + current_col = p_info.layout.COL[layout_i] - 1; + if(row_strip_heights[current_row] === undefined){ + row_strip_heights[current_row] = []; + } + if(col_strip_widths[current_col] === undefined){ + col_strip_widths[current_col] = []; + } + row_strip_heights[current_row].push(strip_heights[layout_i]); + col_strip_widths[current_col].push(strip_widths[layout_i]); + if (p_info.layout.COL[layout_i] == 1) { + n_xaxes += p_info.layout.AXIS_X[layout_i]; + } + if (p_info.layout.ROW[layout_i] == 1) { + n_yaxes += p_info.layout.AXIS_Y[layout_i]; + } + } + function cumsum_array(array_of_arrays){ + var cumsum = [], max_value, cumsum_value = 0; + for(var i=0; i 1) { + background.append("rect") + .attr("x", plotdim.xstart) + .attr("y", plotdim.ystart) + .attr("width", plotdim.xend - plotdim.xstart) + .attr("height", plotdim.yend - plotdim.ystart) + .attr("class", "background_rect") + .style("fill", p_info.panel_background.fill) + .style("stroke", p_info.panel_background.colour) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(p_info.panel_background.linetype, + p_info.panel_background.size); + }); + } + + // drawing the grid lines + ["grid_minor", "grid_major"].forEach(function(grid_class){ + var grid_background = p_info[grid_class]; + // if grid lines are defined + if(grid_background.hasOwnProperty("size")) { + var grid = background.append("g") + .attr("class", grid_class); + ["x","y"].forEach(function(scale_var){ + var const_var; + if(scale_var == "x"){ + const_var = "y"; + }else{ + const_var = "x"; + } + grid.append("g") + .attr("class", scale_var) + .selectAll("line") + .data(grid_background.loc[scale_var][layout_i]) + .enter() + .append("line") + .attr(const_var + "1", plotdim[const_var + "start"]) + .attr(const_var + "2", plotdim[const_var + "end"]) + .attr(scale_var + "1", function(d) { + return scales[panel_i][scale_var](d); + }) + .attr(scale_var + "2", function(d) { + return scales[panel_i][scale_var](d); + }) + .style("stroke", grid_background.colour) + .style("stroke-linecap", grid_background.lineend) + .style("stroke-width", grid_background.size) + .style("stroke-dasharray", linetypesize2dasharray( + grid_background.linetype, grid_background.size)) + ; + }); + } + }); + + // drawing border + // uses insert to draw it right before the #plottitle + if(Object.keys(p_info.panel_border).length > 1) { + background.append("rect") + .attr("x", plotdim.xstart) + .attr("y", plotdim.ystart) + .attr("width", plotdim.xend - plotdim.xstart) + .attr("height", plotdim.yend - plotdim.ystart) + .attr("class", "border_rect") + .style("fill", p_info.panel_border.fill) + .style("stroke", p_info.panel_border.colour) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(p_info.panel_border.linetype, + p_info.panel_border.size); + }); + } + + } //end of for(layout_i + // After drawing all backgrounds, we can draw the axis labels. + if(p_info["ytitle"]){ + svg.append("text") + .text(p_info["ytitle"]) + .attr("class", "ytitle") + .style("text-anchor", "middle") + .style("font-size", default_axis_px + "px") + .attr("transform", "translate(" + + ytitle_x + + "," + + (ytitle_top + ytitle_bottom)/2 + + ")rotate(270)") + ; + } + if(p_info["xtitle"]){ + svg.append("text") + .text(p_info["xtitle"]) + .attr("class", "xtitle") + .style("text-anchor", "middle") + .style("font-size", default_axis_px + "px") + .attr("transform", "translate(" + + (xtitle_left + xtitle_right)/2 + + "," + + xtitle_y + + ")") + ; + } + Plots[p_name].scales = scales; + }; //end of add_plot() + + function update_legend_opacity(v_name){ + var s_info = Selectors[v_name]; + s_info.legend_tds.style("opacity", s_info.legend_update_fun); + } + + var add_selector = function (s_name, s_info) { + Selectors[s_name] = s_info; + if(s_info.type == "multiple"){ + if(!isArray(s_info.selected)){ + s_info.selected = [s_info.selected]; + } + // legend_update_fun is evaluated in the context of the + // td.legend_entry_label. + s_info.legend_update_fun = function(d){ + var i_value = s_info.selected.indexOf(this.textContent); + if(i_value == -1){ + return 0.5; + }else{ + return 1; + } + } + }else{ + s_info.legend_update_fun = function(d){ + if(this.textContent == s_info.selected){ + return 1; + }else{ + return 0.5; + } + } + } + s_info.legend_tds = + element.selectAll("tr."+legend_class_name(s_name)+" td.legend_entry_label") + ; + update_legend_opacity(s_name); + }; //end of add_selector() + + function get_tsv(g_info, chunk_id){ + return g_info.classed + "_chunk" + chunk_id + ".tsv"; + } + function getTSVpath(tsv_name){ + return dirs.concat(tsv_name).join("/"); + } + + /** + * copy common chunk tsv to varied chunk tsv, returning an array of + * objects. + */ + function copy_chunk(g_info, varied_chunk) { + var varied_by_group = nest_by_group.map(varied_chunk); + var common_by_group = g_info.data[g_info.common_tsv]; + var new_varied_chunk = []; + for(group_id in varied_by_group){ + var varied_one_group = varied_by_group[group_id]; + var common_one_group = common_by_group[group_id]; + var common_i = 0; + for(var varied_i=0; varied_i < varied_one_group.length; varied_i++){ + // there are two cases: each group of varied data is of length + // 1, or of length of the common data. + if(common_one_group.length == varied_one_group.length){ + common_i = varied_i; + } + var varied_obj = varied_one_group[varied_i]; + var common_obj = common_one_group[common_i]; + for(col in common_obj){ + if(col != "group"){ + varied_obj[col] = common_obj[col]; + } + } + new_varied_chunk.push(varied_obj); + } + } + return new_varied_chunk; + } + + // update_geom is called from add_geom and update_selector. It + // downloads data if necessary, and then calls draw_geom. + var update_geom = function (g_name, selector_name) { + var g_info = Geoms[g_name]; + // First apply chunk_order selector variables. + var chunk_id = g_info.chunks; + g_info.chunk_order.forEach(function (v_name) { + if(chunk_id == null){ + return; // no data in a higher up chunk var. + } + var value = Selectors[v_name].selected; + if(chunk_id.hasOwnProperty(value)){ + chunk_id = chunk_id[value]; + }else{ + chunk_id = null; // no data to show in this subset. + } + }); + if(chunk_id == null){ + draw_panels(g_info, [], selector_name); //draw nothing. + return; + } + var tsv_name = get_tsv(g_info, chunk_id); + // get the data if it has not yet been downloaded. + g_info.tr.select("td.chunk").text(tsv_name); + if(g_info.data.hasOwnProperty(tsv_name)){ + draw_panels(g_info, g_info.data[tsv_name], selector_name); + }else{ + g_info.tr.select("td.status").text("downloading"); + var svg = SVGs[g_name]; + var loading = svg.append("text") + .attr("class", "loading"+tsv_name) + .text("Downloading "+tsv_name+"...") + .attr("font-size", 9) + //.attr("x", svg.attr("width")/2) + .attr("y", 10) + .style("fill", "red"); + download_chunk(g_info, tsv_name, function(chunk){ + loading.remove(); + draw_panels(g_info, chunk, selector_name); + }); + } + }; + var draw_panels = function(g_info, chunk, selector_name) { + // derive the plot name from the geometry name + var g_names = g_info.classed.split("_"); + var p_name = g_names[g_names.length - 1]; + var panels = Plots[p_name].layout.PANEL; + panels.forEach(function(panel) { + draw_geom(g_info, chunk, selector_name, panel); + }); + }; + + function download_next(g_name){ + var g_info = Geoms[g_name]; + var selector_value = Animation.sequence[g_info.seq_i]; + var chunk_id = g_info.chunks[selector_value]; + var tsv_name = get_tsv(g_info, chunk_id); + g_info.seq_count += 1; + if(Animation.sequence.length == g_info.seq_count){ + Animation.done_geoms[g_name] = 1; + return; + } + g_info.seq_i += 1; + if(g_info.seq_i == Animation.sequence.length){ + g_info.seq_i = 0; + } + if(typeof(chunk_id) == "string"){ + download_chunk(g_info, tsv_name, function(chunk){ + download_next(g_name); + }) + }else{ + download_next(g_name); + } + } + + // download_chunk is called from update_geom and download_next. + function download_chunk(g_info, tsv_name, funAfter){ + if(g_info.download_status.hasOwnProperty(tsv_name)){ + var chunk; + if(g_info.data_is_object){ + chunk = {}; + }else{ + chunk = []; + } + funAfter(chunk); + return; // do not download twice. + } + g_info.download_status[tsv_name] = "downloading"; + // prefix tsv file with appropriate path + var tsv_file = getTSVpath(tsv_name); + d3.tsv(tsv_file, function (error, response) { + // First convert to correct types. + g_info.download_status[tsv_name] = "processing"; + response = convert_R_types(response, g_info.types); + wait_until_then(500, function(){ + if(g_info.common_tsv) { + return g_info.data.hasOwnProperty(g_info.common_tsv); + }else{ + return true; + } + }, function(){ + if(g_info.common_tsv) { + // copy data from common tsv to varied tsv + response = copy_chunk(g_info, response); + } + var nest = d3.nest(); + g_info.nest_order.forEach(function (v_name) { + nest.key(function (d) { + return d[v_name]; + }); + }); + var chunk = nest.map(response); + g_info.data[tsv_name] = chunk; + g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); + g_info.download_status[tsv_name] = "saved"; + funAfter(chunk); + }); + }); + }//download_chunk. + + // update_geom is responsible for obtaining a chunk of downloaded + // data, and then calling draw_geom to actually draw it. + var draw_geom = function(g_info, chunk, selector_name, PANEL){ + g_info.tr.select("td.status").text("displayed"); + var svg = SVGs[g_info.classed]; + // derive the plot name from the geometry name + var g_names = g_info.classed.split("_"); + var p_name = g_names[g_names.length - 1]; + var scales = Plots[p_name].scales[PANEL]; + var selected_arrays = [ [] ]; //double array necessary. + var has_clickSelects = g_info.aes.hasOwnProperty("clickSelects"); + var has_clickSelects_variable = + g_info.aes.hasOwnProperty("clickSelects.variable"); + g_info.subset_order.forEach(function (aes_name) { + var selected, values; + var new_arrays = []; + if(0 < aes_name.indexOf(".variable")){ + selected_arrays.forEach(function(old_array){ + var some_data = chunk; + old_array.forEach(function(value){ + if(some_data.hasOwnProperty(value)) { + some_data = some_data[value]; + } else { + some_data = {}; + } + }) + values = d3.keys(some_data); + values.forEach(function(s_name){ + var selected = Selectors[s_name].selected; + var new_array = old_array.concat(s_name).concat(selected); + new_arrays.push(new_array); + }) + }) + }else{//not .variable aes: + if(aes_name == "PANEL"){ + selected = PANEL; + }else{ + var s_name = g_info.aes[aes_name]; + selected = Selectors[s_name].selected; + } + if(isArray(selected)){ + values = selected; //multiple selection. + }else{ + values = [selected]; //single selection. + } + values.forEach(function(value){ + selected_arrays.forEach(function(old_array){ + var new_array = old_array.concat(value); + new_arrays.push(new_array); + }) + }) + } + selected_arrays = new_arrays; + }); + // data can be either an array[] if it will be directly involved + // in a data-bind, or an object{} if it will be involved in a + // data-bind by group (e.g. geom_line). + var data; + if(g_info.data_is_object){ + data = {}; + }else{ + data = []; + } + selected_arrays.forEach(function(value_array){ + var some_data = chunk; + value_array.forEach(function(value){ + if (some_data.hasOwnProperty(value)) { + some_data = some_data[value]; + } else { + if(g_info.data_is_object){ + some_data = {}; + }else{ + some_data = []; + } + } + }); + if(g_info.data_is_object){ + if(isArray(some_data) && some_data.length){ + data["0"] = some_data; + }else{ + for(k in some_data){ + data[k] = some_data[k]; + } + } + }else{//some_data is an array. + data = data.concat(some_data); + } + }); + var aes = g_info.aes; + var toXY = function (xy, a) { + return function (d) { + return scales[xy](d[a]); + }; + }; + var layer_g_element = svg.select("g." + g_info.classed); + var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); + var elements = panel_g_element.selectAll(".geom"); + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; + }; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); + }; + + var size = 2; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; + } + var get_style_on_stroke_width = get_size; + + // stroke_width for geom_point + var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; + } + + var linetype = "solid"; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; + } + var get_dasharray = function(d){ + var lt = get_linetype(d); + return linetypesize2dasharray(lt, get_size(d)); + }; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; + } + var get_rotate = function(d){ + // x and y are the coordinates to rotate around, we choose the center + // point of the text because otherwise it will rotate around (0,0) of its + // coordinate system, which is the top left of the plot + x = scales["x"](d["x"]); + y = scales["y"](d["y"]); + var angle = get_angle(d); + // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so + // we negate the angle. + return `rotate(${-angle}, ${x}, ${y})`; + }; + + // For aes(hjust) the compiler should make an "anchor" column. + var text_anchor = "middle"; + var get_text_anchor; + if(g_info.aes.hasOwnProperty("hjust")) { + get_text_anchor = function(d){ + return d["anchor"]; + } + }else{ + get_text_anchor = function(d){ + return text_anchor; + } + } + + var eActions, eAppend; + var key_fun = null; + if(g_info.aes.hasOwnProperty("key")){ + key_fun = function(d){ + return d.key; + }; + } + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; + if(g_info.data_is_object) { + + // Lines, paths, polygons, and ribbons are a bit special. For + // every unique value of the group variable, we take the + // corresponding data rows and make 1 path. The tricky part is + // that to use d3 I do a data-bind of some "fake" data which are + // just group ids, which is the kv variable in the code below + + // // case of only 1 line and no groups. + // if(!aes.hasOwnProperty("group")){ + // kv = [{"key":0,"value":0}]; + // data = {0:data}; + // }else{ + // // we need to use a path for each group. + // var kv = d3.entries(d3.keys(data)); + // kv = kv.map(function(d){ + // d[aes.group] = d.value; + // return d; + // }); + // } + + // For an example consider breakpointError$error which is + // defined using this R code + + // geom_line(aes(segments, error, group=bases.per.probe, + // clickSelects=bases.per.probe), data=only.error, lwd=4) + + // Inside update_geom the variables take the following values + // (pseudo-Javascript code) + + // var kv = [{"key":"0","value":"133","bases.per.probe":"133"}, + // {"key":"1","value":"2667","bases.per.probe":"2667"}]; + // var data = {"133":[array of 20 points used to draw the line for group 133], + // "2667":[array of 20 points used to draw the line for group 2667]}; + + // I do elements.data(kv) so that when I set the d attribute of + // each path, I need to select the correct group before + // returning anything. + + // e.attr("d",function(group_info){ + // var one_group = data[group_info.value]; + // return lineThing(one_group); + // }) + + // To make color work I think you just have to select the group + // and take the color of the first element, e.g. + + // .style("stroke",function(group_info){ + // var one_group = data[group_info.value]; + // var one_row = one_group[0]; + // return get_color(one_row); + // } + + // In order to get d3 lines to play nice, bind fake "data" (group + // id's) -- the kv variable. Then each separate object is plotted + // using path (case of only 1 thing and no groups). + + // we need to use a path for each group. + var keyed_data = {}, one_group, group_id, k; + for(group_id in data){ + one_group = data[group_id]; + one_row = one_group[0]; + if(one_row.hasOwnProperty("key")){ + k = one_row.key; + }else{ + k = group_id; + } + keyed_data[k] = one_group; + } + var kv_array = d3.entries(d3.keys(keyed_data)); + var kv = kv_array.map(function (d) { + //d[aes.group] = d.value; + + // Need to store the clickSelects value that will + // be passed to the selector when we click on this + // item. + d.clickSelects = keyed_data[d.value][0].clickSelects; + return d; + }); + + // line, path, and polygon use d3.svg.line(), + // ribbon uses d3.svg.area() + // we have to define lineThing accordingly. + if (g_info.geom == "ribbon") { + var lineThing = d3.svg.area() + .x(toXY("x", "x")) + .y(toXY("y", "ymax")) + .y0(toXY("y", "ymin")); + } else { + var lineThing = d3.svg.line() + .x(toXY("x", "x")) + .y(toXY("y", "y")); + } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } + // select the correct group before returning anything. + key_fun = function(group_info){ + return group_info.value; + }; + data_to_bind = kv; + get_one_row = function(group_info) { + var one_group = keyed_data[group_info.value]; + var one_row = one_group[0]; + return one_row; + }; + eActions = function (e) { + e.attr("d", function (d) { + var one_group = keyed_data[d.value]; + // filter NaN since they make the whole line disappear! + var no_na = one_group.filter(function(d){ + if(g_info.geom == "ribbon"){ + return !isNaN(d.x) && !isNaN(d.ymin) && !isNaN(d.ymax); + }else{ + return !isNaN(d.x) && !isNaN(d.y); + } + }); + return lineThing(no_na); + }) + }; + eAppend = "path"; + }else{ + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); + }) + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); + }) + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } + } + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; + } + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; + } + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 + } + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; + } + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; + } + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; + } + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; + } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); + elements.exit().remove(); + var enter = elements.enter(); + if(g_info.aes.hasOwnProperty("href")){ + enter = enter.append("svg:a") + .append("svg:"+eAppend); + }else{ + enter = enter.append(eAppend) + .attr("class", "geom"); + } + var moreActions = function(e){}; + if (has_clickSelects || has_clickSelects_variable) { + moreActions = out_fun; + elements.call(out_fun) + .on("mouseover", function (d) { + d3.select(this).call(over_fun); + }) + .on("mouseout", function (d) { + d3.select(this).call(out_fun); + }) + ; + if(has_clickSelects){ + elements.on("click", function (d) { + var s_name = g_info.aes.clickSelects; + update_selector(s_name, d.clickSelects); + }); + }else{ + elements.on("click", function(d){ + var s_name = d["clickSelects.variable"]; + var s_value = d["clickSelects.value"]; + update_selector(s_name, s_value); + }); + } + } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! + var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); + if(has_clickSelects || has_tooltip || has_clickSelects_variable){ + var text_fun; + if(has_tooltip){ + text_fun = function(d){ + return d.tooltip; + }; + }else if(has_clickSelects){ + text_fun = function(d){ + var v_name = g_info.aes.clickSelects; + return v_name + " " + d.clickSelects; + }; + }else{ //clickSelects_variable + text_fun = function(d){ + return d["clickSelects.variable"] + " " + d["clickSelects.value"]; + }; + } + // if elements have an existing title, remove it. + elements.selectAll("title").remove(); + elements.append("svg:title") + .text(get_fun(text_fun)) + ; + } + if(Selectors.hasOwnProperty(selector_name)){ + var milliseconds = Selectors[selector_name].duration; + elements = elements.transition().duration(milliseconds); + } + if(g_info.aes.hasOwnProperty("id")){ + elements.attr("id", get_attr("id")); + } + if(g_info.aes.hasOwnProperty("href")){ + // elements are , children are e.g. + var linked_geoms = elements.select(eAppend); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); + }else{ + // elements are e.g. + doActions(elements); // Set the attributes of all elements (enter/exit/stay) + } + }; + + var value_tostring = function(selected_values) { + //function that is helpful to change the format of the string + var selector_url="#" + for (var selc_var in selected_values){ + if(selected_values.hasOwnProperty(selc_var)){ + var values_str=selected_values[selc_var].join(); + var sub_url=selc_var.concat("=","{",values_str,"}"); + selector_url=selector_url.concat(sub_url); + } + } + var url_nohash=window.location.href.match(/(^[^#]*)/)[0]; + selector_url=url_nohash.concat(selector_url); + return selector_url; + }; + + var get_values=function(){ + // function that is useful to get the selected values + var selected_values={} + for(var s_name in Selectors){ + var s_info=Selectors[s_name]; + var initial_selections = []; + if(s_info.type==="single"){ + initial_selections=[s_info.selected]; + } + else{ + for(var i in s_info.selected) { + initial_selections[i] = s_info.selected[i]; + } + } + selected_values[s_name]=initial_selections; + } + return selected_values; + }; + + // update scales for the plots that have update_axes option in + // theme_animint + function update_scales(p_name, axes, v_name, value){ + // Get pre-computed domain + var axis_domains = Plots[p_name]["axis_domains"]; + if(!isArray(axes)){ + axes = [axes]; + } + if(axis_domains != null){ + axes.forEach(function(xyaxis){ + // For Each PANEL, update the axes + Plots[p_name].layout.PANEL.forEach(function(panel_i, i){ + // Determine whether this panel has a scale or not + // If not we just update the scales according to the common + // scale and skip the updating of axis + var draw_axes = Plots[p_name].layout["AXIS_"+ xyaxis.toUpperCase()][i]; + if(draw_axes){ + var use_panel = panel_i; + }else{ + var use_panel = Plots[p_name].layout.PANEL[0]; + } + // We update the current selection of the plot every time + // and use it to index the correct domain + var curr_select = axis_domains[xyaxis].curr_select; + if(axis_domains[xyaxis].selectors.indexOf(v_name) > -1){ + curr_select[v_name] = value; + var str = use_panel+"."; + for(selec in curr_select){ + str = str + curr_select[selec] + "_"; + } + str = str.substring(0, str.length - 1); // Strip off trailing underscore + var use_domain = axis_domains[xyaxis]["domains"][str]; + } + if(use_domain != null){ + Plots[p_name]["scales"][panel_i][xyaxis].domain(use_domain); + var scales = Plots[p_name]["scales"][panel_i][xyaxis]; + // major and minor grid lines as calculated in the compiler + var grid_vals = Plots[p_name]["axis_domains"][xyaxis]["grids"][str]; + + // Once scales are updated, update the axis ticks if needed + if(draw_axes){ + // Tick values are same as major grid lines + update_axes(p_name, xyaxis, panel_i, grid_vals[1]); + } + // Update major and minor grid lines + update_grids(p_name, xyaxis, panel_i, grid_vals, scales); + } + }); + }); + } + } + + // Update the axis ticks etc. once plot is zoomed in/out + // currently called from update_scales. + function update_axes(p_name, axes, panel_i, tick_vals){ + var orientation; + if(axes == "x"){ + orientation = "bottom"; + }else{ + orientation = "left"; + } + if(!isArray(tick_vals)){ + tick_vals = [tick_vals]; + } + var xyaxis = d3.svg.axis() + .scale(Plots[p_name]["scales"][panel_i][axes]) + .orient(orientation) + .tickValues(tick_vals); + // update existing axis + var xyaxis_g = element.select("#plot_"+p_name).select("."+axes+"axis_"+panel_i) + .transition() + .duration(1000) + .call(xyaxis); + } + + // Update major/minor grids once axes ticks have been updated + function update_grids(p_name, axes, panel_i, grid_vals, scales){ + // Select panel to update + var bgr = element.select("#plot_"+p_name).select(".bgr"+panel_i); + // Update major and minor grid lines + ["minor", "major"].forEach(function(grid_class, j){ + var lines = bgr.select(".grid_"+grid_class).select("."+axes); + var xy1, xy2; + if(axes == "x"){ + xy1 = lines.select("line").attr("y1"); + xy2 = lines.select("line").attr("y2"); + }else{ + xy1 = lines.select("line").attr("x1"); + xy2 = lines.select("line").attr("x2"); + } + + // Get default values for grid lines like colour, stroke etc. + var grid_background = Plots[p_name]["grid_"+grid_class]; + var col = grid_background.colour; + var lt = grid_background.linetype; + var size = grid_background.size; + var cap = grid_background.lineend; + + // Remove old lines + lines.selectAll("line") + .remove(); + + if(!isArray(grid_vals[j])){ + grid_vals[j] = [grid_vals[j]]; + } + + if(axes == "x"){ + lines.selectAll("line") + .data(grid_vals[j]) + .enter() + .append("line") + .attr("y1", xy1) + .attr("y2", xy2) + .attr("x1", function(d) { return scales(d); }) + .attr("x2", function(d) { return scales(d); }) + .style("stroke", col) + .style("stroke-linecap", cap) + .style("stroke-width", size) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(lt, size); + }); + }else{ + lines.selectAll("line") + .data(grid_vals[j]) + .enter() + .append("line") + .attr("x1", xy1) + .attr("x2", xy2) + .attr("y1", function(d) { return scales(d); }) + .attr("y2", function(d) { return scales(d); }) + .style("stroke", col) + .style("stroke-linecap", cap) + .style("stroke-width", size) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(lt, size); + }); + } + }); + } + + var update_selector = function (v_name, value) { + if(!Selectors.hasOwnProperty(v_name)){ + return; + } + value = value + ""; + var s_info = Selectors[v_name]; + if(s_info.type == "single"){ + // value is the new selection. + s_info.selected = value; + }else{ + // value should be added or removed from the selection. + var i_value = s_info.selected.indexOf(value); + if(i_value == -1){ + // not found, add to selection. + s_info.selected.push(value); + }else{ + // found, remove from selection. + s_info.selected.splice(i_value, 1); + } + } + // update_selector_url() + // if there are levels, then there is a selectize widget which + // should be updated. + if(isArray(s_info.levels)){ + // the jquery ids + if(s_info.type == "single") { + var selected_ids = v_name.concat("___", value); + } else { + var selected_ids = []; + for(i in s_info.selected) { + selected_ids[i] = v_name.concat("___", s_info.selected[i]); + } + } + // from + // https://github.com/brianreavis/selectize.js/blob/master/docs/api.md: + // setValue(value, silent) If "silent" is truthy, no change + // event will be fired on the original input. + selectized_array[v_name].setValue(selected_ids, true); + } + + // For each updated geom, check if the axes of the plot need to be + // updated and update them + s_info.update.forEach(function(g_name){ + var plot_name = g_name.split("_").pop(); + var axes = Plots[plot_name]["options"]["update_axes"]; + if(axes != null){ + update_scales(plot_name, axes, v_name, value); + } + }); + + update_legend_opacity(v_name); + s_info.update.forEach(function(g_name){ + update_geom(g_name, v_name); + }); + }; + + var ifSelectedElse = function (s_value, s_name, selected, not_selected) { + var is_selected; + var s_info = Selectors[s_name]; + if(s_info.type == "single"){ + is_selected = s_value == s_info.selected; + }else{ + is_selected = s_info.selected.indexOf(s_value) != -1; + } + if(is_selected){ + return selected; + } else { + return not_selected; + } + }; + + function update_next_animation(){ + var values = d3.values(Animation.done_geoms); + if(d3.sum(values) == values.length){ + // If the values in done_geoms are all 1, then we have loaded + // all of the animation-related chunks, and we can start + // playing the animation. + var v_name = Animation.variable; + var cur = Selectors[v_name].selected; + var next = Animation.next[cur]; + update_selector(v_name, next); + } + } + + // The main idea of how legends work: + + // 1. In getLegend in animint.R I export the legend entries as a + // list of rows that can be used in a data() bind in D3. + + // 2. Here in add_legend I create a for every legend, and + // then I bind the legend entries to ,
, and elements. + var add_legend = function(p_name, p_info){ + // case of multiple legends, d3 reads legend structure in as an array + var tdRight = element.select("td."+p_name+"_legend"); + var legendkeys = d3.keys(p_info.legend); + for(var i=0; i-1){ + // aesthetics that would draw a rect + legend_svgs.append("rect") + .attr("x", 2) + .attr("y", 2) + .attr("width", 10) + .attr("height", 10) + .style("stroke-width", function(d){return d["polygonsize"]||1;}) + .style("stroke-dasharray", function(d){ + return linetypesize2dasharray(d["polygonlinetype"], d["size"]||2); + }) + .style("stroke", function(d){return d["polygoncolour"] || "#000000";}) + .style("fill", function(d){return d["polygonfill"] || "#FFFFFF";}) + .style("opacity", function(d){return d["polygonalpha"]||1;}); + } + if(l_info.geoms.indexOf("text")>-1){ + // aesthetics that would draw a rect + legend_svgs.append("text") + .attr("x", 10) + .attr("y", 14) + .style("fill", function(d){return d["textcolour"]||1;}) + .style("text-anchor", "middle") + .attr("font-size", function(d){return d["textsize"]||1;}) + .text("a"); + } + if(l_info.geoms.indexOf("path")>-1){ + // aesthetics that would draw a line + legend_svgs.append("line") + .attr("x1", 1).attr("x2", 19).attr("y1", 7).attr("y2", 7) + .style("stroke-width", function(d){ + return linescale(d["pathsize"])||2; + }) + .style("stroke-dasharray", function(d){ + return linetypesize2dasharray(d["pathlinetype"], d["pathsize"] || 2); + }) + .style("stroke", function(d){return d["pathcolour"] || "#000000";}) + .style("opacity", function(d){return d["pathalpha"]||1;}); + } + if(l_info.geoms.indexOf("point")>-1){ + // aesthetics that would draw a point + legend_svgs.append("circle") + .attr("cx", 10) + .attr("cy", 7) + .attr("r", function(d){return pointscale(d["pointsize"])||4;}) + .style("stroke", function(d){return d["pointcolour"] || "#000000";}) + .style("fill", function(d){ + return d["pointfill"] || d["pointcolour"] || "#000000"; + }) + .style("opacity", function(d){return d["pointalpha"]||1;}); + } + legend_rows.append("td") + .attr("align", "left") // TODO: right for numbers? + .attr("class", "legend_entry_label") + .attr("id", function(d){ return d["id"]+"_label"; }) + .style("font-size", function(d){ return d["text_size"]}) + .text(function(d){ return d["label"];}); + } + } + + // Download the main description of the interactive plot. + d3.json(json_file, function (error, response) { + if(response.hasOwnProperty("title")){ + // This selects the title of the web page, outside of wherever + // the animint is defined, usually a
-- so it is OK to use + // global d3.select here. + d3.select("title").text(response.title); + } + // Add plots. + for (var p_name in response.plots) { + add_plot(p_name, response.plots[p_name]); + add_legend(p_name, response.plots[p_name]); + // Append style sheet to document head. + css.appendChild(document.createTextNode(styles.join(" "))); + document.head.appendChild(css); + } + // Then add selectors and start downloading the first data subset. + for (var s_name in response.selectors) { + add_selector(s_name, response.selectors[s_name]); + } + + // Update the scales/axes of the plots if needed + // We do this so that the plots zoom in initially after loading + for (var p_name in response.plots) { + if(response.plots[p_name].axis_domains !== null){ + for(var xy in response.plots[p_name].axis_domains){ + var selectors = response.plots[p_name].axis_domains[xy].selectors; + if(!isArray(selectors)){ + selectors = [selectors]; + } + update_scales(p_name, xy, selectors[0], + response.selectors[selectors[0]].selected); + } + } + } + + //////////////////////////////////////////// + // Widgets at bottom of page + //////////////////////////////////////////// + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } + // loading table. + var show_hide_table = widget_td.append("button") + .text("Show download status table"); + show_hide_table + .on("click", function(){ + if(this.textContent == "Show download status table"){ + loading.style("display", ""); + show_hide_table.text("Hide download status table"); + }else{ + loading.style("display", "none"); + show_hide_table.text("Show download status table"); + } + }); + var loading = widget_td.append("table") + .style("display", "none"); + Widgets["loading"] = loading; + var tr = loading.append("tr"); + tr.append("th").text("geom"); + tr.append("th").attr("class", "chunk").text("selected chunk"); + tr.append("th").attr("class", "downloaded").text("downloaded"); + tr.append("th").attr("class", "total").text("total"); + tr.append("th").attr("class", "status").text("status"); + + // Add geoms and construct nest operators. + for (var g_name in response.geoms) { + add_geom(g_name, response.geoms[g_name]); + } + + // Animation control widgets. + var show_message = "Show animation controls"; + // add a button to view the animation widgets + var show_hide_animation_controls = widget_td.append("button") + .text(show_message) + .attr("id", viz_id + "_show_hide_animation_controls") + .on("click", function(){ + if(this.textContent == show_message){ + time_table.style("display", ""); + show_hide_animation_controls.text("Hide animation controls"); + }else{ + time_table.style("display", "none"); + show_hide_animation_controls.text(show_message); + } + }) + ; + // table of the animint widgets + var time_table = widget_td.append("table") + .style("display", "none"); + var first_tr = time_table.append("tr"); + var first_th = first_tr.append("th"); + // if there's a time variable, add a button to pause the animint + if(response.time){ + Animation.next = {}; + Animation.ms = response.time.ms; + Animation.variable = response.time.variable; + Animation.sequence = response.time.sequence; + Widgets["play_pause"] = first_th.append("button") + .text("Play") + .attr("id", "play_pause") + .on("click", function(){ + if(this.textContent == "Play"){ + Animation.play(); + }else{ + Animation.pause(false); + } + }) + ; + } + first_tr.append("th").text("milliseconds"); + if(response.time){ + var second_tr = time_table.append("tr"); + second_tr.append("td").text("updates"); + second_tr.append("td").append("input") + .attr("id", "updates_ms") + .attr("type", "text") + .attr("value", Animation.ms) + .on("change", function(){ + Animation.pause(false); + Animation.ms = this.value; + Animation.play(); + }) + ; + } + for(s_name in Selectors){ + var s_info = Selectors[s_name]; + if(!s_info.hasOwnProperty("duration")){ + s_info.duration = 0; + } + } + var selector_array = d3.keys(Selectors); + var duration_rows = time_table.selectAll("tr.duration") + .data(selector_array) + .enter() + .append("tr"); + duration_rows + .append("td") + .text(function(s_name){return s_name;}); + var duration_tds = duration_rows.append("td"); + var duration_inputs = duration_tds + .append("input") + .attr("id", function(s_name){ + return viz_id + "_duration_ms_" + s_name; + }) + .attr("type", "text") + .on("change", function(s_name){ + Selectors[s_name].duration = this.value; + }) + .attr("value", function(s_name){ + return Selectors[s_name].duration; + }); + // selector widgets + var toggle_message = "Show selection menus"; + var show_or_hide_fun = function(){ + if(this.textContent == toggle_message){ + selector_table.style("display", ""); + show_hide_selector_widgets.text("Hide selection menus"); + d3.select(".urltable").style("display","") + }else{ + selector_table.style("display", "none"); + show_hide_selector_widgets.text(toggle_message); + d3.select(".urltable").style("display","none") + } + } + var show_hide_selector_widgets = widget_td.append("button") + .text(toggle_message) + .attr("class", "show_hide_selector_widgets") + .on("click", show_or_hide_fun) + ; + // adding a table for selector widgets + var selector_table = widget_td.append("table") + .style("display", "none") + .attr("class", "table_selector_widgets") + ; + var selector_first_tr = selector_table.append("tr"); + selector_first_tr + .append("th") + .text("Variable") + ; + selector_first_tr + .append("th") + .text("Selected value(s)") + ; + + // looping through and adding a row for each selector + for(s_name in Selectors) { + var s_info = Selectors[s_name]; + // for .variable .value selectors, levels is undefined and we do + // not want to make a selectize widget. + + // TODO: why does it take so long to initialize the selectize + // widget when there are many (>1000) values? + if(isArray(s_info.levels)){ + // If there were no geoms that specified clickSelects for this + // selector, then there is no way to select it other than the + // selectize widgets (and possibly legends). So in this case + // we show the selectize widgets by default. + var selector_widgets_hidden = + show_hide_selector_widgets.text() == toggle_message; + var has_no_clickSelects = + !Selectors[s_name].hasOwnProperty("clickSelects") + var has_no_legend = + !Selectors[s_name].hasOwnProperty("legend") + if(selector_widgets_hidden && has_no_clickSelects && has_no_legend){ + var node = show_hide_selector_widgets.node(); + show_or_hide_fun.apply(node); + } + // removing "." from name so it can be used in ids + var s_name_id = legend_class_name(s_name); + + // adding a row for each selector + var selector_widget_row = selector_table + .append("tr") + .attr("class", function() { return s_name_id + "_selector_widget"; }) + ; + selector_widget_row.append("td").text(s_name); + // adding the selector + var selector_widget_select = selector_widget_row + .append("td") + .append("select") + .attr("class", function() { return s_name_id + "_input"; }) + .attr("placeholder", function() { return "Toggle " + s_name; }); + // adding an option for each level of the variable + selector_widget_select.selectAll("option") + .data(s_info.levels) + .enter() + .append("option") + .attr("value", function(d) { return d; }) + .text(function(d) { return d; }); + // making sure that the first option is blank + selector_widget_select + .insert("option") + .attr("value", "") + .text(function() { return "Toggle " + s_name; }); + + // calling selectize + var selectize_selector = to_select + ' .' + s_name_id + "_input"; + if(s_info.type == "single") { + // setting up array of selector and options + var selector_values = []; + for(i in s_info.levels) { + selector_values[i] = { + id: s_name.concat("___", s_info.levels[i]), + text: s_info.levels[i] + }; + } + // the id of the first selector + var selected_id = s_name.concat("___", s_info.selected); + + // if single selection, only allow one item + var $temp = $(selectize_selector) + .selectize({ + create: false, + valueField: 'id', + labelField: 'text', + searchField: ['text'], + options: selector_values, + items: [selected_id], + maxItems: 1, + allowEmptyOption: true, + onChange: function(value) { + // extracting the name and the level to update + var selector_name = value.split("___")[0]; + var selected_level = value.split("___")[1]; + // updating the selector + update_selector(selector_name, selected_level); + } + }) + ; + } else { // multiple selection: + // setting up array of selector and options + var selector_values = []; + if(typeof s_info.levels == "object") { + for(i in s_info.levels) { + selector_values[i] = { + id: s_name.concat("___", s_info.levels[i]), + text: s_info.levels[i] + }; + } + } else { + selector_values[0] = { + id: s_name.concat("___", s_info.levels), + text: s_info.levels + }; + } + // setting up an array to contain the initally selected elements + var initial_selections = []; + for(i in s_info.selected) { + initial_selections[i] = s_name.concat("___", s_info.selected[i]); + } + + // construct the selectize + var $temp = $(selectize_selector) + .selectize({ + create: false, + valueField: 'id', + labelField: 'text', + searchField: ['text'], + options: selector_values, + items: initial_selections, + maxItems: s_info.levels.length, + allowEmptyOption: true, + onChange: function(value) { + // if nothing is selected, remove what is currently selected + if(value == null) { + // extracting the selector ids from the options + var the_ids = Object.keys($(this)[0].options); + // the name of the appropriate selector + var selector_name = the_ids[0].split("___")[0]; + // the previously selected elements + var old_selections = Selectors[selector_name].selected; + // updating the selector for each of the old selections + old_selections.forEach(function(element) { + update_selector(selector_name, element); + }); + } else { // value is not null: + // grabbing the name of the selector from the selected value + var selector_name = value[0].split("___")[0]; + // identifying the levels that should be selected + var specified_levels = []; + for(i in value) { + specified_levels[i] = value[i].split("___")[1]; + } + // the previously selected entries + old_selections = Selectors[selector_name].selected; + + // the levels that need to have selections turned on + specified_levels + .filter(function(n) { + return old_selections.indexOf(n) == -1; + }) + .forEach(function(element) { + update_selector(selector_name, element); + }) + ; + // the levels that need to be turned off + // - same approach + old_selections + .filter(function(n) { + return specified_levels.indexOf(n) == -1; + }) + .forEach(function(element) { + update_selector(selector_name, element); + }) + ; + }//value==null + }//onChange + })//selectize + ; + }//single or multiple selection. + selectized_array[s_name] = $temp[0].selectize; + }//levels, is.variable.value + } // close for loop through selector widgets + // If this is an animation, then start downloading all the rest of + // the data, and start the animation. + if (response.time) { + var i, prev, cur; + for (var i = 0; i < Animation.sequence.length; i++) { + if (i == 0) { + prev = Animation.sequence[Animation.sequence.length-1]; + } else { + prev = Animation.sequence[i - 1]; + } + cur = Animation.sequence[i]; + Animation.next[prev] = cur; + } + Animation.timer = null; + Animation.play = function(){ + if(Animation.timer == null){ // only play if not already playing. + // as shown on http://bl.ocks.org/mbostock/3808234 + Animation.timer = setInterval(update_next_animation, Animation.ms); + Widgets["play_pause"].text("Pause"); + } + }; + Animation.play_after_visible = false; + Animation.pause = function(play_after_visible){ + Animation.play_after_visible = play_after_visible; + clearInterval(Animation.timer); + Animation.timer = null; + Widgets["play_pause"].text("Play"); + }; + var s_info = Selectors[Animation.variable]; + Animation.done_geoms = {}; + s_info.update.forEach(function(g_name){ + var g_info = Geoms[g_name]; + if(g_info.chunk_order.length == 1 && + g_info.chunk_order[0] == Animation.variable){ + g_info.seq_i = Animation.sequence.indexOf(s_info.selected); + g_info.seq_count = 0; + Animation.done_geoms[g_name] = 0; + download_next(g_name); + } + }); + Animation.play(); + all_geom_names = d3.keys(response.geoms); + + // This code starts/stops the animation timer when the page is + // hidden, inspired by + // http://stackoverflow.com/questions/1060008 + function onchange (evt) { + if(document.visibilityState == "visible"){ + if(Animation.play_after_visible){ + Animation.play(); + } + }else{ + if(Widgets["play_pause"].text() == "Pause"){ + Animation.pause(true); + } + } + }; + document.addEventListener("visibilitychange", onchange); + } + // update_selector_url() + var check_func=function(){ + var status_array = $('.status').map(function(){ + return $.trim($(this).text()); + }).get(); + status_array=status_array.slice(1) + return status_array.every(function(elem){ return elem === "displayed"}); + } + if(window.location.hash) { + var fragment=window.location.hash; + fragment=fragment.slice(1); + fragment=decodeURI(fragment) + var frag_array=fragment.split(/(.*?})/); + frag_array=frag_array.filter(function(x){ return x!=""}) + frag_array.forEach(function(selector_string){ + var selector_hash=selector_string.split("="); + var selector_nam=selector_hash[0]; + var selector_values=selector_hash[1]; + var re = /\{(.*?)\}/; + selector_values = re.exec(selector_values)[1]; + var array_values = selector_values.split(','); + if(Selectors.hasOwnProperty(selector_nam)){ + var s_info = Selectors[selector_nam] + if(s_info.type=="single"){//TODO fix + array_values.forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time)Animation.pause(true) + }); + }else{ + var old_selections = Selectors[selector_nam].selected; + // the levels that need to have selections turned on + array_values + .filter(function(n) { + return old_selections.indexOf(n) == -1; + }) + .forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time){ + Animation.pause(true) + } + }); + old_selections + .filter(function(n) { + return array_values.indexOf(n) == -1; + }) + .forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time){ + Animation.pause(true) + } + }); + }//if(single) else multiple selection + }//if(Selectors.hasOwnProperty(selector_nam)) + })//frag_array.forEach + }//if(window.location.hash) + }); +}; + + diff --git a/docs/articles/showselectedanimatedassociations/geom1_point_associations_chunk1.tsv b/vignettes/showselectedanimatedassociations/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/showselectedanimatedassociations/geom1_point_associations_chunk1.tsv rename to vignettes/showselectedanimatedassociations/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/showselectedanimatedassociations/index.html b/vignettes/showselectedanimatedassociations/index.html similarity index 100% rename from docs/articles/showselectedanimatedassociations/index.html rename to vignettes/showselectedanimatedassociations/index.html diff --git a/docs/articles/showselectedanimatedassociations/plot.json b/vignettes/showselectedanimatedassociations/plot.json similarity index 96% rename from docs/articles/showselectedanimatedassociations/plot.json rename to vignettes/showselectedanimatedassociations/plot.json index d904b5d7b..79fe4fc21 100644 --- a/docs/articles/showselectedanimatedassociations/plot.json +++ b/vignettes/showselectedanimatedassociations/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_associations": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_associations", +"classed": "geom1_point_plot1", "aes": { "x": "Coolness", "y": "Cuteness", @@ -58,7 +58,7 @@ "selected": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_associations" + "geom1_point_plot1" ] }, "Day": { @@ -68,13 +68,13 @@ "selected": "1", "levels": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" ], "update": [ - "geom1_point_associations" + "geom1_point_plot1" ], "duration": 1000 } }, "plots": { - "associations": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -319,7 +319,7 @@ "height": 400 }, "geoms": [ - "geom1_point_associations" + "geom1_point_plot1" ] } } diff --git a/docs/articles/showselectedanimatedassociations/scripts.html b/vignettes/showselectedanimatedassociations/scripts.html similarity index 100% rename from docs/articles/showselectedanimatedassociations/scripts.html rename to vignettes/showselectedanimatedassociations/scripts.html diff --git a/docs/articles/showselectedanimatedassociations/styles.css b/vignettes/showselectedanimatedassociations/styles.css similarity index 100% rename from docs/articles/showselectedanimatedassociations/styles.css rename to vignettes/showselectedanimatedassociations/styles.css diff --git a/docs/articles/showselectedanimatedassociations/vendor/d3.v3.js b/vignettes/showselectedanimatedassociations/vendor/d3.v3.js similarity index 100% rename from docs/articles/showselectedanimatedassociations/vendor/d3.v3.js rename to vignettes/showselectedanimatedassociations/vendor/d3.v3.js diff --git a/docs/articles/showselectedanimatedassociations/vendor/jquery-1.11.3.min.js b/vignettes/showselectedanimatedassociations/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/showselectedanimatedassociations/vendor/jquery-1.11.3.min.js rename to vignettes/showselectedanimatedassociations/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/showselectedanimatedassociations/vendor/selectize.css b/vignettes/showselectedanimatedassociations/vendor/selectize.css similarity index 100% rename from docs/articles/showselectedanimatedassociations/vendor/selectize.css rename to vignettes/showselectedanimatedassociations/vendor/selectize.css diff --git a/docs/articles/showselectedanimatedassociations/vendor/selectize.min.js b/vignettes/showselectedanimatedassociations/vendor/selectize.min.js similarity index 100% rename from docs/articles/showselectedanimatedassociations/vendor/selectize.min.js rename to vignettes/showselectedanimatedassociations/vendor/selectize.min.js diff --git a/vignettes/showselectedassociations/animint.js b/vignettes/showselectedassociations/animint.js new file mode 100644 index 000000000..3097224df --- /dev/null +++ b/vignettes/showselectedassociations/animint.js @@ -0,0 +1,2490 @@ +// Define functions to render linked interactive plots using d3. +// Another script should define e.g. +// +// Constructor for animint Object. +var animint = function (to_select, json_file) { + + var default_axis_px = 16; + + function wait_until_then(timeout, condFun, readyFun) { + var args=arguments + function checkFun() { + if(condFun()) { + readyFun(args[3],args[4]); + } else{ + setTimeout(checkFun, timeout); + } + } + checkFun(); + } + + function convert_R_types(resp_array, types){ + return resp_array.map(function (d) { + for (var v_name in d) { + if(!is_interactive_aes(v_name)){ + var r_type = types[v_name]; + if (r_type == "integer") { + d[v_name] = parseInt(d[v_name]); + } else if (r_type == "numeric") { + d[v_name] = parseFloat(d[v_name]); + } else if (r_type == "factor" || r_type == "rgb" + || r_type == "linetype" || r_type == "label" + || r_type == "character") { + // keep it as a character + } else if (r_type == "character" & v_name == "outliers") { + d[v_name] = parseFloat(d[v_name].split(" @ ")); + } + } + } + return d; + }); + } + + // replacing periods in variable with an underscore this makes sure + // that selector doesn't confuse . in name with css selectors + function safe_name(unsafe_name){ + return unsafe_name.replace(/[ .]/g, '_'); + } + function legend_class_name(selector_name){ + return safe_name(selector_name) + "_variable"; + } + + function is_interactive_aes(v_name){ + if(v_name.indexOf("clickSelects") > -1){ + return true; + } + if(v_name.indexOf("showSelected") > -1){ + return true; + } + return false; + } + + var linetypesize2dasharray = function (lt, size) { + var isInt = function(n) { + return typeof n === 'number' && parseFloat(n) == parseInt(n, 10) && !isNaN(n); + }; + if(isInt(lt)){ // R integer line types. + if(lt == 1){ + return null; + } + var o = { + 0: size * 0 + "," + size * 10, + 2: size * 4 + "," + size * 4, + 3: size + "," + size * 2, + 4: size + "," + size * 2 + "," + size * 4 + "," + size * 2, + 5: size * 8 + "," + size * 4, + 6: size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2 + }; + } else { // R defined line types + if(lt == "solid" || lt === null){ + return null; + } + var o = { + "blank": size * 0 + "," + size * 10, + "none": size * 0 + "," + size * 10, + "dashed": size * 4 + "," + size * 4, + "dotted": size + "," + size * 2, + "dotdash": size + "," + size * 2 + "," + size * 4 + "," + size * 2, + "longdash": size * 8 + "," + size * 4, + "twodash": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, + "22": size * 2 + "," + size * 2, + "42": size * 4 + "," + size * 2, + "44": size * 4 + "," + size * 4,"13": size + "," + size * 3, + "1343": size + "," + size * 3 + "," + size * 4 + "," + size * 3, + "73": size * 7 + "," + size * 3, + "2262": size * 2 + "," + size * 2 + "," + size * 6 + "," + size * 2, + "12223242": size + "," + size * 2 + "," + size * 2 + "," + size * 2 + "," + size * 3 + "," + size * 2 + "," + size * 4 + "," + size * 2, + "F282": size * 15 + "," + size * 2 + "," + size * 8 + "," + size * 2, + "F4448444": size * 15 + "," + size * 4 + "," + size * 4 + "," + size * 4 + "," + size * 8 + "," + size * 4 + "," + size * 4 + "," + size * 4, + "224282F2": size * 2 + "," + size * 2 + "," + size * 4 + "," + size * 2 + "," + size * 8 + "," + size * 2 + "," + size * 16 + "," + size * 2, + "F1": size * 16 + "," + size + }; + } + + if (lt in o){ + return o[lt]; + } else{ // manually specified line types + str = lt.split(""); + strnum = str.map(function (d) { + return size * parseInt(d, 16); + }); + return strnum; + } + }; + + var isArray = function(o) { + return Object.prototype.toString.call(o) === '[object Array]'; + }; + + // create a dummy element, apply the appropriate classes, + // and then measure the element + // Inspired from http://jsfiddle.net/uzddx/2/ + var measureText = function(pText, pFontSize, pAngle, pStyle) { + if (!pText || pText.length === 0) return {height: 0, width: 0}; + if (pAngle === null || isNaN(pAngle)) pAngle = 0; + + var container = element.append('svg'); + // do we need to set the class so that styling is applied? + //.attr('class', classname); + + container.append('text') + .attr({x: -1000, y: -1000}) + .attr("transform", "rotate(" + pAngle + ")") + .attr("style", pStyle) + .attr("font-size", pFontSize) + .text(pText); + + var bbox = container.node().getBBox(); + container.remove(); + + return {height: bbox.height, width: bbox.width}; + }; + + var nest_by_group = d3.nest().key(function(d){ return d.group; }); + var dirs = json_file.split("/"); + dirs.pop(); //if a directory path exists, remove the JSON file from dirs + var element = d3.select(to_select); + this.element = element; + var viz_id = element.attr("id"); + var plot_widget_table = element.append("table"); + var plot_td = plot_widget_table.append("tr").append("td"); + plot_td.attr("class","plot_content"); + var widget_td = plot_widget_table.append("tr").append("td"); + var Widgets = {}; + this.Widgets = Widgets; + var Selectors = {}; + this.Selectors = Selectors; + var Plots = {}; + this.Plots = Plots; + var Geoms = {}; + this.Geoms = Geoms; + // SVGs must be stored separately from Geoms since they are + // initialized first, with the Plots. + var SVGs = {}; + this.SVGs = SVGs; + var Animation = {}; + this.Animation = Animation; + var all_geom_names = {}; + this.all_geom_names = all_geom_names; + + //creating an array to contain the selectize widgets + var selectized_array = []; + var data_object_geoms = { + "line":true, + "path":true, + "ribbon":true, + "polygon":true + }; + var css = document.createElement('style'); + css.type = 'text/css'; + var styles = [".axis path{fill: none;stroke: black;shape-rendering: crispEdges;}", + ".axis line{fill: none;stroke: black;shape-rendering: crispEdges;}", + ".axis text {font-family: sans-serif;font-size: 11px;}"]; + + var add_geom = function (g_name, g_info) { + // Determine if data will be an object or an array. + if(g_info.geom in data_object_geoms){ + g_info.data_is_object = true; + }else{ + g_info.data_is_object = false; + } + // Add a row to the loading table. + g_info.tr = Widgets["loading"].append("tr"); + g_info.tr.append("td").text(g_name); + g_info.tr.append("td").attr("class", "chunk"); + g_info.tr.append("td").attr("class", "downloaded").text(0); + g_info.tr.append("td").text(g_info.total); + g_info.tr.append("td").attr("class", "status").text("initialized"); + + // load chunk tsv + g_info.data = {}; + g_info.download_status = {}; + Geoms[g_name] = g_info; + // Determine whether common chunk tsv exists + // If yes, load it + if(g_info.hasOwnProperty("columns") && g_info.columns.common){ + var common_tsv = get_tsv(g_info, "_common"); + g_info.common_tsv = common_tsv; + var common_path = getTSVpath(common_tsv); + d3.tsv(common_path, function (error, response) { + var converted = convert_R_types(response, g_info.types); + g_info.data[common_tsv] = nest_by_group.map(converted); + }); + } else { + g_info.common_tsv = null; + } + // Save this geom and load it! + update_geom(g_name, null); + }; + var add_plot = function (p_name, p_info) { + // Each plot may have one or more legends. To make space for the + // legends, we put each plot in a table with one row and two + // columns: tdLeft and tdRight. + var plot_table = plot_td.append("table").style("display", "inline-block"); + var plot_tr = plot_table.append("tr"); + var tdLeft = plot_tr.append("td"); + var tdRight = plot_tr.append("td").attr("class", p_name+"_legend"); + if(viz_id === null){ + p_info.plot_id = p_name; + }else{ + p_info.plot_id = viz_id + "_" + p_name; + } + var svg = tdLeft.append("svg") + .attr("id", p_info.plot_id) + .attr("height", p_info.options.height) + .attr("width", p_info.options.width); + + // divvy up width/height based on the panel layout + var nrows = Math.max.apply(null, p_info.layout.ROW); + var ncols = Math.max.apply(null, p_info.layout.COL); + var panel_names = p_info.layout.PANEL; + var npanels = Math.max.apply(null, panel_names); + + // Note axis names are "shared" across panels (just like the title) + var xtitlepadding = 5 + measureText(p_info["xtitle"], default_axis_px).height; + var ytitlepadding = 5 + measureText(p_info["ytitle"], default_axis_px).height; + + // 'margins' are fixed across panels and do not + // include title/axis/label padding (since these are not + // fixed across panels). They do, however, account for + // spacing between panels + var text_height_pixels = measureText("foo", 11).height; + var margin = { + left: 0, + right: text_height_pixels * p_info.panel_margin_lines, + top: text_height_pixels * p_info.panel_margin_lines, + bottom: 0 + }; + var plotdim = { + width: 0, + height: 0, + xstart: 0, + xend: 0, + ystart: 0, + yend: 0, + graph: { + width: 0, + height: 0 + }, + margin: margin, + xlab: { + x: 0, + y: 0 + }, + ylab: { + x: 0, + y: 0 + }, + title: { + x: 0, + y: 0 + } + }; + + // Draw the title + var titlepadding = measureText(p_info.title, p_info.title_size).height; + // why are we giving the title padding if it is undefined? + if (p_info.title === undefined) titlepadding = 0; + plotdim.title.x = p_info.options.width / 2; + plotdim.title.y = titlepadding; + svg.append("text") + .text(p_info.title) + .attr("class", "plottitle") + .attr("font-family", "sans-serif") + .attr("font-size", p_info.title_size) + .attr("transform", "translate(" + plotdim.title.x + "," + + plotdim.title.y + ")") + .style("text-anchor", "middle"); + + // grab max text size over axis labels and facet strip labels + var axispaddingy = 5; + if(p_info.hasOwnProperty("ylabs") && p_info.ylabs.length){ + axispaddingy += Math.max.apply(null, p_info.ylabs.map(function(entry){ + // + 5 to give a little extra space to avoid bad axis labels + // in shiny. + return measureText(entry, p_info.ysize).width + 5; + })); + } + var axispaddingx = 30; // distance between tick marks and x axis name. + if(p_info.hasOwnProperty("xlabs") && p_info.xlabs.length){ + // TODO: throw warning if text height is large portion of plot height? + axispaddingx += Math.max.apply(null, p_info.xlabs.map(function(entry){ + return measureText(entry, p_info.xsize, p_info.xangle).height; + })); + // TODO: carefully calculating this gets complicated with rotating xlabs + //margin.right += 5; + } + plotdim.margin = margin; + + var strip_heights = p_info.strips.top.map(function(entry){ + return measureText(entry, p_info.strip_text_xsize).height; + }); + var strip_widths = p_info.strips.right.map(function(entry){ + return measureText(entry, p_info.strip_text_ysize).height; + }); + + // compute the number of x/y axes, max strip height per row, and + // max strip width per columns, for calculating height/width of + // graphing region. + var row_strip_heights = []; + var col_strip_widths = []; + var n_xaxes = 0; + var n_yaxes = 0; + var current_row, current_col; + for (var layout_i = 0; layout_i < npanels; layout_i++) { + current_row = p_info.layout.ROW[layout_i] - 1; + current_col = p_info.layout.COL[layout_i] - 1; + if(row_strip_heights[current_row] === undefined){ + row_strip_heights[current_row] = []; + } + if(col_strip_widths[current_col] === undefined){ + col_strip_widths[current_col] = []; + } + row_strip_heights[current_row].push(strip_heights[layout_i]); + col_strip_widths[current_col].push(strip_widths[layout_i]); + if (p_info.layout.COL[layout_i] == 1) { + n_xaxes += p_info.layout.AXIS_X[layout_i]; + } + if (p_info.layout.ROW[layout_i] == 1) { + n_yaxes += p_info.layout.AXIS_Y[layout_i]; + } + } + function cumsum_array(array_of_arrays){ + var cumsum = [], max_value, cumsum_value = 0; + for(var i=0; i 1) { + background.append("rect") + .attr("x", plotdim.xstart) + .attr("y", plotdim.ystart) + .attr("width", plotdim.xend - plotdim.xstart) + .attr("height", plotdim.yend - plotdim.ystart) + .attr("class", "background_rect") + .style("fill", p_info.panel_background.fill) + .style("stroke", p_info.panel_background.colour) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(p_info.panel_background.linetype, + p_info.panel_background.size); + }); + } + + // drawing the grid lines + ["grid_minor", "grid_major"].forEach(function(grid_class){ + var grid_background = p_info[grid_class]; + // if grid lines are defined + if(grid_background.hasOwnProperty("size")) { + var grid = background.append("g") + .attr("class", grid_class); + ["x","y"].forEach(function(scale_var){ + var const_var; + if(scale_var == "x"){ + const_var = "y"; + }else{ + const_var = "x"; + } + grid.append("g") + .attr("class", scale_var) + .selectAll("line") + .data(grid_background.loc[scale_var][layout_i]) + .enter() + .append("line") + .attr(const_var + "1", plotdim[const_var + "start"]) + .attr(const_var + "2", plotdim[const_var + "end"]) + .attr(scale_var + "1", function(d) { + return scales[panel_i][scale_var](d); + }) + .attr(scale_var + "2", function(d) { + return scales[panel_i][scale_var](d); + }) + .style("stroke", grid_background.colour) + .style("stroke-linecap", grid_background.lineend) + .style("stroke-width", grid_background.size) + .style("stroke-dasharray", linetypesize2dasharray( + grid_background.linetype, grid_background.size)) + ; + }); + } + }); + + // drawing border + // uses insert to draw it right before the #plottitle + if(Object.keys(p_info.panel_border).length > 1) { + background.append("rect") + .attr("x", plotdim.xstart) + .attr("y", plotdim.ystart) + .attr("width", plotdim.xend - plotdim.xstart) + .attr("height", plotdim.yend - plotdim.ystart) + .attr("class", "border_rect") + .style("fill", p_info.panel_border.fill) + .style("stroke", p_info.panel_border.colour) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(p_info.panel_border.linetype, + p_info.panel_border.size); + }); + } + + } //end of for(layout_i + // After drawing all backgrounds, we can draw the axis labels. + if(p_info["ytitle"]){ + svg.append("text") + .text(p_info["ytitle"]) + .attr("class", "ytitle") + .style("text-anchor", "middle") + .style("font-size", default_axis_px + "px") + .attr("transform", "translate(" + + ytitle_x + + "," + + (ytitle_top + ytitle_bottom)/2 + + ")rotate(270)") + ; + } + if(p_info["xtitle"]){ + svg.append("text") + .text(p_info["xtitle"]) + .attr("class", "xtitle") + .style("text-anchor", "middle") + .style("font-size", default_axis_px + "px") + .attr("transform", "translate(" + + (xtitle_left + xtitle_right)/2 + + "," + + xtitle_y + + ")") + ; + } + Plots[p_name].scales = scales; + }; //end of add_plot() + + function update_legend_opacity(v_name){ + var s_info = Selectors[v_name]; + s_info.legend_tds.style("opacity", s_info.legend_update_fun); + } + + var add_selector = function (s_name, s_info) { + Selectors[s_name] = s_info; + if(s_info.type == "multiple"){ + if(!isArray(s_info.selected)){ + s_info.selected = [s_info.selected]; + } + // legend_update_fun is evaluated in the context of the + // td.legend_entry_label. + s_info.legend_update_fun = function(d){ + var i_value = s_info.selected.indexOf(this.textContent); + if(i_value == -1){ + return 0.5; + }else{ + return 1; + } + } + }else{ + s_info.legend_update_fun = function(d){ + if(this.textContent == s_info.selected){ + return 1; + }else{ + return 0.5; + } + } + } + s_info.legend_tds = + element.selectAll("tr."+legend_class_name(s_name)+" td.legend_entry_label") + ; + update_legend_opacity(s_name); + }; //end of add_selector() + + function get_tsv(g_info, chunk_id){ + return g_info.classed + "_chunk" + chunk_id + ".tsv"; + } + function getTSVpath(tsv_name){ + return dirs.concat(tsv_name).join("/"); + } + + /** + * copy common chunk tsv to varied chunk tsv, returning an array of + * objects. + */ + function copy_chunk(g_info, varied_chunk) { + var varied_by_group = nest_by_group.map(varied_chunk); + var common_by_group = g_info.data[g_info.common_tsv]; + var new_varied_chunk = []; + for(group_id in varied_by_group){ + var varied_one_group = varied_by_group[group_id]; + var common_one_group = common_by_group[group_id]; + var common_i = 0; + for(var varied_i=0; varied_i < varied_one_group.length; varied_i++){ + // there are two cases: each group of varied data is of length + // 1, or of length of the common data. + if(common_one_group.length == varied_one_group.length){ + common_i = varied_i; + } + var varied_obj = varied_one_group[varied_i]; + var common_obj = common_one_group[common_i]; + for(col in common_obj){ + if(col != "group"){ + varied_obj[col] = common_obj[col]; + } + } + new_varied_chunk.push(varied_obj); + } + } + return new_varied_chunk; + } + + // update_geom is called from add_geom and update_selector. It + // downloads data if necessary, and then calls draw_geom. + var update_geom = function (g_name, selector_name) { + var g_info = Geoms[g_name]; + // First apply chunk_order selector variables. + var chunk_id = g_info.chunks; + g_info.chunk_order.forEach(function (v_name) { + if(chunk_id == null){ + return; // no data in a higher up chunk var. + } + var value = Selectors[v_name].selected; + if(chunk_id.hasOwnProperty(value)){ + chunk_id = chunk_id[value]; + }else{ + chunk_id = null; // no data to show in this subset. + } + }); + if(chunk_id == null){ + draw_panels(g_info, [], selector_name); //draw nothing. + return; + } + var tsv_name = get_tsv(g_info, chunk_id); + // get the data if it has not yet been downloaded. + g_info.tr.select("td.chunk").text(tsv_name); + if(g_info.data.hasOwnProperty(tsv_name)){ + draw_panels(g_info, g_info.data[tsv_name], selector_name); + }else{ + g_info.tr.select("td.status").text("downloading"); + var svg = SVGs[g_name]; + var loading = svg.append("text") + .attr("class", "loading"+tsv_name) + .text("Downloading "+tsv_name+"...") + .attr("font-size", 9) + //.attr("x", svg.attr("width")/2) + .attr("y", 10) + .style("fill", "red"); + download_chunk(g_info, tsv_name, function(chunk){ + loading.remove(); + draw_panels(g_info, chunk, selector_name); + }); + } + }; + var draw_panels = function(g_info, chunk, selector_name) { + // derive the plot name from the geometry name + var g_names = g_info.classed.split("_"); + var p_name = g_names[g_names.length - 1]; + var panels = Plots[p_name].layout.PANEL; + panels.forEach(function(panel) { + draw_geom(g_info, chunk, selector_name, panel); + }); + }; + + function download_next(g_name){ + var g_info = Geoms[g_name]; + var selector_value = Animation.sequence[g_info.seq_i]; + var chunk_id = g_info.chunks[selector_value]; + var tsv_name = get_tsv(g_info, chunk_id); + g_info.seq_count += 1; + if(Animation.sequence.length == g_info.seq_count){ + Animation.done_geoms[g_name] = 1; + return; + } + g_info.seq_i += 1; + if(g_info.seq_i == Animation.sequence.length){ + g_info.seq_i = 0; + } + if(typeof(chunk_id) == "string"){ + download_chunk(g_info, tsv_name, function(chunk){ + download_next(g_name); + }) + }else{ + download_next(g_name); + } + } + + // download_chunk is called from update_geom and download_next. + function download_chunk(g_info, tsv_name, funAfter){ + if(g_info.download_status.hasOwnProperty(tsv_name)){ + var chunk; + if(g_info.data_is_object){ + chunk = {}; + }else{ + chunk = []; + } + funAfter(chunk); + return; // do not download twice. + } + g_info.download_status[tsv_name] = "downloading"; + // prefix tsv file with appropriate path + var tsv_file = getTSVpath(tsv_name); + d3.tsv(tsv_file, function (error, response) { + // First convert to correct types. + g_info.download_status[tsv_name] = "processing"; + response = convert_R_types(response, g_info.types); + wait_until_then(500, function(){ + if(g_info.common_tsv) { + return g_info.data.hasOwnProperty(g_info.common_tsv); + }else{ + return true; + } + }, function(){ + if(g_info.common_tsv) { + // copy data from common tsv to varied tsv + response = copy_chunk(g_info, response); + } + var nest = d3.nest(); + g_info.nest_order.forEach(function (v_name) { + nest.key(function (d) { + return d[v_name]; + }); + }); + var chunk = nest.map(response); + g_info.data[tsv_name] = chunk; + g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); + g_info.download_status[tsv_name] = "saved"; + funAfter(chunk); + }); + }); + }//download_chunk. + + // update_geom is responsible for obtaining a chunk of downloaded + // data, and then calling draw_geom to actually draw it. + var draw_geom = function(g_info, chunk, selector_name, PANEL){ + g_info.tr.select("td.status").text("displayed"); + var svg = SVGs[g_info.classed]; + // derive the plot name from the geometry name + var g_names = g_info.classed.split("_"); + var p_name = g_names[g_names.length - 1]; + var scales = Plots[p_name].scales[PANEL]; + var selected_arrays = [ [] ]; //double array necessary. + var has_clickSelects = g_info.aes.hasOwnProperty("clickSelects"); + var has_clickSelects_variable = + g_info.aes.hasOwnProperty("clickSelects.variable"); + g_info.subset_order.forEach(function (aes_name) { + var selected, values; + var new_arrays = []; + if(0 < aes_name.indexOf(".variable")){ + selected_arrays.forEach(function(old_array){ + var some_data = chunk; + old_array.forEach(function(value){ + if(some_data.hasOwnProperty(value)) { + some_data = some_data[value]; + } else { + some_data = {}; + } + }) + values = d3.keys(some_data); + values.forEach(function(s_name){ + var selected = Selectors[s_name].selected; + var new_array = old_array.concat(s_name).concat(selected); + new_arrays.push(new_array); + }) + }) + }else{//not .variable aes: + if(aes_name == "PANEL"){ + selected = PANEL; + }else{ + var s_name = g_info.aes[aes_name]; + selected = Selectors[s_name].selected; + } + if(isArray(selected)){ + values = selected; //multiple selection. + }else{ + values = [selected]; //single selection. + } + values.forEach(function(value){ + selected_arrays.forEach(function(old_array){ + var new_array = old_array.concat(value); + new_arrays.push(new_array); + }) + }) + } + selected_arrays = new_arrays; + }); + // data can be either an array[] if it will be directly involved + // in a data-bind, or an object{} if it will be involved in a + // data-bind by group (e.g. geom_line). + var data; + if(g_info.data_is_object){ + data = {}; + }else{ + data = []; + } + selected_arrays.forEach(function(value_array){ + var some_data = chunk; + value_array.forEach(function(value){ + if (some_data.hasOwnProperty(value)) { + some_data = some_data[value]; + } else { + if(g_info.data_is_object){ + some_data = {}; + }else{ + some_data = []; + } + } + }); + if(g_info.data_is_object){ + if(isArray(some_data) && some_data.length){ + data["0"] = some_data; + }else{ + for(k in some_data){ + data[k] = some_data[k]; + } + } + }else{//some_data is an array. + data = data.concat(some_data); + } + }); + var aes = g_info.aes; + var toXY = function (xy, a) { + return function (d) { + return scales[xy](d[a]); + }; + }; + var layer_g_element = svg.select("g." + g_info.classed); + var panel_g_element = layer_g_element.select("g.PANEL" + PANEL); + var elements = panel_g_element.selectAll(".geom"); + + // helper functions so we can write code that works for both + // grouped and ungrouped geoms. get_one_row returns one row of + // data (not one group), in both cases. + var get_fun = function(fun){ + return function(input){ + var d = get_one_row(input); + return fun(d); + }; + }; + var get_attr = function(attr_name){ + return get_fun(function(d){ + return d[attr_name]; + }); + }; + + var size = 2; + var get_size; + if(aes.hasOwnProperty("size")){ + get_size = get_attr("size"); + }else{ + get_size = function(d){ + return size; + }; + } + var get_style_on_stroke_width = get_size; + + // stroke_width for geom_point + var stroke_width = 1; // by default ggplot2 has 0.5, animint has 1 + var get_stroke_width; + if(aes.hasOwnProperty("stroke")){ + get_stroke_width = get_attr("stroke"); + }else{ + get_stroke_width = function(d){ + return stroke_width; + }; + } + + var linetype = "solid"; + var get_linetype; + if(aes.hasOwnProperty("linetype")){ + get_linetype = get_attr("linetype"); + }else{ + get_linetype = function(d){ + return linetype; + }; + } + var get_dasharray = function(d){ + var lt = get_linetype(d); + return linetypesize2dasharray(lt, get_size(d)); + }; + + var alpha = 1, alpha_off = 0.5; + var get_alpha; + var get_alpha_off = function (d) { + return alpha_off; + }; + if(aes.hasOwnProperty("alpha")){ + get_alpha = get_attr("alpha"); + get_alpha_off = get_attr("alpha"); + } else { + get_alpha = function(d){ + return alpha; + }; + } + + var colour = "black", colour_off; + var get_colour; + var get_colour_off = function (d) { + return colour_off; + }; + if(aes.hasOwnProperty("colour")){ + get_colour = get_attr("colour"); + get_colour_off = get_colour; + }else{ + get_colour = function (d) { + return colour; + }; + } + var get_colour_off_default = get_colour; + + var fill = "black", fill_off = "black"; + var get_fill = function (d) { + return fill; + }; + var get_fill_off = function (d) { + return fill_off; + }; + + var angle = 0; + var get_angle; + if(aes.hasOwnProperty("angle")){ + get_angle = get_attr("angle"); + }else{ + get_angle = function(d){ + return angle; + }; + } + var get_rotate = function(d){ + // x and y are the coordinates to rotate around, we choose the center + // point of the text because otherwise it will rotate around (0,0) of its + // coordinate system, which is the top left of the plot + x = scales["x"](d["x"]); + y = scales["y"](d["y"]); + var angle = get_angle(d); + // ggplot expects angles to be in degrees CCW, SVG uses degrees CW, so + // we negate the angle. + return `rotate(${-angle}, ${x}, ${y})`; + }; + + // For aes(hjust) the compiler should make an "anchor" column. + var text_anchor = "middle"; + var get_text_anchor; + if(g_info.aes.hasOwnProperty("hjust")) { + get_text_anchor = function(d){ + return d["anchor"]; + } + }else{ + get_text_anchor = function(d){ + return text_anchor; + } + } + + var eActions, eAppend; + var key_fun = null; + if(g_info.aes.hasOwnProperty("key")){ + key_fun = function(d){ + return d.key; + }; + } + var get_one_row;//different for grouped and ungrouped geoms. + var data_to_bind; + g_info.style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray","fill"]; + var line_style_list = [ + "opacity","stroke","stroke-width","stroke-dasharray"]; + var fill_comes_from="fill", fill_off_comes_from="fill_off"; + if(g_info.data_is_object) { + + // Lines, paths, polygons, and ribbons are a bit special. For + // every unique value of the group variable, we take the + // corresponding data rows and make 1 path. The tricky part is + // that to use d3 I do a data-bind of some "fake" data which are + // just group ids, which is the kv variable in the code below + + // // case of only 1 line and no groups. + // if(!aes.hasOwnProperty("group")){ + // kv = [{"key":0,"value":0}]; + // data = {0:data}; + // }else{ + // // we need to use a path for each group. + // var kv = d3.entries(d3.keys(data)); + // kv = kv.map(function(d){ + // d[aes.group] = d.value; + // return d; + // }); + // } + + // For an example consider breakpointError$error which is + // defined using this R code + + // geom_line(aes(segments, error, group=bases.per.probe, + // clickSelects=bases.per.probe), data=only.error, lwd=4) + + // Inside update_geom the variables take the following values + // (pseudo-Javascript code) + + // var kv = [{"key":"0","value":"133","bases.per.probe":"133"}, + // {"key":"1","value":"2667","bases.per.probe":"2667"}]; + // var data = {"133":[array of 20 points used to draw the line for group 133], + // "2667":[array of 20 points used to draw the line for group 2667]}; + + // I do elements.data(kv) so that when I set the d attribute of + // each path, I need to select the correct group before + // returning anything. + + // e.attr("d",function(group_info){ + // var one_group = data[group_info.value]; + // return lineThing(one_group); + // }) + + // To make color work I think you just have to select the group + // and take the color of the first element, e.g. + + // .style("stroke",function(group_info){ + // var one_group = data[group_info.value]; + // var one_row = one_group[0]; + // return get_color(one_row); + // } + + // In order to get d3 lines to play nice, bind fake "data" (group + // id's) -- the kv variable. Then each separate object is plotted + // using path (case of only 1 thing and no groups). + + // we need to use a path for each group. + var keyed_data = {}, one_group, group_id, k; + for(group_id in data){ + one_group = data[group_id]; + one_row = one_group[0]; + if(one_row.hasOwnProperty("key")){ + k = one_row.key; + }else{ + k = group_id; + } + keyed_data[k] = one_group; + } + var kv_array = d3.entries(d3.keys(keyed_data)); + var kv = kv_array.map(function (d) { + //d[aes.group] = d.value; + + // Need to store the clickSelects value that will + // be passed to the selector when we click on this + // item. + d.clickSelects = keyed_data[d.value][0].clickSelects; + return d; + }); + + // line, path, and polygon use d3.svg.line(), + // ribbon uses d3.svg.area() + // we have to define lineThing accordingly. + if (g_info.geom == "ribbon") { + var lineThing = d3.svg.area() + .x(toXY("x", "x")) + .y(toXY("y", "ymax")) + .y0(toXY("y", "ymin")); + } else { + var lineThing = d3.svg.line() + .x(toXY("x", "x")) + .y(toXY("y", "y")); + } + if(["line","path"].includes(g_info.geom)){ + fill = "none"; + fill_off = "none"; + } + // select the correct group before returning anything. + key_fun = function(group_info){ + return group_info.value; + }; + data_to_bind = kv; + get_one_row = function(group_info) { + var one_group = keyed_data[group_info.value]; + var one_row = one_group[0]; + return one_row; + }; + eActions = function (e) { + e.attr("d", function (d) { + var one_group = keyed_data[d.value]; + // filter NaN since they make the whole line disappear! + var no_na = one_group.filter(function(d){ + if(g_info.geom == "ribbon"){ + return !isNaN(d.x) && !isNaN(d.ymin) && !isNaN(d.ymax); + }else{ + return !isNaN(d.x) && !isNaN(d.y); + } + }); + return lineThing(no_na); + }) + }; + eAppend = "path"; + }else{ + get_one_row = function(d){ + return d; + } + data_to_bind = data; + if (g_info.geom == "segment") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); + }) + .attr("x2", function (d) { + return scales.x(d["xend"]); + }) + .attr("y1", function (d) { + return scales.y(d["y"]); + }) + .attr("y2", function (d) { + return scales.y(d["yend"]); + }) + }; + eAppend = "line"; + } + if (g_info.geom == "linerange") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", function (d) { + return scales.x(d["x"]); + }) + .attr("x2", function (d) { + return scales.x(d["x"]); + }) + .attr("y1", function (d) { + return scales.y(d["ymax"]); + }) + .attr("y2", function (d) { + return scales.y(d["ymin"]); + }) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "vline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("x1", toXY("x", "xintercept")) + .attr("x2", toXY("x", "xintercept")) + .attr("y1", scales.y.range()[0]) + .attr("y2", scales.y.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "hline") { + g_info.style_list = line_style_list; + eActions = function (e) { + e.attr("y1", toXY("y", "yintercept")) + .attr("y2", toXY("y", "yintercept")) + .attr("x1", scales.x.range()[0]) + .attr("x2", scales.x.range()[1]) + ; + }; + eAppend = "line"; + } + if (g_info.geom == "text") { + size = 12;//default + get_colour = function(d){ + return "none"; + }; + get_colour_off = function(d) { + return "none"; + }; + fill_comes_from = "colour"; + fill_off_comes_from = "colour_off"; + g_info.style_list = [ + "opacity","fill"]; + eActions = function (e) { + e.attr("x", toXY("x", "x")) + .attr("y", toXY("y", "y")) + .attr("font-size", get_size) + .style("text-anchor", get_text_anchor) + .attr("transform", get_rotate) + .text(function (d) { + return d.label; + }) + ; + }; + eAppend = "text"; + } + if (g_info.geom == "point") { + // point is special because it takes SVG fill from ggplot + // colour, if fill is not specified. + if(!( + g_info.params.hasOwnProperty("fill") || + aes.hasOwnProperty("fill") + )){ + fill_comes_from = "colour"; + } + if(!g_info.params.hasOwnProperty("fill_off")){ + fill_off_comes_from = "colour_off"; + } + get_style_on_stroke_width = get_stroke_width;//not size. + eActions = function (e) { + e.attr("cx", toXY("x", "x")) + .attr("cy", toXY("y", "y")) + .attr("r", get_size) + ; + }; + eAppend = "circle"; + } + var rect_geoms = ["tallrect","widerect","rect"]; + if(rect_geoms.includes(g_info.geom)){ + eAppend = "rect"; + if (g_info.geom == "tallrect") { + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return scales.x(d["xmax"]) - scales.x(d["xmin"]); + }) + .attr("y", scales.y.range()[1]) + .attr("height", scales.y.range()[0] - scales.y.range()[1]) + ; + }; + } + if (g_info.geom == "widerect") { + eActions = function (e) { + e.attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return scales.y(d["ymin"]) - scales.y(d["ymax"]); + }) + .attr("x", scales.x.range()[0]) + .attr("width", scales.x.range()[1] - scales.x.range()[0]) + ; + }; + } + if (g_info.geom == "rect") { + alpha_off = alpha; + colour_off = "transparent"; + get_colour_off_default = get_colour_off; + eActions = function (e) { + e.attr("x", toXY("x", "xmin")) + .attr("width", function (d) { + return Math.abs(scales.x(d.xmax) - scales.x(d.xmin)); + }) + .attr("y", toXY("y", "ymax")) + .attr("height", function (d) { + return Math.abs(scales.y(d.ymin) - scales.y(d.ymax)); + }) + ; + }; + } + } + } + // set params after geom-specific code, because each geom may have + // a different default. + if (g_info.params.hasOwnProperty("stroke")) { + stroke_width = g_info.params.stroke; + } + if (g_info.params.hasOwnProperty("linetype")) { + linetype = g_info.params.linetype; + } + if(g_info.params.hasOwnProperty("alpha")){ + alpha = g_info.params.alpha; + alpha_off = alpha - 0.5 + } + if(g_info.params.hasOwnProperty("alpha_off")){ + alpha_off = g_info.params.alpha_off; + } + if(g_info.params.hasOwnProperty("anchor")){ + text_anchor = g_info.params["anchor"]; + } + if(g_info.params.hasOwnProperty("colour")){ + colour = g_info.params.colour; + } + if(g_info.params.hasOwnProperty("colour_off")){ + colour_off = g_info.params.colour_off; + }else{ + get_colour_off = get_colour_off_default; + } + if (g_info.params.hasOwnProperty("angle")) { + angle = g_info.params["angle"]; + } + if (g_info.params.hasOwnProperty(fill_comes_from)) { + fill = g_info.params[fill_comes_from]; + } + if (g_info.params.hasOwnProperty(fill_off_comes_from)) { + fill_off = g_info.params[fill_off_comes_from]; + }else{ + fill_off = fill; + } + if(aes.hasOwnProperty(fill_comes_from)){ + get_fill = get_attr(fill_comes_from); + get_fill_off = get_attr(fill_comes_from); + }; + if (g_info.params.hasOwnProperty("size")) { + size = g_info.params.size; + } + var styleActions = function(e){ + g_info.style_list.forEach(function(s){ + e.style(s, function(d) { + var style_on_fun = style_on_funs[s]; + return style_on_fun(d); + }); + }); + }; + var style_on_funs = { + "opacity": get_alpha, + "stroke": get_colour, + "fill": get_fill, + "stroke-width": get_style_on_stroke_width, + "stroke-dasharray": get_dasharray + }; + var style_off_funs = { + "opacity": get_alpha_off, + "stroke": get_colour_off, + "fill": get_fill_off + }; + // TODO cleanup. + var select_style_default = ["opacity","stroke","fill"]; + g_info.select_style = select_style_default.filter( + X => g_info.style_list.includes(X)); + var over_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + return style_on_funs[s](d); + }); + }); + }; + var out_fun = function(e){ + g_info.select_style.forEach(function(s){ + e.style(s, function (d) { + var select_on = style_on_funs[s](d); + var select_off = style_off_funs[s](d); + if(has_clickSelects){ + return ifSelectedElse( + d.clickSelects, + g_info.aes.clickSelects, + select_on, select_off); + }else if(has_clickSelects_variable){ + return ifSelectedElse( + d["clickSelects.value"], + d["clickSelects.variable"], + select_on, select_off); + } + }); + }); + }; + elements = elements.data(data_to_bind, key_fun); + elements.exit().remove(); + var enter = elements.enter(); + if(g_info.aes.hasOwnProperty("href")){ + enter = enter.append("svg:a") + .append("svg:"+eAppend); + }else{ + enter = enter.append(eAppend) + .attr("class", "geom"); + } + var moreActions = function(e){}; + if (has_clickSelects || has_clickSelects_variable) { + moreActions = out_fun; + elements.call(out_fun) + .on("mouseover", function (d) { + d3.select(this).call(over_fun); + }) + .on("mouseout", function (d) { + d3.select(this).call(out_fun); + }) + ; + if(has_clickSelects){ + elements.on("click", function (d) { + var s_name = g_info.aes.clickSelects; + update_selector(s_name, d.clickSelects); + }); + }else{ + elements.on("click", function(d){ + var s_name = d["clickSelects.variable"]; + var s_value = d["clickSelects.value"]; + update_selector(s_name, s_value); + }); + } + } + // Set attributes of only the entering elements. This is needed to + // prevent things from flying around from the upper left when they + // enter the plot. + var doActions = function(e) { + eActions(e); + styleActions(e); + moreActions(e) + }; + doActions(enter); // DO NOT DELETE! + var has_tooltip = g_info.aes.hasOwnProperty("tooltip"); + if(has_clickSelects || has_tooltip || has_clickSelects_variable){ + var text_fun; + if(has_tooltip){ + text_fun = function(d){ + return d.tooltip; + }; + }else if(has_clickSelects){ + text_fun = function(d){ + var v_name = g_info.aes.clickSelects; + return v_name + " " + d.clickSelects; + }; + }else{ //clickSelects_variable + text_fun = function(d){ + return d["clickSelects.variable"] + " " + d["clickSelects.value"]; + }; + } + // if elements have an existing title, remove it. + elements.selectAll("title").remove(); + elements.append("svg:title") + .text(get_fun(text_fun)) + ; + } + if(Selectors.hasOwnProperty(selector_name)){ + var milliseconds = Selectors[selector_name].duration; + elements = elements.transition().duration(milliseconds); + } + if(g_info.aes.hasOwnProperty("id")){ + elements.attr("id", get_attr("id")); + } + if(g_info.aes.hasOwnProperty("href")){ + // elements are , children are e.g. + var linked_geoms = elements.select(eAppend); + doActions(linked_geoms); + elements.attr("xlink:href", get_attr("href")) + .attr("target", "_blank") + .attr("class", "geom"); + }else{ + // elements are e.g. + doActions(elements); // Set the attributes of all elements (enter/exit/stay) + } + }; + + var value_tostring = function(selected_values) { + //function that is helpful to change the format of the string + var selector_url="#" + for (var selc_var in selected_values){ + if(selected_values.hasOwnProperty(selc_var)){ + var values_str=selected_values[selc_var].join(); + var sub_url=selc_var.concat("=","{",values_str,"}"); + selector_url=selector_url.concat(sub_url); + } + } + var url_nohash=window.location.href.match(/(^[^#]*)/)[0]; + selector_url=url_nohash.concat(selector_url); + return selector_url; + }; + + var get_values=function(){ + // function that is useful to get the selected values + var selected_values={} + for(var s_name in Selectors){ + var s_info=Selectors[s_name]; + var initial_selections = []; + if(s_info.type==="single"){ + initial_selections=[s_info.selected]; + } + else{ + for(var i in s_info.selected) { + initial_selections[i] = s_info.selected[i]; + } + } + selected_values[s_name]=initial_selections; + } + return selected_values; + }; + + // update scales for the plots that have update_axes option in + // theme_animint + function update_scales(p_name, axes, v_name, value){ + // Get pre-computed domain + var axis_domains = Plots[p_name]["axis_domains"]; + if(!isArray(axes)){ + axes = [axes]; + } + if(axis_domains != null){ + axes.forEach(function(xyaxis){ + // For Each PANEL, update the axes + Plots[p_name].layout.PANEL.forEach(function(panel_i, i){ + // Determine whether this panel has a scale or not + // If not we just update the scales according to the common + // scale and skip the updating of axis + var draw_axes = Plots[p_name].layout["AXIS_"+ xyaxis.toUpperCase()][i]; + if(draw_axes){ + var use_panel = panel_i; + }else{ + var use_panel = Plots[p_name].layout.PANEL[0]; + } + // We update the current selection of the plot every time + // and use it to index the correct domain + var curr_select = axis_domains[xyaxis].curr_select; + if(axis_domains[xyaxis].selectors.indexOf(v_name) > -1){ + curr_select[v_name] = value; + var str = use_panel+"."; + for(selec in curr_select){ + str = str + curr_select[selec] + "_"; + } + str = str.substring(0, str.length - 1); // Strip off trailing underscore + var use_domain = axis_domains[xyaxis]["domains"][str]; + } + if(use_domain != null){ + Plots[p_name]["scales"][panel_i][xyaxis].domain(use_domain); + var scales = Plots[p_name]["scales"][panel_i][xyaxis]; + // major and minor grid lines as calculated in the compiler + var grid_vals = Plots[p_name]["axis_domains"][xyaxis]["grids"][str]; + + // Once scales are updated, update the axis ticks if needed + if(draw_axes){ + // Tick values are same as major grid lines + update_axes(p_name, xyaxis, panel_i, grid_vals[1]); + } + // Update major and minor grid lines + update_grids(p_name, xyaxis, panel_i, grid_vals, scales); + } + }); + }); + } + } + + // Update the axis ticks etc. once plot is zoomed in/out + // currently called from update_scales. + function update_axes(p_name, axes, panel_i, tick_vals){ + var orientation; + if(axes == "x"){ + orientation = "bottom"; + }else{ + orientation = "left"; + } + if(!isArray(tick_vals)){ + tick_vals = [tick_vals]; + } + var xyaxis = d3.svg.axis() + .scale(Plots[p_name]["scales"][panel_i][axes]) + .orient(orientation) + .tickValues(tick_vals); + // update existing axis + var xyaxis_g = element.select("#plot_"+p_name).select("."+axes+"axis_"+panel_i) + .transition() + .duration(1000) + .call(xyaxis); + } + + // Update major/minor grids once axes ticks have been updated + function update_grids(p_name, axes, panel_i, grid_vals, scales){ + // Select panel to update + var bgr = element.select("#plot_"+p_name).select(".bgr"+panel_i); + // Update major and minor grid lines + ["minor", "major"].forEach(function(grid_class, j){ + var lines = bgr.select(".grid_"+grid_class).select("."+axes); + var xy1, xy2; + if(axes == "x"){ + xy1 = lines.select("line").attr("y1"); + xy2 = lines.select("line").attr("y2"); + }else{ + xy1 = lines.select("line").attr("x1"); + xy2 = lines.select("line").attr("x2"); + } + + // Get default values for grid lines like colour, stroke etc. + var grid_background = Plots[p_name]["grid_"+grid_class]; + var col = grid_background.colour; + var lt = grid_background.linetype; + var size = grid_background.size; + var cap = grid_background.lineend; + + // Remove old lines + lines.selectAll("line") + .remove(); + + if(!isArray(grid_vals[j])){ + grid_vals[j] = [grid_vals[j]]; + } + + if(axes == "x"){ + lines.selectAll("line") + .data(grid_vals[j]) + .enter() + .append("line") + .attr("y1", xy1) + .attr("y2", xy2) + .attr("x1", function(d) { return scales(d); }) + .attr("x2", function(d) { return scales(d); }) + .style("stroke", col) + .style("stroke-linecap", cap) + .style("stroke-width", size) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(lt, size); + }); + }else{ + lines.selectAll("line") + .data(grid_vals[j]) + .enter() + .append("line") + .attr("x1", xy1) + .attr("x2", xy2) + .attr("y1", function(d) { return scales(d); }) + .attr("y2", function(d) { return scales(d); }) + .style("stroke", col) + .style("stroke-linecap", cap) + .style("stroke-width", size) + .style("stroke-dasharray", function() { + return linetypesize2dasharray(lt, size); + }); + } + }); + } + + var update_selector = function (v_name, value) { + if(!Selectors.hasOwnProperty(v_name)){ + return; + } + value = value + ""; + var s_info = Selectors[v_name]; + if(s_info.type == "single"){ + // value is the new selection. + s_info.selected = value; + }else{ + // value should be added or removed from the selection. + var i_value = s_info.selected.indexOf(value); + if(i_value == -1){ + // not found, add to selection. + s_info.selected.push(value); + }else{ + // found, remove from selection. + s_info.selected.splice(i_value, 1); + } + } + // update_selector_url() + // if there are levels, then there is a selectize widget which + // should be updated. + if(isArray(s_info.levels)){ + // the jquery ids + if(s_info.type == "single") { + var selected_ids = v_name.concat("___", value); + } else { + var selected_ids = []; + for(i in s_info.selected) { + selected_ids[i] = v_name.concat("___", s_info.selected[i]); + } + } + // from + // https://github.com/brianreavis/selectize.js/blob/master/docs/api.md: + // setValue(value, silent) If "silent" is truthy, no change + // event will be fired on the original input. + selectized_array[v_name].setValue(selected_ids, true); + } + + // For each updated geom, check if the axes of the plot need to be + // updated and update them + s_info.update.forEach(function(g_name){ + var plot_name = g_name.split("_").pop(); + var axes = Plots[plot_name]["options"]["update_axes"]; + if(axes != null){ + update_scales(plot_name, axes, v_name, value); + } + }); + + update_legend_opacity(v_name); + s_info.update.forEach(function(g_name){ + update_geom(g_name, v_name); + }); + }; + + var ifSelectedElse = function (s_value, s_name, selected, not_selected) { + var is_selected; + var s_info = Selectors[s_name]; + if(s_info.type == "single"){ + is_selected = s_value == s_info.selected; + }else{ + is_selected = s_info.selected.indexOf(s_value) != -1; + } + if(is_selected){ + return selected; + } else { + return not_selected; + } + }; + + function update_next_animation(){ + var values = d3.values(Animation.done_geoms); + if(d3.sum(values) == values.length){ + // If the values in done_geoms are all 1, then we have loaded + // all of the animation-related chunks, and we can start + // playing the animation. + var v_name = Animation.variable; + var cur = Selectors[v_name].selected; + var next = Animation.next[cur]; + update_selector(v_name, next); + } + } + + // The main idea of how legends work: + + // 1. In getLegend in animint.R I export the legend entries as a + // list of rows that can be used in a data() bind in D3. + + // 2. Here in add_legend I create a for every legend, and + // then I bind the legend entries to ,
, and elements. + var add_legend = function(p_name, p_info){ + // case of multiple legends, d3 reads legend structure in as an array + var tdRight = element.select("td."+p_name+"_legend"); + var legendkeys = d3.keys(p_info.legend); + for(var i=0; i-1){ + // aesthetics that would draw a rect + legend_svgs.append("rect") + .attr("x", 2) + .attr("y", 2) + .attr("width", 10) + .attr("height", 10) + .style("stroke-width", function(d){return d["polygonsize"]||1;}) + .style("stroke-dasharray", function(d){ + return linetypesize2dasharray(d["polygonlinetype"], d["size"]||2); + }) + .style("stroke", function(d){return d["polygoncolour"] || "#000000";}) + .style("fill", function(d){return d["polygonfill"] || "#FFFFFF";}) + .style("opacity", function(d){return d["polygonalpha"]||1;}); + } + if(l_info.geoms.indexOf("text")>-1){ + // aesthetics that would draw a rect + legend_svgs.append("text") + .attr("x", 10) + .attr("y", 14) + .style("fill", function(d){return d["textcolour"]||1;}) + .style("text-anchor", "middle") + .attr("font-size", function(d){return d["textsize"]||1;}) + .text("a"); + } + if(l_info.geoms.indexOf("path")>-1){ + // aesthetics that would draw a line + legend_svgs.append("line") + .attr("x1", 1).attr("x2", 19).attr("y1", 7).attr("y2", 7) + .style("stroke-width", function(d){ + return linescale(d["pathsize"])||2; + }) + .style("stroke-dasharray", function(d){ + return linetypesize2dasharray(d["pathlinetype"], d["pathsize"] || 2); + }) + .style("stroke", function(d){return d["pathcolour"] || "#000000";}) + .style("opacity", function(d){return d["pathalpha"]||1;}); + } + if(l_info.geoms.indexOf("point")>-1){ + // aesthetics that would draw a point + legend_svgs.append("circle") + .attr("cx", 10) + .attr("cy", 7) + .attr("r", function(d){return pointscale(d["pointsize"])||4;}) + .style("stroke", function(d){return d["pointcolour"] || "#000000";}) + .style("fill", function(d){ + return d["pointfill"] || d["pointcolour"] || "#000000"; + }) + .style("opacity", function(d){return d["pointalpha"]||1;}); + } + legend_rows.append("td") + .attr("align", "left") // TODO: right for numbers? + .attr("class", "legend_entry_label") + .attr("id", function(d){ return d["id"]+"_label"; }) + .style("font-size", function(d){ return d["text_size"]}) + .text(function(d){ return d["label"];}); + } + } + + // Download the main description of the interactive plot. + d3.json(json_file, function (error, response) { + if(response.hasOwnProperty("title")){ + // This selects the title of the web page, outside of wherever + // the animint is defined, usually a
-- so it is OK to use + // global d3.select here. + d3.select("title").text(response.title); + } + // Add plots. + for (var p_name in response.plots) { + add_plot(p_name, response.plots[p_name]); + add_legend(p_name, response.plots[p_name]); + // Append style sheet to document head. + css.appendChild(document.createTextNode(styles.join(" "))); + document.head.appendChild(css); + } + // Then add selectors and start downloading the first data subset. + for (var s_name in response.selectors) { + add_selector(s_name, response.selectors[s_name]); + } + + // Update the scales/axes of the plots if needed + // We do this so that the plots zoom in initially after loading + for (var p_name in response.plots) { + if(response.plots[p_name].axis_domains !== null){ + for(var xy in response.plots[p_name].axis_domains){ + var selectors = response.plots[p_name].axis_domains[xy].selectors; + if(!isArray(selectors)){ + selectors = [selectors]; + } + update_scales(p_name, xy, selectors[0], + response.selectors[selectors[0]].selected); + } + } + } + + //////////////////////////////////////////// + // Widgets at bottom of page + //////////////////////////////////////////// + if(response.hasOwnProperty("source")){ + widget_td.append("a") + .attr("class","a_source_href") + .attr("href", response.source) + .text("source"); + } + // loading table. + var show_hide_table = widget_td.append("button") + .text("Show download status table"); + show_hide_table + .on("click", function(){ + if(this.textContent == "Show download status table"){ + loading.style("display", ""); + show_hide_table.text("Hide download status table"); + }else{ + loading.style("display", "none"); + show_hide_table.text("Show download status table"); + } + }); + var loading = widget_td.append("table") + .style("display", "none"); + Widgets["loading"] = loading; + var tr = loading.append("tr"); + tr.append("th").text("geom"); + tr.append("th").attr("class", "chunk").text("selected chunk"); + tr.append("th").attr("class", "downloaded").text("downloaded"); + tr.append("th").attr("class", "total").text("total"); + tr.append("th").attr("class", "status").text("status"); + + // Add geoms and construct nest operators. + for (var g_name in response.geoms) { + add_geom(g_name, response.geoms[g_name]); + } + + // Animation control widgets. + var show_message = "Show animation controls"; + // add a button to view the animation widgets + var show_hide_animation_controls = widget_td.append("button") + .text(show_message) + .attr("id", viz_id + "_show_hide_animation_controls") + .on("click", function(){ + if(this.textContent == show_message){ + time_table.style("display", ""); + show_hide_animation_controls.text("Hide animation controls"); + }else{ + time_table.style("display", "none"); + show_hide_animation_controls.text(show_message); + } + }) + ; + // table of the animint widgets + var time_table = widget_td.append("table") + .style("display", "none"); + var first_tr = time_table.append("tr"); + var first_th = first_tr.append("th"); + // if there's a time variable, add a button to pause the animint + if(response.time){ + Animation.next = {}; + Animation.ms = response.time.ms; + Animation.variable = response.time.variable; + Animation.sequence = response.time.sequence; + Widgets["play_pause"] = first_th.append("button") + .text("Play") + .attr("id", "play_pause") + .on("click", function(){ + if(this.textContent == "Play"){ + Animation.play(); + }else{ + Animation.pause(false); + } + }) + ; + } + first_tr.append("th").text("milliseconds"); + if(response.time){ + var second_tr = time_table.append("tr"); + second_tr.append("td").text("updates"); + second_tr.append("td").append("input") + .attr("id", "updates_ms") + .attr("type", "text") + .attr("value", Animation.ms) + .on("change", function(){ + Animation.pause(false); + Animation.ms = this.value; + Animation.play(); + }) + ; + } + for(s_name in Selectors){ + var s_info = Selectors[s_name]; + if(!s_info.hasOwnProperty("duration")){ + s_info.duration = 0; + } + } + var selector_array = d3.keys(Selectors); + var duration_rows = time_table.selectAll("tr.duration") + .data(selector_array) + .enter() + .append("tr"); + duration_rows + .append("td") + .text(function(s_name){return s_name;}); + var duration_tds = duration_rows.append("td"); + var duration_inputs = duration_tds + .append("input") + .attr("id", function(s_name){ + return viz_id + "_duration_ms_" + s_name; + }) + .attr("type", "text") + .on("change", function(s_name){ + Selectors[s_name].duration = this.value; + }) + .attr("value", function(s_name){ + return Selectors[s_name].duration; + }); + // selector widgets + var toggle_message = "Show selection menus"; + var show_or_hide_fun = function(){ + if(this.textContent == toggle_message){ + selector_table.style("display", ""); + show_hide_selector_widgets.text("Hide selection menus"); + d3.select(".urltable").style("display","") + }else{ + selector_table.style("display", "none"); + show_hide_selector_widgets.text(toggle_message); + d3.select(".urltable").style("display","none") + } + } + var show_hide_selector_widgets = widget_td.append("button") + .text(toggle_message) + .attr("class", "show_hide_selector_widgets") + .on("click", show_or_hide_fun) + ; + // adding a table for selector widgets + var selector_table = widget_td.append("table") + .style("display", "none") + .attr("class", "table_selector_widgets") + ; + var selector_first_tr = selector_table.append("tr"); + selector_first_tr + .append("th") + .text("Variable") + ; + selector_first_tr + .append("th") + .text("Selected value(s)") + ; + + // looping through and adding a row for each selector + for(s_name in Selectors) { + var s_info = Selectors[s_name]; + // for .variable .value selectors, levels is undefined and we do + // not want to make a selectize widget. + + // TODO: why does it take so long to initialize the selectize + // widget when there are many (>1000) values? + if(isArray(s_info.levels)){ + // If there were no geoms that specified clickSelects for this + // selector, then there is no way to select it other than the + // selectize widgets (and possibly legends). So in this case + // we show the selectize widgets by default. + var selector_widgets_hidden = + show_hide_selector_widgets.text() == toggle_message; + var has_no_clickSelects = + !Selectors[s_name].hasOwnProperty("clickSelects") + var has_no_legend = + !Selectors[s_name].hasOwnProperty("legend") + if(selector_widgets_hidden && has_no_clickSelects && has_no_legend){ + var node = show_hide_selector_widgets.node(); + show_or_hide_fun.apply(node); + } + // removing "." from name so it can be used in ids + var s_name_id = legend_class_name(s_name); + + // adding a row for each selector + var selector_widget_row = selector_table + .append("tr") + .attr("class", function() { return s_name_id + "_selector_widget"; }) + ; + selector_widget_row.append("td").text(s_name); + // adding the selector + var selector_widget_select = selector_widget_row + .append("td") + .append("select") + .attr("class", function() { return s_name_id + "_input"; }) + .attr("placeholder", function() { return "Toggle " + s_name; }); + // adding an option for each level of the variable + selector_widget_select.selectAll("option") + .data(s_info.levels) + .enter() + .append("option") + .attr("value", function(d) { return d; }) + .text(function(d) { return d; }); + // making sure that the first option is blank + selector_widget_select + .insert("option") + .attr("value", "") + .text(function() { return "Toggle " + s_name; }); + + // calling selectize + var selectize_selector = to_select + ' .' + s_name_id + "_input"; + if(s_info.type == "single") { + // setting up array of selector and options + var selector_values = []; + for(i in s_info.levels) { + selector_values[i] = { + id: s_name.concat("___", s_info.levels[i]), + text: s_info.levels[i] + }; + } + // the id of the first selector + var selected_id = s_name.concat("___", s_info.selected); + + // if single selection, only allow one item + var $temp = $(selectize_selector) + .selectize({ + create: false, + valueField: 'id', + labelField: 'text', + searchField: ['text'], + options: selector_values, + items: [selected_id], + maxItems: 1, + allowEmptyOption: true, + onChange: function(value) { + // extracting the name and the level to update + var selector_name = value.split("___")[0]; + var selected_level = value.split("___")[1]; + // updating the selector + update_selector(selector_name, selected_level); + } + }) + ; + } else { // multiple selection: + // setting up array of selector and options + var selector_values = []; + if(typeof s_info.levels == "object") { + for(i in s_info.levels) { + selector_values[i] = { + id: s_name.concat("___", s_info.levels[i]), + text: s_info.levels[i] + }; + } + } else { + selector_values[0] = { + id: s_name.concat("___", s_info.levels), + text: s_info.levels + }; + } + // setting up an array to contain the initally selected elements + var initial_selections = []; + for(i in s_info.selected) { + initial_selections[i] = s_name.concat("___", s_info.selected[i]); + } + + // construct the selectize + var $temp = $(selectize_selector) + .selectize({ + create: false, + valueField: 'id', + labelField: 'text', + searchField: ['text'], + options: selector_values, + items: initial_selections, + maxItems: s_info.levels.length, + allowEmptyOption: true, + onChange: function(value) { + // if nothing is selected, remove what is currently selected + if(value == null) { + // extracting the selector ids from the options + var the_ids = Object.keys($(this)[0].options); + // the name of the appropriate selector + var selector_name = the_ids[0].split("___")[0]; + // the previously selected elements + var old_selections = Selectors[selector_name].selected; + // updating the selector for each of the old selections + old_selections.forEach(function(element) { + update_selector(selector_name, element); + }); + } else { // value is not null: + // grabbing the name of the selector from the selected value + var selector_name = value[0].split("___")[0]; + // identifying the levels that should be selected + var specified_levels = []; + for(i in value) { + specified_levels[i] = value[i].split("___")[1]; + } + // the previously selected entries + old_selections = Selectors[selector_name].selected; + + // the levels that need to have selections turned on + specified_levels + .filter(function(n) { + return old_selections.indexOf(n) == -1; + }) + .forEach(function(element) { + update_selector(selector_name, element); + }) + ; + // the levels that need to be turned off + // - same approach + old_selections + .filter(function(n) { + return specified_levels.indexOf(n) == -1; + }) + .forEach(function(element) { + update_selector(selector_name, element); + }) + ; + }//value==null + }//onChange + })//selectize + ; + }//single or multiple selection. + selectized_array[s_name] = $temp[0].selectize; + }//levels, is.variable.value + } // close for loop through selector widgets + // If this is an animation, then start downloading all the rest of + // the data, and start the animation. + if (response.time) { + var i, prev, cur; + for (var i = 0; i < Animation.sequence.length; i++) { + if (i == 0) { + prev = Animation.sequence[Animation.sequence.length-1]; + } else { + prev = Animation.sequence[i - 1]; + } + cur = Animation.sequence[i]; + Animation.next[prev] = cur; + } + Animation.timer = null; + Animation.play = function(){ + if(Animation.timer == null){ // only play if not already playing. + // as shown on http://bl.ocks.org/mbostock/3808234 + Animation.timer = setInterval(update_next_animation, Animation.ms); + Widgets["play_pause"].text("Pause"); + } + }; + Animation.play_after_visible = false; + Animation.pause = function(play_after_visible){ + Animation.play_after_visible = play_after_visible; + clearInterval(Animation.timer); + Animation.timer = null; + Widgets["play_pause"].text("Play"); + }; + var s_info = Selectors[Animation.variable]; + Animation.done_geoms = {}; + s_info.update.forEach(function(g_name){ + var g_info = Geoms[g_name]; + if(g_info.chunk_order.length == 1 && + g_info.chunk_order[0] == Animation.variable){ + g_info.seq_i = Animation.sequence.indexOf(s_info.selected); + g_info.seq_count = 0; + Animation.done_geoms[g_name] = 0; + download_next(g_name); + } + }); + Animation.play(); + all_geom_names = d3.keys(response.geoms); + + // This code starts/stops the animation timer when the page is + // hidden, inspired by + // http://stackoverflow.com/questions/1060008 + function onchange (evt) { + if(document.visibilityState == "visible"){ + if(Animation.play_after_visible){ + Animation.play(); + } + }else{ + if(Widgets["play_pause"].text() == "Pause"){ + Animation.pause(true); + } + } + }; + document.addEventListener("visibilitychange", onchange); + } + // update_selector_url() + var check_func=function(){ + var status_array = $('.status').map(function(){ + return $.trim($(this).text()); + }).get(); + status_array=status_array.slice(1) + return status_array.every(function(elem){ return elem === "displayed"}); + } + if(window.location.hash) { + var fragment=window.location.hash; + fragment=fragment.slice(1); + fragment=decodeURI(fragment) + var frag_array=fragment.split(/(.*?})/); + frag_array=frag_array.filter(function(x){ return x!=""}) + frag_array.forEach(function(selector_string){ + var selector_hash=selector_string.split("="); + var selector_nam=selector_hash[0]; + var selector_values=selector_hash[1]; + var re = /\{(.*?)\}/; + selector_values = re.exec(selector_values)[1]; + var array_values = selector_values.split(','); + if(Selectors.hasOwnProperty(selector_nam)){ + var s_info = Selectors[selector_nam] + if(s_info.type=="single"){//TODO fix + array_values.forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time)Animation.pause(true) + }); + }else{ + var old_selections = Selectors[selector_nam].selected; + // the levels that need to have selections turned on + array_values + .filter(function(n) { + return old_selections.indexOf(n) == -1; + }) + .forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time){ + Animation.pause(true) + } + }); + old_selections + .filter(function(n) { + return array_values.indexOf(n) == -1; + }) + .forEach(function(element) { + wait_until_then(100, check_func, update_selector,selector_nam,element) + if(response.time){ + Animation.pause(true) + } + }); + }//if(single) else multiple selection + }//if(Selectors.hasOwnProperty(selector_nam)) + })//frag_array.forEach + }//if(window.location.hash) + }); +}; + + diff --git a/docs/articles/showselectedassociations/geom1_point_associations_chunk1.tsv b/vignettes/showselectedassociations/geom1_point_plot1_chunk1.tsv similarity index 100% rename from docs/articles/showselectedassociations/geom1_point_associations_chunk1.tsv rename to vignettes/showselectedassociations/geom1_point_plot1_chunk1.tsv diff --git a/docs/articles/showselectedassociations/index.html b/vignettes/showselectedassociations/index.html similarity index 100% rename from docs/articles/showselectedassociations/index.html rename to vignettes/showselectedassociations/index.html diff --git a/docs/articles/showselectedassociations/plot.json b/vignettes/showselectedassociations/plot.json similarity index 96% rename from docs/articles/showselectedassociations/plot.json rename to vignettes/showselectedassociations/plot.json index dd03a8c81..3ae715a1d 100644 --- a/docs/articles/showselectedassociations/plot.json +++ b/vignettes/showselectedassociations/plot.json @@ -1,8 +1,8 @@ { "geoms": { - "geom1_point_associations": { + "geom1_point_plot1": { "geom": "point", -"classed": "geom1_point_associations", +"classed": "geom1_point_plot1", "aes": { "x": "Coolness", "y": "Cuteness", @@ -50,7 +50,7 @@ "selected": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "levels": [ "Clifford", "Junebug", "Muffin", "Teddy Bear", "Diana", "Bello", "Jellybean", "Archibald", "Saturday", "Wilbur" ], "update": [ - "geom1_point_associations" + "geom1_point_plot1" ] }, "Day": { @@ -60,12 +60,12 @@ "selected": "1", "levels": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" ], "update": [ - "geom1_point_associations" + "geom1_point_plot1" ] } }, "plots": { - "associations": { + "plot1": { "panel_margin_lines": 0.25, "legend": { "Cat": { @@ -310,7 +310,7 @@ "height": 400 }, "geoms": [ - "geom1_point_associations" + "geom1_point_plot1" ] } } diff --git a/docs/articles/showselectedassociations/scripts.html b/vignettes/showselectedassociations/scripts.html similarity index 100% rename from docs/articles/showselectedassociations/scripts.html rename to vignettes/showselectedassociations/scripts.html diff --git a/docs/articles/showselectedassociations/styles.css b/vignettes/showselectedassociations/styles.css similarity index 100% rename from docs/articles/showselectedassociations/styles.css rename to vignettes/showselectedassociations/styles.css diff --git a/docs/articles/showselectedassociations/vendor/d3.v3.js b/vignettes/showselectedassociations/vendor/d3.v3.js similarity index 100% rename from docs/articles/showselectedassociations/vendor/d3.v3.js rename to vignettes/showselectedassociations/vendor/d3.v3.js diff --git a/docs/articles/showselectedassociations/vendor/jquery-1.11.3.min.js b/vignettes/showselectedassociations/vendor/jquery-1.11.3.min.js similarity index 100% rename from docs/articles/showselectedassociations/vendor/jquery-1.11.3.min.js rename to vignettes/showselectedassociations/vendor/jquery-1.11.3.min.js diff --git a/docs/articles/showselectedassociations/vendor/selectize.css b/vignettes/showselectedassociations/vendor/selectize.css similarity index 100% rename from docs/articles/showselectedassociations/vendor/selectize.css rename to vignettes/showselectedassociations/vendor/selectize.css diff --git a/docs/articles/showselectedassociations/vendor/selectize.min.js b/vignettes/showselectedassociations/vendor/selectize.min.js similarity index 100% rename from docs/articles/showselectedassociations/vendor/selectize.min.js rename to vignettes/showselectedassociations/vendor/selectize.min.js