Python Forum
TypeError: missing a required argument: 'y'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: missing a required argument: 'y'
#1
Hello everyone,
I am trying to plot a graph from the result of LSTM anomaly.

fig, ax = plt.subplots(figsize=(16,12))
ax.plot(pd.to_datetime(df['datetime']), df['power'], color='b', label='Normal')
ax.scatter(only_power,  label='Anomaly', marker='o')
ax.xaxis_date()
plt.xlabel('Date Time')
plt.ylabel('power')
plt.legend()
fig.autofmt_xdate()
plt.show()
This code gives me a plot which is attached below.

I also have a list only_power which lie on blue line -- df['power'].

I want to show this 'only_power' list on blue line with red color but whenever I used my code I get missing y axis error.

How can I solve this problem, so that I can show 'only_power' list with red color in df['power'] line (blue line )

https://i.stack.imgur.com/HAze6.png
Larz60+ write Dec-15-2021, 10:27 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question TypeError: argument of type 'NoneType' is not iterable Tajaldeen 7 6,459 Nov-29-2024, 09:45 AM
Last Post: Tajaldeen
  TypeError: Diagram.render() takes 1 positional argument but 2 were given sachin1361 0 1,847 Apr-23-2024, 06:39 AM
Last Post: sachin1361
  TypeError: a bytes-like object is required ZeroX 13 23,840 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  TypeError: a bytes-like object is required, not 'str' - Help Please. IanJ 3 10,022 Aug-29-2022, 05:53 PM
Last Post: deanhystad
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 7,897 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  TypeError: missing 3 required positional arguments: wardancer84 9 17,712 Aug-19-2021, 04:27 PM
Last Post: deanhystad
  TypeError: run_oracle_job() missing 1 required positional argument: 'connection_strin python_student 1 3,181 Aug-06-2021, 08:05 PM
Last Post: SheeppOSU
  python 3: TypeError: a bytes-like object is required, not 'str' wardancer84 3 10,680 Jul-09-2021, 05:55 PM
Last Post: deanhystad
  TypeError: max_value() missing 2 required positional arguments: 'alpha' and 'beta' Anldra12 2 5,592 May-15-2021, 04:15 PM
Last Post: Anldra12
  TypeError: __init__() got an unexpected keyword argument 'value' Anldra12 7 32,369 May-11-2021, 06:35 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020