Categories
Mastering Development

Separate colour mappings in R plotly

I’ve got two layers of markers for which I’d like to use separate colour mappings. The problem is that the second add_marker inherits the palette from the first one. Is there anything like ggnewscale::new_scale_color() in native plotly? require(plotly) df = data.frame(x = runif(10), y = runif(10), m = runif(10), b = round(runif(10))) plot_ly(data = df, […]

Categories
Mastering Development

How to do 3D line plots grouped by two factors with the Plotly package in R?

I have checked up the official webpage of Plotly, but how to plot the following task still escapes me: id <- c(rep(1,5), rep(2,5), rep(3,5), rep(4,5)) t <- rep(seq(50,75,length.out=5), 4) x <- runif(20) + sin(t) y <- rnorm(20) + cos(t) gender <- c(rep(“F”,10), rep(“M”,10)) smoke <- c(rep(“Y”,5), rep(“N”,10), rep(“Y”,5)) DATA <- data.frame(ID, t, x, y, gender, […]

Categories
Mastering Development

r Plotly can’t get xaxis tickmode=”array” working for dates

I am trying to get xaxis tickmode=”array” working for dates for plotly graphs. Here is an example: x <- as.Date(c(“2016-08-12”, “2016-08-13”, “2016-08-14”, “2016-08-15”, “2016-08-16”)) y <- c(1, 2, 3, 4, 5) df <- data.frame(x,y) str(df) plot_ly(df, x = x, y = y) %>% layout(xaxis = list( tickmode = “array”, tickvals = c(as.numeric(as.POSIXct(“2016-08-12″, format=”%Y-%m-%d”))*1000, as.numeric(as.POSIXct(“2016-08-16″, format=”%Y-%m-%d”))*1000), […]

Categories
Ask Mathematics

Real Euclidean space axiom violation

Assume that we have 4 usual axioms for the inner product (denoted as $(x, y)$ for elements $x, y \in V$ and some scalar $c$) in the real Euclidean space $V$: $(x, y) = (y, x)$ $(x, y + z) = (x, y) + (x, z)$ $c(x, y) = (cx, y)$ $(x, x) > 0, […]

Categories
Ask Mathematics

using the necessary and sufficient conditions find the maxima and minima of $f(x)$?

Question: $f(X) = (x^3+y)^2+(-x+y-2)^4$, $X = (x,y)$ in $R^2$, my solution: take partial derivatives w.r.t $x$ and $y$ and equate them to zero giving $6x^2(x^3+y)-4(-x+y-2)^3=0$ and $2(x^3+y)+4(-x+y-2)^3=0$ respectively. then adding these gives $(6x^2+2)(x^3+y)=0$ after factorising, so $x^3=-y$, plugging this into the partial $y$ derivative of f gives us that $4(-x-x^3-2)^3=0$ and and so $(x+1)(x^2-x+2)=0$ giving […]

Categories
Ask Mathematics

Prove that the set {u_1, …,u_k,w_1,…,w_m} is a basis for V and formulate a conjecture that relates the dimensions of U,W,U∩W, and U+W.

U = {(x + y, x, y): x, y ∈ R} W = {(x, x, 0): x ∈ R Let V = U⊕W, and let {u1, u2, . . . , uk} be a basis for the subspace U and {w1, w2, . . . , wm} be a basis for the subspace W. Prove […]

Categories
Development

Getting the size of an UIView to programmatically add subviews (with calculated X, Y, width and height)

In a segue I have an UIVIew which have constraints that lays it out to the same size as the screen on the top, left and right as well as to a button on the bottom: Then from the ViewController I programmatically add UIButtons like this: override func viewDidLoad() { super.viewDidLoad() drawCards() } private func […]

Categories
Development

#MTASA Server Error: Attempt to index a nil value

I really don’t know what is wrong here. This is the error I am getting: s_interior_admin.lua:944: attempt to index local ‘interiors’ And here is my code: local interiors = exports[“official-interiors”].getInteriorsList() –/MAXIME interior = interiors[tonumber(interiorId)] if interior then local ix = interior[2] local iy = interior[3] local iz = interior[4] local optAngle = interior[5] local interiorw […]

Categories
Development Vue

Error Cannot tween a null target in Unit test with GSAP-TweenMax, Jest and VueJs

I have an error when trying to perform a unit test with Jest on a component in VueJs that has an animation made with TweenMax GSAP. The error is: Cannot tween a null target. in ztButton.spec.js jest.mock(‘gsap/TweenMax’) it(‘Component must to emit event on click’, () => { const wrapper = shallowMount(ztButton) const spy = sinon.spy() […]

Categories
Development

Plotting SMA regressions lines (smatr package) into ggplot

I would be very grateful for advise on how to plot Standardised Major Axis (SMA) regressions lines into a faceted ggplot. I used the following code: Run the SMA analysis and create a data frame with the SMA reg line coefficients (intercept and slope) I want to plot smaReg = sma(Y ~ X * Type, […]