0

i have several sensor measurements saved in several csv files. I want to compare the values in one single plot, but i cant make this work. I always end up open every graph into an own plot.

import matplotlib.pyplot as plt
import pandas as pd

daten = pd.read_csv("testX.csv")
datenZwei = pd.read_csv("testY.csv")
datenDrei = pd.read_csv("testZ.csv")

daten.plot(kind='line', x=' X', y=' Y1 (SX (N/m^2))')
datenZwei.plot(kind='line', x=' X', y=' Y1 (SY (N/m^2))')
datenDrei.plot(kind='line', x=' X', y=' Y1 (SZ (N/m^2))')

plt.show()

This is the result, but i want them all to be in one figure

This is the result, but i want them all to be in one figure, how can i do that? Thank you for you help.

2 Answers 2

1
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(x_value,y_value)
ax.plot(x2_value,y2_value)

substitute x and y values with correct entries on you dataframe

Sign up to request clarification or add additional context in comments.

Comments

1

You could try creating a figure with an axes object: fig, ax = plt.subplots() and then passing that axes object to the "ax" argument of the pandas plot method:

daten.plot(kind='line', x=' X', y=' Y1 (SX (N/m^2))', ax= ax)
datenZwei.plot(kind='line', x=' X', y=' Y1 (SY (N/m^2))', ax= ax)
datenDrei.plot(kind='line', x=' X', y=' Y1 (SZ (N/m^2))', ax= ax)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.