0

I've come up with a graph (a scatterplot) of the log(1+inf) (inf = number of people infected with a given disease on the y-axis against one of the explanatory variables, in this case, the populational density (pop./km²; x-axis) on my model. The log transformation was used merely for visualization, because it spreads the distribution of the data and allows for more aesthetically appealing plots. Basically, what I want is both axis to show the value of that same variable before the log transformation. The dots need to be plotted like plot(log(1+inf),log(populational_density), but the number on the axis should refer to plot(inf,populational_density). I've provided a picture of my graph with some manual editing on the y-axis to show you the idea of what I want.

example

  • The numbers in red would be the 'inf' values equivalent to log(inf);

Please, bear in mind that those values in red do not correspond to reality.

I understand the whole concept of y = f(x), but i've been asked to provide it. Is this possible? I'm using the ggplot2package for plotting.

Eric Lino
  • 429
  • 4
  • 10
  • I think I would need a visual example to understand what you want – SamPer Aug 10 '18 at 23:11
  • 1
    Please provide a reproducible example. See [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for examples of how to do it. – Z.Lin Aug 11 '18 at 01:55
  • @SamPer I've added a graph and further exaplanation of what I want. Please let me know if it's easier to understand now. – Eric Lino Aug 14 '18 at 18:38
  • @Z.Lin , I'm afraid I can't give a reproducible example because I'm not discussing any particular errors, I'm talking about functionalities of a plot package on R. I need the data to be plotted using transformed variables but I need the axis to show untransformed values, and I can't give you an example because I don't know how to do this which I'm asking here. If I misunderstood you, please specify what you mean by "example" and I'll gladly provide it. I also inserted a graph on the question to make it easier to understand. – Eric Lino Aug 14 '18 at 18:42
  • @EricLino The point of a reproducible example is not (in this case) about reproducing errors. It's meant to give everyone a common context to work on. It's often frustrating for pple to write up a solution to a broadly described problem, only for the poster to say their actual requirements are different in some way. You've included a graph here; you can post the code used to generate it. (If the real dataset is not commonly available, generate a fake one is also fine.) – Z.Lin Aug 16 '18 at 00:34

0 Answers0