0

I have a dataframe that looks like below:

DateTime               ID          Temperature

2019-03-01 18:36:01    3             21

2019-04-01 18:36:01    3             21

2019-18-01 08:30:01    2             18

2019-12-01 18:36:01    2             12

I would like to visualize this as a plot, where I need the datetime in x-axis, and Temperature on the y axis with a hue of IDs, I tried the below, but i need to see the Temperature distribution for every point more clearly. Is there any other visualization technique?

x= df['DateTime'].values
y= df['Temperature'].values
hue=df['ID'].values
plt.scatter(x, y,hue,color = "red")
3
  • for each ID a different color is good? Commented Sep 3, 2019 at 9:09
  • no, if there is a line of ID passing through this plot should be ideal. Commented Sep 3, 2019 at 9:13
  • @hakuna_code - I think plot bar is ideal for this case Commented Sep 3, 2019 at 9:15

1 Answer 1

1

you can try:

df.set_index('DateTime').plot()

output:

enter image description here

or you can use:

df.set_index('DateTime').plot(style="x-", figsize=(15, 10))

output: enter image description here

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

3 Comments

Is it possible to plot voltage as a bar graph and mark label as points on them?
yes, but this plot is fine ? or you want something different?
yes, but to understand the distribution better I would like to mark labels as points. Can you please show me how to do that?

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.