![]() Is there a way I can get y=x to show up even if I don't have a list of all the points that I plotted? I would think that something in matplotlib can give me a list of all the points after the fact, but I haven't been able to figure out how to get that list. In order to achieve this I've had to keep track of all the x and y values that went into the scatter plot so that I know where identity_line should start and end. Plt.plot(identity_line, identity_line, color="black", linestyle="dashed", linewidth=3.0) Identity_line = np.linspace(max(min(all_x), min(all_y)), # Could I somehow do the next part (add identity_line) if I haven't been keeping track of all the x and y values I've seen? here (0,0)) doesn't actually need to be in your data or plotting range. To plot xy: ax.axline ( (0, 0), slope1) You don't need to look at your data to use this because the point you specify (i.e. And also whether to show a dot at the data location or not would be nice to be able to specify. It would be nice to be able to customize what it is that connects vertically from horizontal axis to each data point: whether it be a wide bar, an arrow, or a thin line. ![]() Here's some code that does scatter plot of a number of different series using matplotlib and then adds the line y=x: import numpy as np, matplotlib.pyplot as plt, matplotlib.cm as cm, pylabĬolors = cm.rainbow(np.linspace(0, 1, nseries)) 1 I have this code to plot some data in python using matplotlib: import matplotlib.pyplot as plt x 1,2,5 y 2,4,1 plt.plot (x,y) plt. Starting with matplotlib 3.3 this has been made very simple with the axline method which only needs a point and a slope. It is the look of xy scatter chart I am trying to change. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |