Tagged Questions
103
votes
4answers
81k views
How do you change the size of figures drawn with matplotlib?
How do you change the size of figure drawn with matplotlib?
66
votes
3answers
64k views
Plot logarithmic axes with matplotlib in python
I want to plot a graph with one logarithmic axis using matplotlib.
I've been reading the docs, but can't figure out the syntax. I know that it's probably something simple like 'scale=linear' in the ...
45
votes
2answers
38k views
matplotlib save plot to image file instead of displaying it (so can be used in batch scripts for example)
I am writing a quick and dirty script to generate plots on the fly. I am using the code below (from matplotlib docs) as a starting point:
from pylab import *
from optparse import OptionParser
# make ...
44
votes
3answers
35k views
How to change the font size on a matplotlib plot
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
...
44
votes
3answers
74k views
Python, Matplotlib, subplot: How to set the 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.
...
39
votes
4answers
29k views
How to change legend size with matplotlib.pyplot
Simple question here: I'm just trying to get the size of my legend using matplotlib.pyplot to be smaller (ie, the text to be smaller). The code I'm using goes something like this:
plot.figure()
...
39
votes
1answer
14k views
Matplotlib: How to put individual tags for a scatter plot
I am trying to do a scatter plot in Matplotlib and I couldn't find a way to add tags to the points. For example:
scatter1=plt.scatter(data1["x"], data1["y"], marker="o",
...
38
votes
5answers
15k views
gnuplot vs Matplotlib
I've started on a project graphing Tomcat logs using gnuplot-py, specifically correlating particular requests with memory allocation and garbage collection. What is the
collective wisdom on ...
37
votes
2answers
3k views
matplotlib Legend Markers Only Once
I often plot a point on a matplotlib plot with:
x = 10
y = 100
plot(x, y, "k*", label="Global Optimum")
legend()
However, this causes the legend to put a star in the legend twice, such that it ...
34
votes
4answers
27k views
Generate a heatmap in MatPlotLib using a scatter data set
I have a set of X,Y data points (about 10k) that are easy to plot as a scatter plot but that I would like to represent as a heatmap.
I looked through the examples in MatPlotLib and they all seem to ...
34
votes
2answers
24k views
Hiding axis text in matplotlib plots
I'm trying to plot a figure without tickmarks or numbers on either of the axes (I use axes in the traditional sense, not the matplotlib nomenclature!). An issue I have come across is where matplotlib ...
33
votes
1answer
14k views
Text box in matplotlib?
Is it possible to display text in a box through Matplotlib, with automatic line breaks? By using pyplot.text(), I was only able to print multi-line text that flows beyond the boundaries of the ...
31
votes
5answers
4k views
making matplotlib graphs look like R by default?
Is there a way to make matplotlib behave identically to R, or almost like R, in terms of plotting defaults? For example R treats its axes pretty differently from matplotlib. The following histogram
...
30
votes
4answers
28k views
How do I tell matplotlib that I am done with a plot?
The following code plots two .ps files, but the second one contains both lines.
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
plt.subplot(111)
x = [1,10]
y = [30, ...
29
votes
2answers
11k views
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
...