Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.9k views
in Technique[技术] by (71.8m points)

r - Centering annotate label dont work properly in docker image

I'm creating an image using ggplot2 and ggiraph to my API in plumber.

I am using RStudio on Windows.

When I create an local API (that plumber provides in Swagger) everything seems ok to me.

But, when i use my Docker File with the command docker compose build api and then docker compose up ap for an Ubuntu image, the center dont look well.

By center i mean the arg hjust = 0.5

Right below is a piece of my image.

enter image description here

Both annotate and geom_text() works locally in my RStudio, but when i use my docker image, the centering dont looks well.

The labels start in center, but when use more and more characters, the string start going to the left.

The code for geom_text and annotate:

      [...] +

      geom_text(data=data.frame(), 
                aes(label = 'aaaaaaaaaaa', 
                    x = mean(c(df_user$xmin, df_user$xmax)),
                    y = ymax_rect - (2/7)*(ymax_rect - ymin_rect)),
                hjust = 0.5) +
      
      annotate("text",
               size = text_size,
               label = "a",
               color = "#E9EAF9",
               x = mean(c(df_user$xmin, df_user$xmax)),
               y = ymin_rect + (2/7)*(ymax_rect - ymin_rect),
               hjust = 0.5)

I'm start thinking if there is some lib/dependency that i need to install on my docker image to centering labels work properly (that maybe RStudio already does to me, without my knowledge)

The libs I alredy installed are:

FROM rocker/r-ver:4.0.2 as base

# Install gcsfuse
RUN apt-get update && apt-get install gnupg curl fuse -y && apt-get install -y wget
ENV GCSFUSE_REPO=gcsfuse-stretch
RUN apt-get update -y
RUN curl -L -O https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v0.30.0/gcsfuse_0.30.0_amd64.deb
RUN dpkg --install gcsfuse_0.30.0_amd64.deb
RUN apt-get remove -y curl --purge && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

# Pandoc
RUN wget https://github.com/jgm/pandoc/releases/download/2.9.2.1/pandoc-2.9.2.1-1-amd64.deb
RUN dpkg -i pandoc-2.9.2.1-1-amd64.deb

# install the linux libraries needed for plumber
RUN apt-get update -qq && apt-get install -y 
  libssl-dev 
  libcurl4-gnutls-dev
  #libpq-dev # This for RPostgreSQL, if we need someday to use

Any suggestion will help. Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...