fennicahub / fennica

R tools for Fennica (Finnish national bibliography)
http://fennica-fennica.rahtiapp.fi
Other
0 stars 5 forks source link

Cairo support for figures seems to be missing in Rahti output #47

Open antagomir opened 1 year ago

antagomir commented 1 year ago

My impression is that we are missing Cairo support in the html output.

Therefore the R/ggplot2 figures do not show properly, see e.g. http://fennica-fennica.rahtiapp.fi/author_name.html

Solution: add Cairo support and check that the output figures will appear properly

antagomir commented 1 year ago

Hi @ElliotvGP could you have a look at this one? We can chat more if necessary. The Cairo package is often necessary for proper ggplot2 output.

ElliotvGP commented 1 year ago

I took a look at it and I don't really understand what's wrong ? Is it because the plot in the "Author productivity" section is empty ? Or is it a matter of formatting theses plots ?

antagomir commented 1 year ago

Yes, author productivity plot is empty, although I think the data is not empty.

antagomir commented 1 year ago

In some cases I have managed to solve this with teh following chunk (Rmd)

library(Cairo)

# global knitr options
knitr::opts_chunk$set(
  fig.width=10,
  dpi=300,
  dev = "png",
  dev.args = list(type = "cairo-png")
)
ElliotvGP commented 1 year ago

so i'm working on this issue and the problem don't seem to be coming from Cairo ? res <- compare_title_paper(df, "publisher") So here, res is a list with a plot and a dataset. We are trying to plot the graph res$plot The thing is that the datas from which res$plot is generated can be found in the res$table dataset. But in this dataset, the column res$table$paper is empty (all of the values are 0). I tried to change the values in the column manually and the plot seemed to be done correctly...

So I guess the problem comes from the datas and not from a Cairo support ?

antagomir commented 1 year ago

I am not sure but my impression throughout the book was that the Cairo support is missing. Also some other plots didn't look complete. Can you double-check? If this is not a problem then this issue can be closed.

However, this case is probably different as you mention. We could plot the figure only if the data is not empty but as a general strategy this would become a bit complicated. Usually we should plot figures only when it is expected that the data is not empty..