Change this code so it is suitable for my dataset

Hi guys,

I have a table called netsales . In this table i have 2 columns: CustomerCountryName and Netsales2022. I am curious if it is possible to adjust this code so it is suitable fro my df? I copied it from this webpage I specifically want to use rayshader visualization capabilities

mtcars_gg = ggplot(mtcars) + 
  geom_point(aes(x=mpg,color=cyl,y=disp),size=2) +
  scale_color_continuous(limits=c(0,8)) +
  ggtitle("mtcars: Displacement vs mpg vs # of cylinders") +
  theme(title = element_text(size=8),
        text = element_text(size=12)) 

plot_gg(mtcars_gg, height=3, width=3.5, multicore=TRUE, pointcontract = 0.7, soliddepth=-200)

No.

Does your data have three variables, each with a continuous numeric mapping? If the answer is “no”, then you shouldn’t use 3D. This is by far the biggest offender in poor use of 3D3.

(from the linked page)

The thing is, nobody uses R in my company anymore. I do not need to do it at all. But I want to keep R alive by presenting something new. So far I did a population density map and my colleagues liked it. Now I want to do a project related to our work so it is useful and not just fancy pop density viz. I want to keep R alive in my company:(

Is there another continuous variable you can add?

I also have netsales 2021 and netsales YoY columns.

That's something you can work with. The next step is imagining what you can see from adding a time dimension to the mix. The goal in visualization is always to reveal some aspect of the data that is difficult to infer just from the numbers.

You now have three (potentially five, using long/lat if you countries aren't too far flung) continuous variables and one categorical (country name) variable to work with. Take a look at the linked site (especially the North Carolina example). Think carefully about the range of data. If a few companies dominate sales that can overwhelm the smaller countries that may be showing interesting changes. Come back with a reprex if you need further help. See the FAQ: How to do a minimal reproducible example reprex for beginners

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.