# Create a Figure with 2 rows and 2 columns of subplots: In this example, multiple axes are enclosed in one figure and displayed in subplots: import matplotlib.pyplot as plt You can also use matplotlib to create complex figures that contain more than one plot. Plt.title(“Multiple Datasets in One Plot") # Create two datasets from the random floats: In this example, we’ll plot two separate data sets, xdata1 and xdata2: Matplotlib is highly flexible, and can accommodate multiple datasets in a single plot. Matplotlib Example: Multiple Data Sets in One Plot In this example, 2 arrays of the same length (one array for X axis values and another array for Y axis values) are plotted. In this case, the scatter() function is used to display data values as a collection of x,y coordinates represented by standalone dots. Matplotlib also supports more advanced plots, such as scatter plots. “o” letter marker Matplotlib Scatter Plot Example Plt.plot(xcoords, marker = “o”, linestyle = “-”)Ī partial list of string characters that are acceptable options for marker and linestyle: “-” solid line style # Mark each data value and customize the linestyle: In this example, each data value is labeled with the letter “o”, and given a dashed linestyle “–”: import matplotlib.pyplot as plt
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |