Discussion:
How to flip x-axis tick marks
Karl Fetter
2018-10-03 20:24:49 UTC
Permalink
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 plot:

[image: Rplot01.jpeg]


But I want something with tick marks similar to this one:


[image: Untitled.jpg]



Any help getting the x-axis tick orientation switched?


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 ***@googlegroups.com
To unsubscribe: email ggplot2+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...