[R] Graphs for scientific publication ?

Ista Zahn istazahn at gmail.com
Fri May 1 20:06:22 CEST 2015


On Thu, Apr 30, 2015 at 8:05 AM, Jeremy Clark <jeremyclarkbio at gmail.com> wrote:
> Dear All,
>
> First of all, many thanks to all R contributors for a fantastic
> program, and especially to Hadley Wickham for creating ggplot2. The
> following is intended to be a warning that, if the apparently
> superficial problems described are not sorted out, R could well find
> itself being superceded.

In my opinion that can and should happen, but my prediction is that R
has such a big lead in terms of available functionality and packages
that no one will catch up for at least a decade.

The reason is that a new user wants to draw a
> graph, and perhaps publish in a scientific journal a graph created
> using R, well before wanting to do a complex regression (and the
> latter is relatively easy). So here goes:
>
> 1) The saga of the straight line. I implemented a geom_abline - it
> looked superb. Unfortunately I had to disable clip to allow text - now
> my abline looked ridiculous. My search found plotrix: ablineclip -
> fantastic I thought - but it applies to plot and not geom_plot. I
> switched to geom_segment - the rendering looked trash. I switched to
> geom_smooth - should work but as I don't know the x values beforehand
> I'll have to clip a new dataframe - it that a hassle ? - Yes it is !

As others have mentioned we can probably help you if you give us a
reproducible example and a clear description of what you are trying to
accomplish. Absent that this just sounds like complaining for the sake
of it.

>
>             So my general question is - why isn't ggplot2 already part
> of R base

I think packages are added to the base distribution relatively
infrequently these days. Is

install.packages("ggplot2")

really an issue?

- or at least if someone is to create useful packages for
> plot - perhaps a subtle hint could be made that they should also apply
> to ggplot2 (and perhaps to lattice ??

I'm not understanding what you are trying to say here.

- also personally I would scrap
> qplot as an unnecessary distraction which is not easier to implement
> than ggplot).

ggplot2 is in maintenance mode, so it is unlikely that major changes
like that will be introduced.

 In general duplication of packages for plot and ggplot
> doesn't seem like a good idea.

I'm not sure what kind of duplication you are referring to here,
though in general I also wish there was less duplicated functionality
spread across various R packages.

>
>
> 2) The saga of the italic letter. I found, to my dismay, that to
> insert an italic letter into my plot I had to learn a whole new
> language called plotmath - which wouldn't accept normal R coding, and
> didn't even have normal control functions such as /n for a new line.
> This is ridiculous (and I'm not sure how plotmath managed to get into
> R base).

library(ggplot2)

d1 <- data.frame(x = 1, y = 1, t = "some text")
d2 <- d1
d2$x <- 2

ggplot(d1, aes(x = x, y = y, label = t)) +
  geom_text(hjust = 0, size = 10) +
  geom_text(data=d2, fontface="italic", hjust=1, size = 10)

Works for me.

>
>             So my question is, when is plotmath going to have a
> complete overhaul to allow eg. "," instead of, or as well as, ~,~, and
> normal control functions such as \n ?

Probably never (though you could do it yourself if you think it is
worth spending the time to improve it).

>
> 3) A related question to (2) is: where is geom_textbox ?

I don't think there is one. You could make one following the
documentation at
https://github.com/hadley/ggplot2/wiki/Creating-a-new-geom

>
> 4) Where are examples with scientific graph defaults ?  (meaning a
> two-axis graph which is publishable - I will post my own after this is
> published in a years time, but as suggested above, while the graph
> looks good the implementation of this is not pretty).

Lot's of people publish ggplot2 graphs, standards differ from field to
field and from journal to journal.
http://scholar.google.com/scholar?cites=14238124760782644329&as_sdt=40000005&sciodt=0,22&hl=en
will give you some examples. Beyond that I think you'll have to be
more specific about what exactly you want the graphs to look like.

>
> Having said that - good luck with implementation - and many thanks for
> all your hard work !
>
> Yours sincerely,
>
> Abiologist
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list