0

I have seen examples of graphs embedded very "natively" in papers:

enter image description here

The snippet shown is taken from here. It is not a particularly beautiful diagram or anything but what's nice about it is that these graphs are very natively embedded in the LaTeX PDF. For instance, I can select the text of the X and Y axis labels and all the text labels in the middle. I have seen experienced researchers do this and I would like to know how.

Here's what I have tried:

Created similar graphs in R and Python and then tried to port the resulting EPS image into LaTeX. It doesn't look bad, however, that is not as native (one can't select the text within the image as I mentioned above). It is hard to explain but when I do this the image is one intact object and nothing inside it can selected in PDF. However, in the image shown above, the graph seems to be more "modular"(?) such that you can select different text labels in it.

I am aware of the tikz package in LaTeX, however, I doubt that these researchers are manually typing in coordinates of the graph details into a tikz image. So maybe some software is being used to convert an R image into a native tikz image?

learnerX
  • 149
  • 8
  • 1
    You can certainly create these figures with tikz and pgfplots without manually typing coordinates. –  May 09 '20 at 22:51
  • How? Could you direct me to any resources or examples? – learnerX May 09 '20 at 22:56
  • The right one seems to be just a stacked and filled plot, look for stack plots=y in the pgfplots manual. The left one can can e.g. done with two node chains of some nodes that you could design with path picture, and some loop for the connections. Everything is rather straightforward if you have the data in a structured way. –  May 09 '20 at 23:00
  • But is there a package in say R that will export your graph into a tikzpicture? I'd rather not "program" in LaTeX and let a package in R or python do the translation for me. – learnerX May 09 '20 at 23:12
  • 1
    I cannot answer the question. There are users who use R to create LaTeX documents, I am not one of them. In order to draw the attention of these experts on this question I recommend changing the title. –  May 09 '20 at 23:22
  • 1
    The fact that you can select the text does not mean it is created directly in LaTeX with TikZ or similar. If I for example make a figure with matplotlib and save as PDF, the text in that figure is selectable when included in a document with \includegraphics. – Torbjørn T. May 10 '20 at 07:33
  • 2
    apart from doing the whole thing on tex/tikz if you include an EPS generated pdf then text will be selectable text if the original epd contains text. if the EPS is simply a bitmap picture with no text then it will still be a picture when imported – David Carlisle May 10 '20 at 07:43
  • It seems the left graphic (a Sankey diagram) could have been generated with https://www.d3-graph-gallery.com/sankey. With TikZ, you could start with https://tex.stackexchange.com/questions/40159/how-to-draw-a-sankey-diagram-using-tikz – BambOo May 10 '20 at 11:27

0 Answers0