简体   繁体   English

使用 Matplotlib 绘制多个 y 值与 x

[英]Plotting multiple y-values versus x using Matplotlib

I am trying to plot y1,y2,y3 all as a function of x and show all the three on a single plot.我正在尝试将 plot y1,y2,y3全部作为x的 function 并在单个 plot 上显示所有三个。 But it is showing only two plots.但它只显示了两个情节。 I present the current output.我介绍当前的 output。

import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-1,0,10)
print(x)
y1=36.554+5.418*np.exp(-1.327*x) 
y2=23.816+18.088*np.exp(-0.812*x)
y3=20.562+21.389*np.exp(-0.765*x)
print(y1,y2,y3)
plt.plot(x,y1,y2,y3)

The current output is当前的 output 是

Output Output

Try this: plt.plot(x, y1, x, y2, x, y3)试试这个: plt.plot(x, y1, x, y2, x, y3)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在matplotlib中显示y值差异很大的多个图? - How to show multiple plots with big differences in y-values in matplotlib? 使用matplotlib绘制[x,y] - Plotting [x,y] using matplotlib 在 Python 或 R 上绘制带有 X 值(年龄)和 Y 值(高度和重量)的简单图表 - Plotting a simple chart on Python Or R with X-Value(AGE), and Y-VALUES(HEIGHT and WEIGHT) 将多个Y值与多个X值相对应,这些X值是同一张图中matplotlib中不同的时间戳? - Plotting multiple Y values against multiple X values which are different timestamps in matplotlib in the same graph? 在 matplotlib 中设置独立于 y 值的 y 轴值 - Setting y-axis values independent of y-values in matplotlib 在matplotlib中绘制值与字符串的关系? - Plotting values versus strings in matplotlib? 在 matplotlib 中绘制 y=times(作为数据)与 x=dates:如何格式化所有日期的 y 轴? - Plotting y=times (as data) versus x=dates in matplotlib: How to format the y-axis for all dates? 使用matplotlib和numpy绘制1个y位置值与2个x位置值的弹丸运动 - Plotting projectile motion of 1 y-position values vs. 2 x-position values using matplotlib and numpy 使用 dataframe 的行名称/索引作为 y 值绘制轮廓 map - Plotting a contour map with row names/indices of dataframe as y-values 使用 matplotlib 为不同的 y 值创建带有彩色线条的折线图 - Create line chart with multicolored lines for different y-values with matplotlib
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM