11/27/2022 0 Comments Linear scatter plotAs the X-values increase (move right), the Y-values tend to increase (move up). You interpret a scatterplot by looking for trends in the data as you go from left to right: If the data show an uphill pattern as you move from left to right, this indicates a positive relationship between X and Y. The difference is that with a scatter plot, the decision is made that the individual points should not be connected directly together with a line but, instead express a trend. Scatter plots are similar to line graphs in that they start with mapping quantitative data points. Because the graph isn't a straight line, the relationship between X and Y is nonlinear. Each point on the graph represents a single (X, Y) pair. The straight line is a trend line, designed to come as close as possible to all the data points. The figure shows a very strong tendency for X and Y to both rise above their means or fall below their means at the same time. Scatter plot of a nonlinear relationship. Scatter plot of a strongly positive linear relationship. Now, we have got the complete detailed explanation and answer for everyone, who is interested! Log2_clipped_rp = np.log2(rp.clip(2**-100, None))Īx.This is a question our experts keep getting from time to time. import numpy as npįig, axes = plt.subplots(1, 3, figsize=(14, 5))Īx.scatter(rp, aep_NW, label="SSI sum")Īx.set_xlabel("Return period (0 values excluded)") I updated the examples to show the error you are seeing, one way to exclude the zeros, and one way to clip them and show them on a different scale. It appears this is due to there being 0's in your 'rp' array. It looks like in your " Image 3" the x axis is truncated, so that you don't see the data you are interested in. Plt.title("AEP for NW Europe: total loss per entire extended winter season") So then when I plot it I need the x axis scale to be similar to the example you showed above or the first image I attatched originally. Common scatter plot options Add a trend line. I then sort the aep_NW values from lowest to highest with the highest value being associated with the largest return value (951), then the second highest aep_NW value associated with the second largest return period value (475.5) ect. Then I want the x axis to be the return period for these values, so basically I made a rp array, of the same size, which is given values from 951 down decreasing my a half each time. The data represents a storm severity index for 951 years. #Linear scatter plot codeI'm not really sure what to post code wise as the data is all large and coming from a server so can't really give you the data to see it with.īasically aep_NW is a one dimensional array with 951 elements, values from 0-~140, with most values being small and only a few larger values. I think you are right that my x axis is truncated but I'm not sure why or how. Plt.plot(rp, aep, marker='o', linewidth=0) To replicate the scatter function which plots but does not show what I want. I have tried to work around it using plt.plot(retper, aep_NW, marker='o', linewidth=0) I have not been able to use the log scale function with a scatter plot as it then only shows 3 values rather than the thousands that exist. Computation of a basic linear trend line is also a fairly common option, as is coloring points according to levels of a third, categorical variable. I have tried using plt.xscale('log') but it does not achieve what I want. The scatter plot is a basic chart type that should be creatable by any visualization tool or solution. I want to create a plot with a non-linear x axis so that the relationship can be seen in a 'straight line' form. I have data with lots of x values around zero and only a few as you go up to around 950,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |