I figured out a solution by myself. In brief, I used different axis commands
to specify the ticks (with labels set to FALSE) and the labels (with tick
set to FALSE). For instance (with width=1 and space=1):
axis(side=1,at=c(2,6),labels=FALSE,tck=-0.1)
axis(side=1,at=c(0,4,8),labels=FALSE,tck=-0.2)
axis(side=1,at=c(1,3,5,7),labels=c("a","b","c","d"),tick=FALSE)
axis(side=1,at=c(2,6),labels=c("A","B"),tick=FALSE,padj=2)

Sebastien

On Mon, Aug 22, 2011 at 6:33 PM, Sébastien Vigneau <
sebastien.vigneau@gmail.com> wrote:

> Thank you for your answer!
>
> I have two additional questions, in line with the previous one:
>
>    1. how can I obtain tick marks flanking the labels, instead of being
>    aligned with them (similar to the pipe symbols on my example)?
>    2. how can I obtain tick marks of different sizes, so that the marks
>    separating the groups are longer?
>
> Thank you for your help!
>
> Sebastien
>
>
> On Mon, Aug 22, 2011 at 2:07 PM, Joshua Wiley <jwiley.psych@gmail.com>wrote:
>
>> Hi Sébastien,
>>
>> Not sure about an elegant, general way but here is something quick and
>> dirty:
>>
>> p <- barplot(matrix(1:8, 2))
>> axis(1, at = p, labels = letters[1:4])
>> axis(1, at = c(mean(p[1:2]), mean(p[3:4])), labels = paste("\n",
>> LETTERS[1:2]), padj = 1)
>>
>> Cheers,
>>
>> Josh
>>
>>
>>
>> On Mon, Aug 22, 2011 at 10:14 AM, Sébastien Vigneau
>> <sebastien.vigneau@gmail.com> wrote:
>> > Hi,
>> >
>> > I would like to draw a stacked bar chart with four bars (say "a", "b",
>> "c",
>> > "d") . Two bars belong to group A and the two others to group B.
>> Therefore,
>> > I would like to have, on the x-axis, a label for each bar and an
>> additional
>> > label for each group, positioned underneath. To give an idea, the x-axis
>> > labels should look like this:
>> > |a|b|c|d|
>> > | A | B |
>> >
>> > Do you know how I can generate such two-levels labels in R?
>> >
>> > Thank you for your help!
>> >
>> > Sebastien
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help@r-project.org mailing list
>> > 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.
>> >
>>
>>
>>
>> --
>> Joshua Wiley
>> Ph.D. Student, Health Psychology
>> Programmer Analyst II, ATS Statistical Consulting Group
>> University of California, Los Angeles
>> https://joshuawiley.com/
>>
>
>

	[[alternative HTML version deleted]]

