Rhea Ramtohul
Rhea Ramtohul

Reputation: 23

Prevent changing text to 3d visualisation using plot_gg

I am trying to visualise the following ggplot2 object in 3d using rayshader library.

Thanks! 2d viz 3d viz

However, I cannot find a way to prevent the text labels from becoming 3d, only the points. Is there a way to do this?

    plot_gg(plot_cities
            , width=4.0
            , height = 4.0
            , multicore = TRUE
            , windowsize = c(1400,866)
            , sunangle=225
            , zoom = 0.60
            , phi = 30
            , theta = 45
            ,emboss_text = 0
            )

Upvotes: 0

Views: 179

Answers (1)

Aaqib Gulzar
Aaqib Gulzar

Reputation: 71

Since the data you have plotted the base ggplot with isn't mentioned,i tried to do this with world cities dataset but for much smaller number of cities, just to try out and it worked fine. enter image description here

The base ggplot i formed :

library(maps)
wc2 = world.cities[1:10, ]
ggp = ggplot(data = wc2, mapping = 
 aes(x = long, y = lat, color = pop))  +
geom_point() +
scale_color_viridis_c() +
geom_text(
label = wc2$name,
nudge_x = 0.75,
nudge_y = 0.75,
check_overlap = T,
color = "black"
)


plot_gg(ggp)

Maybe you might need to mention the colour of the text names separately as a single colour so that it doesn't get 3d plotted. HOPE THAT HELPS

Upvotes: 1

Related Questions