pyplot scatter plot marker size

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, faceted=True, verts=None, hold=None, **kwargs) The marker size s: size in points^2. It is a scalar or an array of the same length as x and y. What kind of unit is points^2? What does it mean? Does … Read more

In Matplotlib, what does the argument mean in fig.add_subplot(111)?

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 produces: I’ve been reading the documentation like crazy but I can’t find an explanation for the 111. sometimes I see a … Read more

setting y-axis limit in matplotlib

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’) ax = [] aPlot = plt.subplot(321, axisbg = ‘w’, title = “Year 1″) ax.append(aPlot) plt.plot(paramValues,plotDataPrice[0], color=”#340B8C”, marker=”o”, ms = 5, mfc=”#EB1717″) plt.xticks(paramValues) plt.ylabel(‘Average Price’) plt.xlabel(‘Mark-up’) plt.grid(True) … Read more

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 matplotlib.rc(‘xtick’, labelsize=20) matplotlib.rc(‘ytick’, labelsize=20) But how does one change the rest? 15 s 15 From the matplotlib documentation, font = {‘family’ : ‘normal’, … Read more

Purpose of “%matplotlib inline”

What exactly is the use of %matplotlib inline? 10 s 10 %matplotlib is a magic function in IPython. I’ll quote the relevant documentation here for you to read for convenience: IPython has a set of predefined ‘magic functions’ that you can call with a command line style syntax. There are two kinds of magics, line-oriented … Read more

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

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 the figure title and the axis labels. I need all three to be different font sizes, so setting a global font size (mpl.rcParams[‘font.size’]=x) is … Read more