The scatter diagram demonstrates

labeled with different color and size.

code:

import numpy as NP import pre> matplotlib.pyplot as PLT import matplotlib.cbook as cbook Load a numpy record array from # Yahoo CSV data with fields date, open, close, volume adj_close from #, the mpl-data/example directory. The record array stores date as an # the np.datetime64 with a day unit ('D') in the date column. with cbook.get_sample_data as datafile: price_data ('goog.npz') = np.load (datafile) ['price_data'].view (np.recarray) price_data = price_data[-250:] get the most recent trading 250 # days = Delta1 Np.diff (price_data.adj_close) / price_data.adj_close[: -1] Marker size in units of points^2 # (volume = 15 * price_data.volume[: -2] / price_data.volume[0]) **2 close = 0.003 * 0.003 * price_data.open[/ price_data.close[: -2]: -2] = plt.subplots (fig, ax) ax.scatter (delta1[: -1], delta1[1:], c=close, s=volume, alpha=0.5 (r'$Delta_i$') ax.set_xlabel fontsize=15), ax.set_ylabel (r'$Delta_{i+1}$', fontsize=15) ax.set_title ('Volume and percent change') ax.grid (True) fig.tight_layout (plt.show) (

)

above is the article Python+matplotlib drawing on different size and color scatter examples of all content, I hope all of you Help. Interested friends can continue to refer to other relevant topics of the station, if there are shortcomings, welcome the message. Thank you for the support of our friends!

This paper fixed link:http://www.script-home.com/pythonmatplotlib-drawing-examples-of-different-size-and-color-scatter-plots.html | Script Home | +Copy Link

Article reprint please specify:Python+matplotlib drawing examples of different size and color scatter plots | Script Home

You may also be interested in these articles!