Skip to main content
3265 votes
16 answers
6.4m views

How do I change the size of figure drawn with Matplotlib?
tatwright's user avatar
  • 38.7k
1801 votes
25 answers
3.2m views

This displays the figure in a GUI: import matplotlib.pyplot as plt plt.plot([1, 2, 3], [1, 4, 9]) plt.show() But how do I instead save the figure to a file (e.g. foo.png)?
Homunculus Reticulli's user avatar
1723 votes
18 answers
2.1m views

I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets ...
pottigopi's user avatar
  • 17.2k
969 votes
12 answers
1.1m views

What exactly is the use of %matplotlib inline?
Rishabh's user avatar
  • 9,997
956 votes
11 answers
1.4m views

I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0. I cannot get matplotlib graphics to show up inline. import matplotlib import numpy as np import matplotlib.pyplot as ...
Ian Fiske's user avatar
  • 10.6k
933 votes
17 answers
2.3m views

How does one change the font size for all elements (ticks, labels, title) on a matplotlib plot? I know how to change the tick label sizes, this is done with: import matplotlib matplotlib.rc('xtick',...
Herman Schaaf's user avatar
932 votes
12 answers
2.6m views

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(...
vasek1's user avatar
  • 14.2k
794 votes
15 answers
1.9m views

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 ...
Dax Feliz's user avatar
  • 13.1k
772 votes
4 answers
1.2m views

Matplotlib offers these functions: cla() # Clear axis clf() # Clear figure close() # Close a figure window When should I use each function and what exactly does it do?
southoz's user avatar
  • 7,741
733 votes
10 answers
2.0m views

I need help with setting the limits of y-axis on matplotlib. Here is the code that I tried, unsuccessfully. import matplotlib.pyplot as plt plt.figure(1, figsize = (8.5,11)) plt.suptitle('plot title')...
Curious2learn's user avatar
690 votes
6 answers
1.8m views

How do I increase the figure size for this figure? This does nothing: f.figsize(15, 15) Example code from the link: import matplotlib.pyplot as plt import numpy as np # Simple data to display in ...
Brian's user avatar
  • 15k
668 votes
7 answers
2.0m views

In the pyplot document for scatter plot: matplotlib.pyplot.scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, ...
LWZ's user avatar
  • 12.5k
657 votes
13 answers
1.4m views

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 ...
tMC's user avatar
  • 19.5k
613 votes
7 answers
1.6m views

I want to plot a graph with one logarithmic axis using matplotlib. Sample program: import matplotlib.pyplot as plt a = [pow(10, i) for i in range(10)] # exponential fig = plt.figure() ax = fig....
user avatar
605 votes
8 answers
560k views

Sometimes I come across code such as this: import matplotlib.pyplot as plt x = [1, 2, 3, 4, 5] y = [1, 4, 9, 16, 25] fig = plt.figure() fig.add_subplot(111) plt.scatter(x, y) plt.show() Which ...
pleasedontbelong's user avatar

15 30 50 per page
1
2 3 4 5
4856