I am a student using matplotlib for research, and I am trying to plot some data points for two variables alongside the ratio (z) of x/y or the previous two variables.
I am a bit new to this, but where would I insert my points?
Right now I have inserted my x and y values for 3 points in the two lines of code shown below but I get an error whenever I list more than 3 values which makes me think this is for the array and is not where I am supposed to insert my points for x and y. Thank you for the help.
xlist = np.linspace( 570, 100, 10, 100)
ylist = np.linspace( 800, 1000, 1000, 100)
The actual function does this "Return evenly spaced numbers over a specified interval". in particular, the first 2 parameters are the start
and the stop
and the third parameter is the number of samples to generate
.
So the linespace function looks like this:
def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
axis=0):
"""
Return evenly spaced numbers over a specified interval.
Returns `num` evenly spaced samples, calculated over the
interval [`start`, `stop`].
The endpoint of the interval can optionally be excluded.
.. versionchanged:: 1.16.0
Non-scalar `start` and `stop` are now supported.
.. versionchanged:: 1.20.0
Values are rounded towards ``-inf`` instead of ``0`` when an
integer ``dtype`` is specified. The old behavior can
still be obtained with ``np.linspace(start, stop, num).astype(int)``
Parameters
----------
start : array_like
The starting value of the sequence.
stop : array_like
The end value of the sequence, unless `endpoint` is set to False.
In that case, the sequence consists of all but the last of ``num + 1``
evenly spaced samples, so that `stop` is excluded. Note that the step
size changes when `endpoint` is False.
num : int, optional
Number of samples to generate. Default is 50. Must be non-negative.
endpoint : bool, optional
If True, `stop` is the last sample. Otherwise, it is not included.
Default is True.
retstep : bool, optional
If True, return (`samples`, `step`), where `step` is the spacing
between samples.
dtype : dtype, optional
The type of the output array. If `dtype` is not given, the data type
is inferred from `start` and `stop`. The inferred dtype will never be
an integer; `float` is chosen even if the arguments would produce an
array of integers.
So you can see that the inputs are the arguments and the description of what they do.
I got this from the linspace
definition...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.