wipo-analytics / handbook

The WIPO Patent Analytics Handbook (Work in Progress)

Home Page:https://wipo-analytics.github.io/handbook/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

section 11.6 r codes with plot_ly missing ~ before variable name for axes x and y and color

poledern opened this issue · comments

affected are for instance this two first code chunks:

library(plotly)
s <- plot_ly(pcy, x = pubyear, y = n, color = pubcountry, mode = "lines") %>%
layout(title = "Patenscope Pizza Patent Trends")
s
#my recoding workaround: s <- plot_ly(pcy, x = ~pubyear, y = ~n, color = ~pubcountry, mode = "lines") %>% layout(title = "Patenscope Pizza Patent Trends")

for mode lines I'm not sure but this workaround is enough to generate the plot as Feb 2020

idem for 2d chunk etc!

s1 <- plot_ly(pcy, x = pubyear, y = n, color = pubcountry, colors = "Paired", mode = "lines") %>%
layout(title = "Pizza Patent trends")

my work-around: s1 <- plot_ly(pcy, x = ~pubyear, y = ~n, color = ~pubcountry, colors = "Paired", mode = "lines") %>% layout(title = "Pizza Patent trends")

sorry I am beginner R & patents.. so hope this helps

Many thanks for this @poledern! I think this is now pretty ancient and that something somewhere probably changed... the entire piece probably merits some reworking. The suggested fixes are very welcome. Very many thanks and much appreciated!

Yes OK, let me add that I find that this is a nice guide that desserves updating indeed! the same missing ~ in total_bar <- plot_ly(total, x = ~pubcode , y = ~records, type = "bar") for fixes suggestions safe keeping!