Ticks on the inside of axes?

1,571 views
Skip to first unread message

Robert Buitenwerf

unread,
Jun 10, 2011, 9:18:07 AM6/10/11
to ggp...@googlegroups.com
Hello,

Does anyone know if it is possible to place tick marks on the inside of axes? This is a requirement for a bunch of journals so I imagine it to be possible, I just can't figure out how... 

I tried making the length negative, e.g.

+opts(axis.ticks.length=unit(-1,"cm"))

Which places the x-axis ticks on the inside, but does not show any ticks on the y-axis. It appears to me that the y-axis ticks are "hiding" behind the plot, because when I increase their size, e.g. 

+opts(axis.ticks=theme_segment(size=5))

I can see them just sticking out....  


Any advice would be greatly appreciated!
Robert


Hadley Wickham

unread,
Jun 10, 2011, 10:51:01 AM6/10/11
to Robert Buitenwerf, ggp...@googlegroups.com
No it's not possible because I think it's a really bad idea for ticks
to potentially interfere with data. You're on your own, sorry.

Hadley

On Friday, June 10, 2011, Robert Buitenwerf

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

JiHO

unread,
Jun 12, 2011, 9:25:45 AM6/12/11
to Hadley Wickham, Robert Buitenwerf, ggp...@googlegroups.com
On Fri, Jun 10, 2011 at 16:51, Hadley Wickham <had...@rice.edu> wrote:
> No it's not possible because I think it's a really bad idea for ticks
> to potentially interfere with data. You're on your own, sorry.

If your journal really can't accept anything else, I see two solutions:
- editing your axes on the EPS/PDF file in Inkscape http://www.inkscape.org
- edit the theme to have no ticks, use scale_x/y_continuous to specify
breaks manually, plot the same breaks on the inside of the graphic
with geom_rug

JiHO
---
http://maururu.net

James Rome

unread,
Jun 12, 2011, 9:28:36 AM6/12/11
to ggp...@googlegroups.com
It is a good idea to have the ticks inward option. The Plasma Physics
journals require them inward also.

JiHO
---
http://maururu.net

--
James A. Rome
E-mail: jame...@gmail.com
URL: http://jamesrome.net

Michael Bach

unread,
Jun 15, 2011, 3:27:04 AM6/15/11
to ggplot2
On Jun 12, 3:25 pm, JiHO <jo.li...@gmail.com> wrote:
> If your journal really can't accept anything else, I see two solutions:
> - editing your axes on the EPS/PDF file in Inkscapehttp://www.inkscape.org
> - edit the theme to have no ticks, use scale_x/y_continuous to specify
> breaks manually, plot the same breaks on the inside of the graphic
> with geom_rug

Thanks for the suggestion JiHO. I think the OP also wanted to have
inside tick marks on the opposite side of the axes, i.e. a plot like
gnuplot produces by default. Can this also be achieved with geom_rug?

Michael

JiHO

unread,
Jun 15, 2011, 9:03:05 AM6/15/11
to Michael Bach, ggplot2

I don't think so. It is also the default in MATLAB. My point of view
is that they are a visual aid similar (but less powerful) than
ggplot's grid, hence their uselessness in ggplot.

If you really want them, just modify the plot to suit the journal in Inkscape.

JiHO
---
http://maururu.net

Michael Bach

unread,
Jun 15, 2011, 4:55:31 PM6/15/11
to ggplot2
On Jun 15, 3:03 pm, JiHO <jo.li...@gmail.com> wrote:
> I don't think so. It is also the default in MATLAB. My point of view
> is that they are a visual aid similar (but less powerful) than
> ggplot's grid, hence their uselessness in ggplot.

Agreed. I just asked because some of our foreign collaborators also
want the ticks this way. Regarding OP's intent: I assumed this because
gnuplot and MATLAB (thanks for the tip) style is maybe how people used
to these tools expect a plot to look like.

> If you really want them, just modify the plot to suit the journal in Inkscape.

"The Last Resort". Fair enough, but cumbersome and as I said it is not
for a specific journal, but for regular reports to collaborators.
Hadley Wickham made his point quite clear, so I do not expect this
feature to get implemented soon (if ever).

Michael

baptiste auguie

unread,
Jun 15, 2011, 5:30:16 PM6/15/11
to ggplot2
If you're desperate for it, a trivial modification to geom_rug would
allow this. The only downside is that you'll always have to specify
the breaks manually.

There seems to be something odd with the clipping in ggplot2; I
couldn't find a way to turn it off for the y axis for some reason
(grep clip R/*.r , changed all occurrences to "off").


Best,

baptiste

Paulo Eduardo Cardoso

unread,
May 15, 2014, 6:16:44 PM5/15/14
to ggp...@googlegroups.com, Robert Buitenwerf, had...@rice.edu
"No it's not possible because I think it's a really bad idea for ticks to potentially interfere with data. You're on your own, sorry.

Hadley"


Actually placing ticks inside the plot area is a requirement for some peer review magazines. Maps are required to be presented with ticks inside plot area (Oryx for example but many others).

Reply all
Reply to author
Forward
0 new messages