How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?

I want to plot data, then create a new figure and plot data2, and finally come back to the original plot and plot data3, kinda like this: import numpy as np import matplotlib as plt x = arange(5) y = np.exp(5) plt.figure() plt.plot(x, y) z = np.sin(x) plt.figure() plt.plot(x, z) w = np.cos(x) plt.figure(“””first figure”””) … Read more

How do I tell matplotlib that I am done with a plot?

The following code plots to two PostScript (.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, 1000] plt.loglog(x, y, basex=10, basey=10, ls=”-“) plt.savefig(“first.ps”) plt.subplot(111) x = [10,100] y = [10, 10000] plt.loglog(x, y, basex=10, basey=10, ls=”-“) plt.savefig(“second.ps”) How … Read more

What is the difference between pylab and pyplot? [duplicate]

This question already has answers here: Which is the recommended way to plot: matplotlib or pylab? (2 answers) Closed last year. What is the difference between matplotlib.pyplot and matplotlib.pylab? Which is preferred for what usage? I am a little confused, because it seems like independent from which I import, I can do the same things. … Read more

Label points in geom_point

The data I’m playing with comes from the internet source listed below nba <- read.csv(“http://datasets.flowingdata.com/ppg2008.csv”, sep=”,”) What I want to do, is create a 2D points graph comparing two metrics from this table, with each player representing a dot on the graph. I have the following code: nbaplot <- ggplot(nba, aes(x= MIN, y= PTS, colour=”green”, … Read more