1

I want to make a plot that labels a point with the chemical structure represented by the value at that point.

In the example below I have a plot of melting points which are labelled by the smiles strings of the molecules.

chem_data <- c(40.5, -6.3, -44)

names(chem_data) <- c("c1ccc(cc1)O", "Nc1ccccc1", "Fc1ccccc1" )

plot(chem_data, main="Example Plot\n Labelled with Smiles String", ylim=c(-50,50), xlim=c(0,4),
     ylab="mp /°C")

text(chem_data, labels=names(chem_data), cex= 0.7, pos=1)

How do I label the points with the chemical structures rather than the smiles strings?

Can R generate the image of the chemical structure from the smiles string?

DarrenRhodes
  • 1,431
  • 2
  • 15
  • 29
  • Can you edit the question, it isn't clear. what do you mean by chemical structure? like the real structure, i.e. if it was benzene you want to show underneath an aromatic ring? – David May 21 '19 at 10:35
  • @chemist yes 'the real structure' as you call it. – DarrenRhodes May 21 '19 at 10:38
  • you might want to check either the add.image() function at https://www.image.ucar.edu/GSP/Software/Fields/Help/add.image.html or the following: https://stackoverflow.com/questions/27800307/adding-a-picture-to-plot-in-r – David May 21 '19 at 10:58

0 Answers0