tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.06k stars 214 forks source link

plot_gg could not find function "plot_gg" #45

Closed albz closed 5 years ago

albz commented 5 years ago

I fill rather silly to post this, but I cannot get where I am wrong. I am trying just to replicate the example here 'https://www.rayshader.com/reference/plot_gg.html'. The first one to be precise.

I get the following message: Error in plot_gg(ggdiamonds, multicore = TRUE, width = 5, height = 5, : could not find function "plot_gg"

I have no idea what's wrong!

tylermorganwall commented 5 years ago

The documentation has been updated, but that version of the package has yet to be released. It should be released shortly

chaoshengt commented 5 years ago

nice!

onurhdogan commented 5 years ago

Hello, I still get same error ("could not find function"), I have updated version and I could not understand

kunalbali commented 5 years ago

Today I installed rayshader library along with ggplot2, sf and viridis but still getting

could not find function "plot_gg"

any suggestion?

albz commented 5 years ago

that is bizarre, after the release it worked well and today I could also produce my first video. I would suggest to load in order the librarires?

kunalbali commented 5 years ago

I am using like

`remotes::install_github("tylermorganwall/rayshader") library(rayshader) library(ggplot2) library(sf) library(viridis) library(readr)

nc = st_read(system.file("fire_archive_M6_22030.shp", package="sf"), quiet = TRUE)

nc = read.table(file="test.txt", sep ="\t", header=T) head(nc,10) gg_nc = ggplot(nc) + geom_sf(aes(fill = FRP)) + scale_fill_viridis("FRP") + ggtitle("Area of counties in India") + theme_bw()

plot_gg(gg_nc, multicore = TRUE, width = 6 ,height=2.7, fov = 70) render_depth(focallength=100,focus=0.72) `

tylermorganwall commented 5 years ago

Try uninstalling the package and then reinstalling it from github.

kunalbali commented 5 years ago

Thanks it worked. Rplot01.pdf

But I couldn't create animate. I mean it's not moving like your plots. Also, the image is not very clear. I attached pdf, but if I saved in png then it's little shattered.

tylermorganwall commented 5 years ago

To animate, you can use the render_movie() function. To make the image higher resolution, try increasing the windowsize parameter in plot_gg() (e.g. plot_gg(gg_nc, multicore = TRUE, width = 6 ,height=2.7, fov = 70, windowsize=c(1000,1000)). To save an image, use the render_snapshot() function.

kunalbali commented 5 years ago

Thanks I could generate animate using render_movie() function. But not able to same this animate. Also, I am facing some errors.

plot_gg(new_filecreate, width = 4, height = 3, scale = 300, multicore = TRUE,, windowsize=c(1000,1000)) render_movie(new_filecreate , type = "orbit", frames = 30,fov = 40)

Error : Error in av::av_encode_video(png_files, output = filename, framerate = fps, : length(output) == 1 is not TRUE In addition: Warning message: In if (substring(filename, nchar(filename) - 3, nchar(filename)) != : the condition has length > 1 and only the first element will be used

tylermorganwall commented 5 years ago

What is new_filecreate? It looks like you are passing that to both plot_gg() and render_movie(), but those two functions take different arguments.

kunalbali commented 5 years ago

Here is the code

new_filecreate = ggplot(nc1, aes(x=LONGITUDE, y=LATITUDE, color=FRP)) + geom_hex(bins = 100, size = 0.1) + scale_fill_gradient(low="pink", high="red") + ggtitle("Fire Radiative Power") + theme_minimal()+ theme(legend.text=element_text(size=20)) + theme_bw() plot_gg(new_filecreate, width = 4, height = 3, scale = 300, multicore = TRUE,, windowsize=c(1000,1000)) render_movie(new_filecreate)

kunalbali commented 5 years ago

please ignore the previous query. I have sorted it out by using

render_movie("faithful_3d.mp4", frames = 80)