Publications by Stéphane Laurent
Scrollbar for the Shiny sidebar
It is easy to have a scrollbar for the sidebar of a Shiny app: one just has to use the CSS height: 90vh; overflow-y: auto;: library(shiny) library(shinyWidgets) ui <- fluidPage( titlePanel("Sidebar with scrollbar"), sidebarLayout( sidebarPanel( style = "height: 90vh; overflow-y: auto;", sliderInput("bins", "...
908 sym R (1883 sym/2 pcs) 4 img
Beautiful complex functions
I’ve just submitted a new package to CRAN: jacobi. It allows to evaluate the Jacobi theta functions as well as some related functions. In particular, some Eisenstein series, that you will see below. To represent a complex function, a color map is needed, that is to say a function which maps each ...
1000 sym R (1308 sym/3 pcs) 4 img
On a Möbius transformation
Consider a complex number \(\gamma\) such that \(|\gamma| < 1\) and the following matrix: \[ M = \begin{pmatrix} i & \gamma \\ \bar\gamma & -i \end{pmatrix}. \] Then the Möbius transformation associated to this matrix is nice. Why? Because: it maps the unit disk to itself; it i...
3238 sym R (1916 sym/4 pcs) 4 img
Mapping a picture on a donut or a Hopf torus
The donut torus Given a number \(s \geqslant 1\), the following map: \[ (u, v) \mapsto (x, y, z) = \frac{\Bigl(s\cos\frac{u}{s}, s\sin\frac{u}{s}, \sin v\Bigr)}{\sqrt{s^2+1}-\cos v} \] is a conformal parameterization of the torus (the donut), where \(-s\pi \leqslant u < s\pi\) and \(\pi \...
2118 sym R (4286 sym/5 pcs) 8 img
Pretty tooltips for ‘ggplot2’
Below is a simple example of a ‘ggplot2’ graphic with tooltips in a Shiny application. The tooltips are constructed with the help of the qTip2 JavaScript library. library(shiny) library(ggplot2) library(shinyjs) set.seed(666) dat <- data.frame( x = rnorm(10), y = rnorm(10), f = gl(2, 5, labels = c("A", "B")) ) ...
824 sym R (9295 sym/3 pcs) 6 img
Search in a ‘DT’ table w/ or w/o a regular expression
It is possible to search in a ‘DT’ table with a regular expression: datatable( data = dat, options = list( search = list(regex = TRUE) ) ) But it could be desirable to have the possibility to search either with a regular expression or with an ordinary string. The SearchBuilder extension allows to search in...
1026 sym R (1629 sym/3 pcs) 4 img
Slices of an implicit hypersurface with R
In a previous post, I showed how to draw a 3D slice of a 4D hypersurface when a parameterization of this hypersurface is available. Here we deal with the case when an implicit equation of the hypersurface is available. For the illustration, we again consider the tiger. It is given by the implicit eq...
2071 sym R (2380 sym/4 pcs) 4 img
Expanding a polynomial with ‘caracas’, part 2
Last month, I posted an article showing a way to expand a polynomial in R when the coefficients of the polynomial contain some literal values, with the help of the caracas package. Today I wanted to apply it with a polynomial expression having about 500 characters, and highly factorized. The...
1737 sym R (2374 sym/2 pcs) 2 img
The E8 root polytope
The E8 root polytope, its vertices and its edges The E8 root polytope, also known as the \(4_{21}\) polytope is a 8-dimensional polytope. The Cartesian coordinates of its vertices are described in the above linked Wikipedia page. It has 240 vertices, that can be separated in two sets. The first set...
6873 sym R (4931 sym/15 pcs) 8 img
Copy ‘plotly’ image to the clipboard
The R code below shows how to get a “Copy to clipboard” button in the plotly toolbar. library(plotly) set.seed(666L) asd <- data.frame( week = c(1, 2, 3, 4, 5, 6, 7, 8), a = rpois(8L, 30), b = rpois(8L, 25) ) js <- c( 'function(gd) {', ' Plotly.Snapshot.toImage(gd, {format: "png"}).once(', ' "success...
518 sym R (3290 sym/1 pcs) 2 img