I have a challenge solving the below issue. Request experts here to help me in this. Before I put the proper reprex. Let me explain the problem here,
df sd x y x1 y1 1 1 12 1019 0.3867382 1.3484106 2 2 20 1016 1.7618076 0.8860984 3 3 7 1006 -0.4726801 -0.6549423 4 4 3 1009 -1.1602147 -0.1926301
Well, I have to plot x and y here. But if you observe both there scales are different. So what I have done is I have normalized the data and came up with x1 and y1. Normalizing formula is
((x - mean(x)) / sd(x)
Now I need to plot x1 and y1. So have made some data wrangling and below is the reprex of that. I am getting the output. But the main issue here is that, since x1 and y1 are getting plotted, when i move the cursor over it shows x1 and y1 values. I do not need that. Even though x1 and y1 are plotted, I need to have actual values being shown there (x and y values). Is there a way to achieve this?
library(ggplot2) library(plotly) require(reshape) df <- structure(list(sd = c(1, 2, 3, 4), x = c(12, 20, 7, 3), y = c(1019, 1016, 1006, 1009), x1 = c(0.386738249968166, 1.76180758318831, -0.472680083294425, -1.1602147499045), y1 = c(1.34841060188091, 0.886098395521742, -0.654942292342157, -0.192630085982987)), row.names = c(NA, -4L), class = "data.frame") df$x <- NULL df$y <- NULL df1 <- melt(df,id=c("sd")) ggplotly(ggplot(data = df1,aes(x=sd,y=value,color=variable))+geom_line(size=0.2)