Questions tagged [axes]

Axes - plural of axis

Axes is plural of axis used in Cartesian coordinate system.

1002 questions
282
votes
9 answers

How to set common axes labels for subplots

I have the following plot: import matplotlib.pyplot as plt fig2 = plt.figure() ax3 = fig2.add_subplot(2,1,1) ax4 = fig2.add_subplot(2,1,2) ax4.loglog(x1, y1) ax3.loglog(x2, y2) ax3.set_ylabel('hello') I want to be able to create axes labels and…
farqwag25
  • 2,821
  • 3
  • 15
  • 3
201
votes
4 answers

Force the origin to start at 0

How can I set the origin / interception of the y-axis and x-axis in ggplot2? The line of the x-axis should be exactly at y=Z. With Z=0 or another given value.
Jonas Stein
  • 6,826
  • 7
  • 40
  • 72
177
votes
10 answers

Force R to stop plotting abbreviated axis labels (scientific notation) - e.g. 1e+00

In ggplot2 how can I stop axis labels being abbreviated - e.g. 1e+00, 1e+01 along the x axis once plotted? Ideally, I want to force R to display the actual values which in this case would be 1,10. Any help much appreciated.
JPD
  • 2,561
  • 5
  • 22
  • 26
123
votes
6 answers

How can I make a blank subplot in matplotlib?

I am making a group of subplot (say, 3 x 2) in matplotlib, but I have fewer than 6 datasets. How can I make the remaining subplot blank? The arrangement looks like this: +----+----+ | 0,0| 0,1| +----+----+ | 1,0| 1,1| +----+----+ | 2,0|…
mishaF
  • 7,934
  • 9
  • 30
  • 34
90
votes
2 answers

What are the differences between add_axes and add_subplot?

In a previous answer it was recommended to me to use add_subplot instead of add_axes to show axes correctly, but searching the documentation I couldn't understand when and why I should use either one of these functions. Can anyone explain the…
Ivan
  • 1,069
  • 1
  • 9
  • 14
72
votes
8 answers

Strange error with matplotlib axes labels

I'm very new to Python and programming in general, so apologies in advance if I'm missing something obvious. I'm trying to plot a graph and label the axes, but every time I try to label the y axis an exception is raised. I wrote the code below in a…
neptune36
  • 789
  • 1
  • 6
  • 10
70
votes
4 answers

Embedding small plots inside subplots in matplotlib

If you want to insert a small plot inside a bigger one you can use Axes, like here. The problem is that I don't know how to do the same inside a subplot. I have several subplots and I would like to plot a small plot inside each subplot. The example…
Argitzen
  • 783
  • 1
  • 8
  • 7
55
votes
4 answers

Matplotlib/pyplot: How to enforce axis range?

I would like to draw a standard 2D line graph with pylot, but force the axes' values to be between 0 and 600 on the x, and 10k and 20k on the y. Let me go with an example... import pylab as…
Stuart
  • 1,251
  • 2
  • 11
  • 18
47
votes
4 answers

How can I accomplish `set_xlim` or `set_ylim` in Bokeh?

I create a figure in a function, e.g. import numpy from bokeh.plotting import figure, show, output_notebook output_notebook() def make_fig(): rows = cols = 16 img = numpy.ones((rows, cols), dtype=numpy.uint32) view =…
Brian
  • 3,453
  • 2
  • 27
  • 39
46
votes
3 answers

How do I swap tensor's axes in TensorFlow?

I have a tensor of shape (30, 116, 10), and I want to swap the first two dimensions, so that I have a tensor of shape (116, 30, 10) I saw that numpy as such a function implemented (np.swapaxes) and I searched for something similar in tensorflow but…
Alexis Rosuel
  • 563
  • 1
  • 5
  • 12
42
votes
4 answers

Matlab: How to obtain all the axes handles in a figure handle?

How do I obtain all the axes handles in a figure handle? Given the figure handle hf, I found that get(hf, 'children') may return the handles of all axes. However, the Matlab Help suggests that it may return more than just the axes handles: Children…
YYC
  • 1,792
  • 1
  • 14
  • 19
38
votes
4 answers

Axes class - set explicitly size (width/height) of axes in given units

I want to to create a figure using matplotlib where I can explicitly specify the size of the axes, i.e. I want to set the width and height of the axes bbox. I have looked around all over and I cannot find a solution for this. What I typically find…
Gabriel
  • 525
  • 1
  • 5
  • 8
38
votes
2 answers

Plotting two axes in gnuplot

Is it possible to plot two curves, with two corresponding axes in gnuplot, each of which has a different scale? For example, y=x**2 and y=x**4 in the same graph (they vary enough to be "uncomfortable" when plotted with the same scale).
Rook
  • 60,248
  • 49
  • 165
  • 242
35
votes
2 answers

Reversed order after coord_flip in R

Data example from dbv: gender Sektion 1 m 5 2 m 5 3 w 3B 4 w 3B 5 w 3B 6 m 4 I have the following plot: Sekplot <- ggplot(dbv,aes(x=Sektion, …
CH_
  • 685
  • 1
  • 7
  • 18
34
votes
5 answers

matplotlib: AttributeError: 'AxesSubplot' object has no attribute 'add_axes'

Not sure exactly sure how to fix the following attribute error: AttributeError: 'AxesSubplot' object has no attribute 'add_axes' The offending problem seems to be linked to the way I have set up my plot: gridspec_layout =…
user3125347
1
2 3
66 67