Questions tagged [axis]

This tag should be used for questions about editing a plot axis, from any plotting library (e.g. matplotlib, ggplot, pandas, bokeh, plotly, etc.). Don't use this tag to refer to Apache Axis. Use [apache-axis] instead; see: https://meta.stackoverflow.com/q/276302/

3009 questions
881
votes
12 answers

How do I set the figure title and axes labels font size?

I am creating a figure in Matplotlib like this: from matplotlib import pyplot as plt fig = plt.figure() plt.plot(data) fig.suptitle('test title') plt.xlabel('xlabel') plt.ylabel('ylabel') fig.savefig('test.jpg') I want to specify font sizes for…
vasek1
  • 13,541
  • 11
  • 32
  • 36
753
votes
14 answers

Changing the tick frequency on the x or y axis

I am trying to fix how python plots my data. Say: x = [0, 5, 9, 10, 15] y = [0, 1, 2, 3, 4] matplotlib.pyplot.plot(x, y) matplotlib.pyplot.show() The x axis' ticks are plotted in intervals of 5. Is there a way to make it show intervals of 1?
Dax Feliz
  • 12,220
  • 8
  • 30
  • 33
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
482
votes
12 answers

How to remove xticks from a plot

I have a semilogx plot and I would like to remove the xticks. I tried: plt.gca().set_xticks([]) plt.xticks([]) ax.set_xticks([]) The grid disappears (ok), but small ticks (at the place of the main ticks) remain. How to remove them?
Vincent
  • 57,703
  • 61
  • 205
  • 388
460
votes
11 answers

Secondary axis with twinx(): how to add to legend

I have a plot with two y-axes, using twinx(). I also give labels to the lines, and want to show them with legend(), but I only succeed to get the labels of one axis in the legend: import numpy as np import matplotlib.pyplot as plt from matplotlib…
joris
  • 133,120
  • 36
  • 247
  • 202
292
votes
6 answers

How to set the subplot axis range

How can I set the y axis range of the second subplot to e.g. [0,1000] ? The FFT plot of my data (a column in a text file) results in a (inf.?) spike so that the actual data is not visible. pylab.ylim([0,1000]) has no effect, unfortunately. This is…
someone
  • 5,979
  • 3
  • 17
  • 6
177
votes
5 answers

Rotating axis labels in R

How do I make a (bar) plot's y axis labels parallel to the X axis instead of parallel to the Y axis?
Phoebe
  • 2,774
  • 3
  • 22
  • 27
162
votes
4 answers

How to share x axes of two subplots after they have been created

I'm trying to share two subplots axes, but I need to share the x axis after the figure was created. E.g. I create this figure: import numpy as np import matplotlib.pyplot as plt t = np.arange(1000)/100. x = np.sin(2*np.pi*10*t) y =…
ymmx
  • 4,769
  • 5
  • 32
  • 64
151
votes
24 answers

Multiple contexts with the same path error running web service in Eclipse using Tomcat

This is the error that I got when I created my first Axis2 web service using Eclipse. After I wrote the class, I created the web service with Apache Axis2. When I click the start server button in eclipse it gives an error message: Could not publish…
kkk
  • 1,551
  • 2
  • 10
  • 9
118
votes
4 answers

Changing the color of an axis

Is there a way to change the color of an axis (not the ticks) in matplotlib? I have been looking through the docs for Axes, Axis, and Artist, but no luck; the matplotlib gallery also has no hint. Any idea?
knipknap
  • 5,934
  • 7
  • 39
  • 43
117
votes
3 answers

How to get a matplotlib Axes instance

I need to make a candlestick chart using some stock data. For this I want to use the function matplotlib.finance.candlestick(). I need to supply quotes to this function and "an Axes instance to plot to". I created some sample quotes as…
kramer65
  • 50,427
  • 120
  • 308
  • 488
111
votes
10 answers

How to set the 'equal' aspect ratio for all axes (x, y, z)

When I set up an equal aspect ratio for a 3d graph, the z-axis does not change to 'equal'. So this: fig = pylab.figure() mesFig = fig.gca(projection='3d', adjustable='box') mesFig.axis('equal') mesFig.plot(xC, yC, zC, 'r.') mesFig.plot(xO, yO, zO,…
user1329187
108
votes
6 answers

how to turn on minor ticks only on y axis

How can I turn the minor ticks only on y axis on a linear vs linear plot? When I use the function minor_ticks_on to turn minor ticks on, they appear on both x and y axis.
emad
  • 2,869
  • 3
  • 18
  • 18
100
votes
1 answer

What is the meaning of axis=-1 in keras.argmax?

I am a beginner in Keras and need help to understand keras.argmax(a, axis=-1) and keras.max(a, axis=-1). What is the meaning of axis=-1 when a.shape = (19, 19, 5, 80)? And also what will be the output of keras.argmax(a, axis=-1) and keras.max(a,…
youngtackpark
  • 1,475
  • 3
  • 12
  • 14
98
votes
3 answers

Drawing average line in histogram (matplotlib)

I am drawing a histogram using matplotlib in python, and would like to draw a line representing the average of the dataset, overlaid on the histogram as a dotted line (or maybe some other color would do too). Any ideas on how to draw a line overlaid…
user308827
  • 21,227
  • 87
  • 254
  • 417
1
2 3
99 100