Skip to content

R: Latin1 encoding errors when exporting with orca #224

Open
@ghost

Description

Hi,

Thanks, I use the R plotly library.

Here is an example:

ex  <- data.frame(region = c("Pará", "Pará", "Pará", "Pará", "Pará", "Region2", "Region2", "Region2", "Region2", "Region2", "Region3", "Region3", "Region3", "Region3", "Region3"),
                  country = c("Brazil", "Brazil", "Brazil", "Brazil", "Brazil", "Country2", "Country2", "Country2", "Country2", "Country2", "Country3", "Country3", "Country3", "Country3", "Country3"),
                  var = c("VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1", "VAR1"),
                  value = c(2,5,7,5,4,3,9,5,7,5,3,7,6,9,3))
p <- plot_ly(ex) %>%
  add_trace(x = ~region, y = ~value,
            color = ~country, fillcolor = ~country, opacity = 1.0,
            type = 'box', boxpoints = "all", jitter = 0.0,
            pointpos = 0, line = list(width = 1),
            marker = list(color = '#000000', opacity = .8, size = 2),
            orientation = "v", showlegend = T) %>%
  layout(xaxis = list(title = 'Region', tickangle = 270, zeroline = FALSE,
                      categoryorder = "array",
                      categoryarray = c(unique(ex$country))),
         yaxis = list(title = 'Value', zeroline = FALSE),
         boxmode = "group", boxgap = 0.05, boxgroupgap = 0.3,
         legend = list(bgcolor = 'transparent'))
p
plotly_IMAGE(p, width = 600, height = 400, format = "png", scale = 1, dpi = 600,
             out_file = paste0("D:/Ex01a.png"))
setwd(paste0("D:/"))
orca(p, file = paste0("Ex01b.png"),
     width = 600, height = 400, format = "png", scale = 1)

The plotly'IMAGE command results in:
Ex01a

While the orca command results in (note the á in the Pará label):
Ex01b

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions