How to remove axis labels

13,784 views
Skip to first unread message

Bogaso

unread,
Jun 13, 2010, 5:48:35 AM6/13/10
to ggplot2
Dear all,

Please consider following plot :

library(ggplot2)
m <- qplot(rating, votes, data=subset(movies, votes > 1000), na.rm =
T)
m + scale_y_continuous("number of votes")

Here I want to remove the numbers : 2,3,4,5,........ etc along the x-
axis as well as 50000, 100000, 150000 along the y-axis. I want nothing
to be displayed there. Is it possible to achieve this using ggplot
techniques?

Thanks for your attention.

Dennis Murphy

unread,
Jun 13, 2010, 7:06:54 AM6/13/10
to Bogaso, ggplot2
m <- qplot(rating, votes, data=subset(movies, votes > 1000), na.rm = T)
m + scale_y_continuous("number of votes")
last_plot() + opts(axis.text.x = theme_blank(),
                    axis.text.y = theme_blank())

HTH,
Dennis


--
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

Bogaso

unread,
Jun 13, 2010, 9:04:01 AM6/13/10
to ggplot2
Thanks Dennis for your reply. It is working. However still I need one
more modification. You see still "tick-marks" are left in black colors
at the places of those numbers. I would like to clean those as well,
without effecting the "tick-lines" within the plot region, which are
in white color. Can I do that?

Thanks,
> > To unsubscribe: email ggplot2+u...@googlegroups.com<ggplot2%2Bunsu...@googlegroups.com >
> > More options:http://groups.google.com/group/ggplot2

ahmadou dicko

unread,
Jun 13, 2010, 6:24:06 AM6/13/10
to Bogaso, ggplot2
Hi List,
This is my first post, and i'm new to R and ggplot. first of all, i really want to thanks Dr Wickham for the software he did !!! Is my favorite package.
To answer to your questions Mr bogaso, i think that you have to add this :


m <- qplot(rating, votes, data=subset(movies, votes > 1000), na.rm =
T) + scale_y_continuous("number of votes")

 m + opts(axis.text.x = theme_blank(),axis.text.y=theme_blank())

ps: sorry for my english too......have a nice day
2010/6/13 Bogaso <bogaso.c...@gmail.com>
--
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

Dennis Murphy

unread,
Jun 13, 2010, 8:20:51 PM6/13/10
to Bogaso, ggplot2
Hi:

m + scale_y_continuous("number of votes") +
    opts(axis.text.x = theme_blank(), axis.text.y = theme_blank(),
            axis.ticks = theme_blank())

See section 8.1 of the ggplot2 book for references and examples.

HTH,
Dennis



Reply all
Reply to author
Forward
0 new messages