So I've been trying for a while now to successfully plot a custom 2D Latitude x Longitude map from a GAM I created (with package mgcv). However, I am encountering a problem. After I enter the following command:
myvis.gam(llgam, view = c("lat","long"), n.grid = 100,
plot.type = "contour", color = "jet", contour.col = "",
too.far = .05)
I receive the following error:
Error in myvis.gam(llgam, view = c("lat", "long"), n.grid = 100, plot.type = "contour", :
object 'v' not found
The reason for my confusion from this error is that there is no "v" object present in the script. I've never seen this before. Usually, if it states that object "x" is not found, object "x" is used in the script entered prior.
Any ideas? (What does it mean when it gives an error for an object that is not shown in the entered script?)
NOTE: The "myvis.gam" function is custom-made. It is essentially an edited version of the "vis.gam" script (package mgcv) and follows the same "usage" base:
vis.gam(x,view = NULL, cond = list(), n.grid = 30, too.far = 0, col = NA,
color = "heat", contour.col = NULL, se = -1, type = "link",
plot.type = "persp", zlim = NULL, nCol = 50, ...)
It also uses the same arguments.
If anyone wants the full code for this function, I am happy to give it. It's just lengthy.
Any help is greatly appreciated! :)
Related
For 3D visualizaiton used matrix data. Package: Rayshader 0.34.0.
The data is can be seen in render_camera but using high_quality function facing problem in saving rendeeing out put.
Error in rayrender::obj_model(cache_filename, x = -bbox_center[1], y = -bbox_center[2], :
unused argument (texture = TRUE)
I was expecting a render image so that my 3d map can be saved in png format with rendering quality.
mat |>
height_shade(texture = textr) |>
plot_3d(heightmap = mat,
zscale = 1000,
solid = FALSE,
shadowdepth = 0)
render_camera(theta = -100, phi = 30, zoom = .7)
render_highquality("E:/URP/R/3D Bangladesh/DATA/Images/tp.png",
samples = 450,
preview = FALSE,
light = TRUE,
lightdirection = c(135, 45),
lightcolor = c("white"),
lightintensity = c(800),
ambient_light = 0.5,
shadow_intensity = 0.5,
zscale = 1,
width = 8000, height = 8000,
interactive = FALSE)
Install most recent dev versions of rayshader and rayrender.
remotes::install_github("https://github.com/tylermorganwall/rayshader")
remotes::install_github("https://github.com/tylermorganwall/rayrender")
Same issue.
I've tried to install the most recent dev versions but probably I do something wrong.
What do I have to choose here (and later similarly for rayrender)?
terminal options
If I choose "All" at every steps I get some conflicts
Hello everyone I had issue when run this :
aus_garch_roll_05 = ugarchroll(egarch_spec, data = data_new$Australia, n.ahead = 1, n.start = 2229,refit.window = "moving", refit.every = 10, calculate.VaR = TRUE, VaR.alpha = c(0.05))
report(aus_garch_roll_05, type = "VaR")
Everything is fine with alpha = 1%, when I change the alpha to 5% or 10%, the code return me:
Error:
plot-->error: VaR.alpha chosen is invalid for the object
How can I solve this?
Thanks
Well I forget to carefully read the this topic on R
We need to specify the alpha when print the report
report(aus_garch_roll_05, type = "VaR", VaR.alpha = 0.05)
I am trying to automate code for making pheatmap color annotations.
So that I do not have to personally annotate each sub sample.
However, I can't figure out how to convert the string from a factor/ object name.
Is this possible?
I just receive an equal error, which I assume means I am equating a string to a string.
annotation_colors = list(
Samples = c(Disease1 ="#0067f7", Disease2 = '#00fad5'),
Vector = c(Pathology1="#3c00ff", Control = '#00b3a7'))
annotation_colors = list(
Samples = c(as.factor(unique(data$Samples[1])) = "#0067f7",
as.factor(unique(data$Samples[2])) = '#00fad5')
Error in parse(text = x, srcfile = src): <text>:2:58: unexpected '='
1: annotation_colors = list(
2: Samples = c(as.factor(unique(data$Samples[1])) =
answer derived from akrun advice:
annotation_colors = list(
Samples = c( setNames(c("#0067f7", '#00fad5'), unique(meta2$Samples))),
Infection = c(setNames(c("#3c00ff", '#00b3a7'), unique(meta2$Infection))))
I am trying to run a line of code from a manual but each time I get this error Error in symbols(x = coords[, 1], y = coords[, 2], bg = vertex.color, : invalid symbol coordinates
Now, this is my code
LGHomDf_P1 <- bridgeHomologues(pseudohom_stack = P1_homologues_5,
linkage_df = SN_DN_P1,
LOD_threshold = 5,
automatic_clustering = TRUE,
LG_number = 7,
parentname = "P1",
log = "Logfile_tetra.Rmd")
I have been reading some post on the forum but I could not find any information.
Moreover, I do not think I have to use igraph because it is not mentioned at all in the manual.
Moreover the package that I am using is called PolyMappeR.
I have a question about the par function in R.
I want to change the color and/or width of a line in a graph with par function. (I am using par function because the gaps.plot command below does not allow "col" option to be included. The gaps.plot command is used after the synth command).
So, I used the following command. But I noticed that the lines of the BOX are changed rather than the lines of the GRAPHS.
synth1<-read.csv(file="C:\\Users\\Research\\R\\synthinR_v4.csv",header=TRUE)
attach(synth1)
library("Synth")
dataprep.out34 <- dataprep(foo = synth1, predictors = c("lncdsales", "md1", "md2","md3", "md4", "md5", "md6", "md7", "md8", "md9", "md10", "md11", "yd1", "yd2", "yd3", "yd4", "yd5", "yd6", "yd7", "yd8"), predictors.op = "mean", time.predictors.prior = -13:1, dependent = "lndigital", unit.variable = "artistalbumcode", time.variable = "release", treatment.identifier = 34, controls.identifier = c(1:33, 35:49), time.optimize.ssr = -13:1, time.plot = -13:25)
synth.out34 <- synth(data.prep.obj = dataprep.out34, method = "BFGS")
par(lwd = 2, col="#cccccc")
gaps.plot(synth.res = synth.out34, dataprep.res = dataprep.out34, Ylab = " Log Digital Sales ", Xlab = "Release", Ylim = c(-7, 7) , Main = NA)
Does anyone know how to fix this problem??
Thank you in advance for your willingness to help. I greatly appreciate it!
The col argument to par sets the default plotting colour (i.e. when col is not explicitly specified in plotting calls), but unfortunately col = "black" is hard-coded into the source of gaps.plot.
You can make a modified copy of the function by either (1) viewing the source (F2 in RStudio, or just executing gaps.plot), editing it and assigning it to a new object, or (2) doing something like the following:
gaps.plot2 <- eval(parse(text=gsub('col = "black"', 'col = "red"',
deparse(Synth:::gaps.plot))))
and then using gaps.plot2 as you would use gaps.plot:
gaps.plot2(synth.res = synth.out34, dataprep.res = dataprep.out34,
Ylab = " Log Digital Sales ", Xlab = "Release", Ylim = c(-7, 7) ,
Main = NA)
Alter the lwd similarly. For example to make lines red and have width of 3, use nested gsub calls like this:
gaps.plot2 <- eval(parse(text=gsub('lwd = 2', 'lwd = 3',
gsub('col = "black"', 'col = "red"',
deparse(Synth:::gaps.plot)))))