Hello,--I made some plots a while back using the theme_economist() and my computer for some reason won't load or (re)-install ggthemes. So I'm out to remake the theme on my own. I'm nearly complete with what I want except for flipping the x-axis ticks up. Any idea how I can get the x-axis ticks pointing downward to point inward (into the plot?)Here's my code so far:ggplot(dat, aes(x=D_class,y=mantel_r)) +
geom_point(size = 3) + geom_line() +
guides(color=FALSE) +
labs(x="Pairwise geographic distance class (km)", y="Mantel r") +
#theme_bw() +
scale_x_continuous(labels=c("250", "500", "750", "1000"),
breaks=c(250000, 500000, 750000, 1000000)) +
theme(axis.title.y = element_text(size=12),
axis.title.x = element_text(size=12),
panel.background = element_rect(fill="white"),
plot.background = element_rect(fill = "white"),
panel.grid.major = element_line(color="grey"),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
axis.line.x = element_line(size = 1),
axis.ticks.y = element_blank(),
axis.ticks.x.top = element_line())Which produces this fig:But I want something with x-axis tick marks similar to this:Any help?Thanks!!
--
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.
Marios,I don't think I've been clear.If you want to set the x-axis ticks to be inside, but want to set the y-axis ticks to outside. This is what I think you can't do (but should be possible, I just don't know how). I also don't know if you can have a tick that goes across the axis (maybe a hjust/vjust thing?).library(ggplot2)line.n.ticks <-1.0ggplot(mtcars, aes(x = mpg, y = disp)) +geom_point() +theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(),line = element_line(colour = "black", size = line.n.ticks),panel.background = element_rect(linetype = 1, colour = "black", size = line.n.ticks),axis.line.x = element_line(colour = "black", size = line.n.ticks),axis.line.x.bottom = element_line(colour = "black", size = line.n.ticks),axis.line.x.top = element_line(colour = "black", size = line.n.ticks),axis.line.y = element_line(colour = "black", size = line.n.ticks),axis.line.y.left = element_line(colour = "black", size = line.n.ticks),axis.line.y.right =element_line(colour = "black", size = line.n.ticks),axis.ticks = element_line(colour = "black", size = line.n.ticks),axis.ticks.length = unit(-1.6, "mm"),axis.text.x = element_text(colour = "black", margin = margin(t = 8, r = 0, b = 7, l = 0)),axis.text.y = element_text(colour = "black", margin = margin(t = 0, r =8, b = 0, l = 7)))Ticks are inside for both x and y axes.Hopefully I'm more clear. This is more than what Karl was asking for and apologies to him for the curiosity.BOn Wed, Oct 3, 2018 at 3:47 PM Marios Barlas <marios...@gmail.com> wrote:I actually didn't see who needed the handler lol.
@'Brandon Hurr' look at the description of the following handlers
axis.ticks.x, axis.ticks.x.top, axis.ticks.x.bottom, axis.ticks.y, axis.ticks.y.left, axis.ticks.y.right
And just use the element I provide in my function to customize accordingly. If u choose to set axis. ticks the rest inherit from that so don't overdefine things ;)
From: Marios Barlas <marios...@gmail.com>
Sent: Thursday, October 4, 2018 12:42:53 AM
To: Brandon Hurr
Subject: Re: How to flip x-axis tick marks?
Load this as a function and provide the required handlers. Then you can just call it in your ggplot plot by defining the required sizes et voilà you have a nice publishable theme. I also fix fonts with this so you'll need the package extrafont.
Read there :)
From: Brandon Hurr <brando...@gmail.com>
Sent: Thursday, October 4, 2018 12:36:09 AM
To: marios...@gmail.com
Cc: karl....@gmail.com; ggplot2