Questions tagged [axis-labels]

The labels on any axis of a plot

The labels on any axis of a plot. For example, the x and y axis labels of a 2D plot.

Use this tag for problems regarding the typography, visibility, layout, and/or placement of the axis labels in your plot.

1631 questions
548
votes
13 answers

Rotate axis tick labels

I can't figure out how to rotate the text on the X Axis. Its a time stamp, so as the number of samples increase, they get closer and closer until they overlap. I'd like to rotate the text 90 degrees so as the samples get closer together, they…
tMC
  • 18,105
  • 14
  • 62
  • 98
217
votes
6 answers

Aligning rotated xticklabels with their respective xticks

Check the x axis of the figure below. How can I move the labels a bit to the left so that they align with their respective ticks? I'm rotating the labels using: ax.set_xticks(xlabels_positions) ax.set_xticklabels(xlabels, rotation=45) But, as you…
Filipe Correia
  • 5,415
  • 6
  • 32
  • 47
174
votes
5 answers

Remove plot axis values

I was just wondering if there is a way to get rid of axis values, either the x-axis or y-axis respectively, in an r-plot graph. I know that axes = false will get rid of the entire axis, but I would only like to get rid of the numbering.
user130633
  • 2,253
  • 4
  • 18
  • 11
134
votes
3 answers

How to force the Y axis to only use integers

I'm plotting a histogram using the matplotlib.pyplot module and I am wondering how I can force the y-axis labels to only show integers (e.g. 0, 1, 2, 3 etc.) and not decimals (e.g. 0., 0.5, 1., 1.5, 2. etc.). I'm looking at the guidance notes and…
Jay Gattuso
  • 3,890
  • 12
  • 37
  • 51
127
votes
8 answers

Rotating x axis labels in R for barplot

I am trying to get the x axis labels to be rotated 45 degrees on a barplot with no luck. This is the code I have below: barplot(((data1[,1] - average)/average) * 100, srt = 45, adj = 1, xpd = TRUE, …
David
  • 2,834
  • 6
  • 26
  • 31
116
votes
2 answers

Replace X-axis with own values

I have a question regarding the command plot(). Is there a way to fully eliminate the x-axis and replace it with own values? I know that I can get rid of the axis by doing plot(x,y, xaxt = 'n') and then add an axis with axis(side = 1…
Dani
  • 2,325
  • 5
  • 24
  • 20
111
votes
7 answers

d3 axis labeling

How do I add text labels to axes in d3? For instance, I have a simple line graph with an x and y axis. On my x-axis, I have ticks from 1 to 10. I want the word "days" to appear underneath it so people know the x axis is counting days. Similarly, on…
user1474218
  • 1,145
  • 2
  • 8
  • 5
79
votes
3 answers

How can I rotate xticklabels in so the spacing between each xticklabel is equal?

How can I rotate xticklabels in matplotlib so that the spacing between each xticklabel is equal? For example with this code: import matplotlib.pyplot as plt import numpy as np # Data + parameters fontsize = 20 t = np.arange(0.0, 6.0,…
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
79
votes
4 answers

Wrap long axis labels via labeller=label_wrap in ggplot2

I would like to automatically wrap my labels in ggplot2, i.e. insert line breaks of long labels. Here is written how to write a function (1) for it, but sadly I do not know where to put labeller=label_wrap in my code (2). (1) function by…
Til Hund
  • 1,543
  • 5
  • 21
  • 37
65
votes
3 answers

Matplotlib showing x-tick labels overlapping

Have a look at the graph below: It's a subplot of this larger figure: I see two problems with it. First, the x-axis labels overlap with one another (this is my major issue). Second. the location of the x-axis minor gridlines seems a bit wonky. …
8one6
  • 13,078
  • 12
  • 62
  • 84
54
votes
2 answers

In R base plot, move axis label closer to axis

I have eliminated labels on the y axis because only the relative amount is really important. w <- c(34170,24911,20323,14290,9605,7803,7113,6031,5140,4469) plot(1:length(w), w, type="b", xlab="Number of clusters", ylab="Within-cluster…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
51
votes
7 answers

Multirow axis labels with nested grouping variables

I would like the levels of two different nested grouping variables to appear on separate lines below the plot, and not in the legend. What I have right now is this code: data <- read.table(text = "Group Category Value S1 A 73 S2 A 57 …
pawels
  • 1,070
  • 1
  • 10
  • 16
50
votes
1 answer

Superscript and subscript axis labels in ggplot2

I need an axis label in ggplot2 which reads "Assimilation (μmol CO2 m-2 s-1)" with the 2 of CO2 as subscript and the -2 and -1 as superscript. Thanks.
Becky Martin
  • 511
  • 1
  • 4
  • 3
49
votes
4 answers

How to increase/reduce the fontsize of x and y tick labels

I seem to have a problem in figuring out how to increase or decrease the fontsize of both the x and y tick labels while using matplotlib. I am aware that there is the set_xticklabels(labels, fontdict=None, minor=False, **kwargs) function, but I…
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
45
votes
2 answers

How to display all label values in matplotlib

I have two lists, when I plot with the following code, the x axis only shows up to 12 (max is 15). May I know how can I show all of the values in x list to the x axis? Thanks in advance. x = [4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3] y =…
Kevin
  • 2,191
  • 9
  • 35
  • 49
1
2 3
99 100