x-axis tick marks length in ggplot2

66 views
Skip to first unread message

Maria Lathouri

unread,
Jun 27, 2018, 12:21:53 PM6/27/18
to Ggplot2
Dear all,


I would like to ask if there is a way to increase the length of the tick marks on the x-axis only.


I got the code:

p+ theme(axis.ticks.length=unit(.30, "cm"))

but this increases the length for both x and y axis; whereas, I would like only on x-axis.


Thank you very much in advance.


Kind regards,
Maria

Abhimanyu Khatry

unread,
Jun 28, 2018, 6:38:24 AM6/28/18
to ggp...@googlegroups.com
How a beginner can get started on ggplot ? Is it right to start this if someone is new to data science ?


--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maria Lathouri

unread,
Jun 28, 2018, 7:53:09 AM6/28/18
to Abhimanyu Khatry, Ggplot2
Dear Abhimanyu,

If I am not mistaken, this online help is to post questions, and if possible, these questions to be answered. NOT for sarcastic and insulting posts. You could have just easily ignored my question. So simple.    

Kind regards,
Maria


Στις 12:38 μ.μ. Πέμπτη, 28 Ιουνίου 2018, ο/η Maria Lathouri <mlat...@yahoo.gr> έγραψε:


I am sorry but I didn't get your point. And I am not new in data science!!

Maria


Στις 11:38 π.μ. Πέμπτη, 28 Ιουνίου 2018, ο/η Abhimanyu Khatry <khatrya...@gmail.com> έγραψε:


How a beginner can get started on ggplot ? Is it right to start this if someone is new to data science ?
On Wed, Jun 27, 2018 at 9:47 PM, 'Maria Lathouri' via ggplot2 <ggp...@googlegroups.com> wrote:
Dear all,


I would like to ask if there is a way to increase the length of the tick marks on the x-axis only.


I got the code:

p+ theme(axis.ticks.length=unit(. 30, "cm"))


but this increases the length for both x and y axis; whereas, I would like only on x-axis.


Thank you very much in advance.


Kind regards,
Maria

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/ devtools/wiki/Reproducibility

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@ googlegroups.com
More options: http://groups.google.com/ group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@ googlegroups.com.
For more options, visit https://groups.google.com/d/ optout.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com

More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

Ron Crump

unread,
Jun 28, 2018, 8:39:28 AM6/28/18
to ggp...@googlegroups.com, mlat...@yahoo.gr, khatrya...@gmail.com
Dear Maria,

> If I am not mistaken, this online help is to post questions, and if
> possible, these questions to be answered. NOT for sarcastic and
> insulting posts. You could have just easily ignored my question. So simple.

My interpretation of Abhimanyu's post was not that it was
aimed at you, but that it was a genuine question (that is,
Abhimanyu is new to data science and wants to know how to get
started and whether this is appropriate at this stage).

Abhimanyu, it is not good practice to hijack somebody else's
thread - it is rude and can lead to misunderstandings, as in
this case, I believe.

Maria:
I'm sorry I don't know the answer to your original
question, but I'm thinking about it. What are you planning
on doing with the y-axis ticks? What is your reason
for wanting the x and y axis ticks to be different lengths?

> How a beginner can get started on ggplot? Is it right to start this if
> someone is new to data science ?

Abhimanyu:
This list is for help with ggplot2 problems.

Most of the people on this list will be ggplot2 users
and keen on it's use, so this may not be the best place
to look for a truly balanced view point on whether or
not to learn it now. Personally, I'd go for it.

You might find the community.rstudio.com forums a better
option for this type of question.

To get started with ggplot, you could search for ggplot2
tutorials on the internet and look at some examples on the
internet, eg at http://www.jvcasillas.com/base_lattice_ggplot/
which uses ggplot2, lattice and base graphics or
http://www.cookbook-r.com/Graphs/ which is ggplot2 based.

If you reply to this email, please change the subject line
in order to differentiate it from Maria's question.

Ron.

Bri On

unread,
Jun 28, 2018, 9:00:53 AM6/28/18
to Maria Lathouri, Abhimanyu Khatry, Ggplot2
Dear Maria,

you are correct. This list is to get help with ggplot.

The message from Khatry is cryptic indeed. If I may, I think you have misunderstood Khatry. I understood it that this person is asking for a tip on how to start with ggplot, or whether one should start with ggplot if one is new to data science. If this is so, you may have understood an admirer seeking help as a person who means to harrass you.

Regarding your question, I am a little rusty, but don't recall that there is an option. However, I can modify the x-ticks with the following.

library(ggplot2)
p1 <- ggplot(mtcars, aes(wt, mpg)) +
  geom_point() +
  labs(title = "Fuel economy declines as weight increases")
p1 + theme(axis.ticks.x = element_line(colour='black', size = unit(.5, "cm")))

Now I would need to figure out why it only modifies certain ticks. As I said I am a little rusty.

Cheers,
Brian

Maria Lathouri

unread,
Jun 28, 2018, 9:33:56 AM6/28/18
to Bri On, Abhimanyu Khatry, Ggplot2
Dear Abhimanyu and all,

I am really sorry for this; I thought that his comment was addressing to me since he replied to my question and I felt a bit insulted. I truly apologize for the misunderstanding.

The theme(axis.ticks.x=element_line() ) makes a horizontal line on the x-axis. I have been struggling to find a way to change just the tick length of one axis but with no luck. I think that there is no option.

Many thanks,
Maria

James F. Henson

unread,
Jun 28, 2018, 1:04:41 PM6/28/18
to Abhimanyu Khatry, ggp...@googlegroups.com

Hello Maria,

 

There are many tutorials on ggplot2. Here is one.

 

Introduction to R Graphics with ggplot2

http://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html

 

 

Best regards,

James

 

 

 

From: ggp...@googlegroups.com [mailto:ggp...@googlegroups.com] On Behalf Of Abhimanyu Khatry
Sent: Thursday, June 28, 2018 12:08 AM
To: ggp...@googlegroups.com
Subject: Re: x-axis tick marks length in ggplot2

 

How a beginner can get started on ggplot ? Is it right to start this if someone is new to data science ?

On Wed, Jun 27, 2018 at 9:47 PM, 'Maria Lathouri' via ggplot2 <ggp...@googlegroups.com> wrote:

Dear all,


I would like to ask if there is a way to increase the length of the tick marks on the x-axis only.


I got the code:

p+ theme(axis.ticks.length=unit(.30, "cm"))

but this increases the length for both x and y axis; whereas, I would like only on x-axis.


Thank you very much in advance.


Kind regards,
Maria

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example:
https://github.com/hadley/devtools/wiki/Reproducibility

To post: email
ggp...@googlegroups.com



---
You received this message because you are subscribed to the Google Groups "ggplot2" group.

To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.


For more options, visit
https://groups.google.com/d/optout.

 

--

--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com

To unsubscribe: email ggplot2+u...@googlegroups.com


More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.

To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

http://www.sus.edu/Images/Interior/smiley.png
SU Smiles!
Excellent Customer Service is our Goal.
Tell us how we are doing! Click Here.
Click Here!


SU Smiles!
Excellent Customer Service is our Goal.
Tell us how we are doing! Click Here.
Click Here!
Reply all
Reply to author
Forward
0 new messages