global option for gganimate renderer (no loop) - r

I would like to stablish global options to a bunch of animations rendered using gganimate. The most important part is no-loop option but ...can not add to list of parameters this way. Every other option worked.
options(gganimate.dev_args = list(width = 14,
height = 7,
units = 'in',
res = 200,
renderer = gifski_renderer(loop = F)))
Error in device(files[i], ...) :
unused argument (renderer = function (frames, fps)

Related

Rayshader package error for Plotting and Saving 2D and 3D Visualizations in R studio

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

How to define printing whole graph in ggplot2?

I am using a package called microbiomeMarker to plot a cladogram (ggtree). It was taking too long to print so I implemented the Cairo package so that the printing is faster (there's a considerable change thankfully.
cladogram<-plot_cladogram(
OTU_lefse_res,
color = c("#7570B3","#D95F02"),
only_marker = TRUE,
branch_size = 0.2, #beyond this point everything is default values
alpha = 0.2,
node_size_scale = 1,
node_size_offset = 1,
clade_label_level = 4,
clade_label_font_size = 4,
annotation_shape = 22,
annotation_shape_size = 5,
group_legend_param = list(),
marker_legend_param = list()
)
ggsave(
filename = "16S_Marker_Cladogram.png",
units = "px",
dpi = 300,
type = "cairo-png"
)
My issue is that when it gets saved, the graph is zoomed in (as far as I can figure to the bottom right corner of the legend) so I can't see the cladogram. I've also tried saving it as a pdf, changing the dpi to 900, defining the size by pixels, setting in the ggplot "coord_fixed()"... I'm at a loss, I googled the issue but I can't find anyone having a similar issue. The example data of the package works fine. I've got about 10x the amount of data to be plotted, so I expect some delay, but I don't understand why I can't get it right.
If I don't set a printing device and just do:
plot_cladogram(
OTU_lefse_res,
color = c("#7570B3","#D95F02"),
only_marker = TRUE,
branch_size = 0.2,
alpha = 0.2,
node_size_scale = 1,
node_size_offset = 1,
clade_label_level = 4,
clade_label_font_size = 4,
annotation_shape = 22,
annotation_shape_size = 5,
group_legend_param = list(),
marker_legend_param = list()
)
I don't get any output in the plot window. Any ideas of something else I can try?

How to use a newline in node label - forceNetwork R Shiny

I am trying to include the ability to have newlines in a node label, otherwise they extend out pretty far and just look messy in my R Shiny application. How can I do this? I have tried including the html break character and newline character but neither has worked. My network is created using the following code
forceNetwork(
Links = edges,
Nodes = nodes,
fontFamily = "Arial",
Nodesize = "size",
Source = "source_id",
Target = "target_id",
NodeID = "type_2",
Group = "type",
zoom = TRUE,
opacity = 1,
charge = -100,
linkColour = color_string_link,
opacityNoHover = ifelse(input$togglelabels == "labels",1,0),
colourScale = JS(color_string)
)

Change the color of the bibliometric map in Packages

I'm having trouble changing the color of the bibliometric map using R. I intend to change the color to black and white. But I don't know the syntax used for that.
The code structure I use to generate the map looks like this:
conceptualStructure(M, field = "ID", method = "MCA", quali.supp = NULL, quanti.supp = NULL, minDegree = 2, clust = "auto", k.max = 5, stemming = FALSE, labelsize = 10, documents = 2, graph = TRUE)
Please help me, what code can I use to change the color of the map, background and text in my project.
I have never used conceptualStructure before, nor know what package it comes from (assuming it isn't base R), but I think you should be able to make it black and white by just specifying as such in the theme. E.g.
conceptualStructure(M,
field = "ID",
method = "MCA",
quali.supp = NULL,
quanti.supp = NULL,
minDegree = 2,
clust = "auto",
k.max = 5,
stemming = FALSE,
labelsize = 10,
documents = 2,
graph = TRUE) + theme_bw()
That may just be a ggplot2 thing though. In which case, i'm not sure I can help

Write several statements into an anonymous function in R

I want to include a plot into some MS Word document using the reporteRs library.
Here is how I include my plot :
doc = addPlot(doc,
fun = function() plot(
km.as.one,
mark.time=TRUE,
conf.int=FALSE,
cex=1,
col="blue",
xlab = "Délai en années", ylab = "Pourcentage",
lty=1:3,
),
vector.graphic = TRUE, width = 5, height = 4,
par.properties = parProperties(text.align = "center")
)
My problem is that I would like to add some error bars, customize the axis and maybe add the title, by adding something like following :
axis(1, at = seq(0, 36, by = 6))
with (data=summary.km.as.one, expr=errbar(time, surv, upper, lower, add=TRUE, pch=0.5, cap=0.02))
I have to write this outside of the plot statement, but I couldn't find how to write it in the anonymous function.
Is it even possible to write several statements in an anonymous function ?
If yes, what is the right way, and if not, is there any workaround ?
Just add braces { } and you can add multiple lines:
doc = addPlot(doc,
fun = function() {
# line 1
# line 2
# etc...
},
vector.graphic = TRUE, width = 5, height = 4,
par.properties = parProperties(text.align = "center")
)

Resources