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
  TypeError: a bytes-like object is required ZeroX 13 3,838 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  TypeError: a bytes-like object is required, not 'str' - Help Please. IanJ 3 4,674 Aug-29-2022, 05:53 PM
Last Post: deanhystad
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,763 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  TypeError: missing 3 required positional arguments: wardancer84 9 10,663 Aug-19-2021, 04:27 PM
Last Post: deanhystad
  TypeError: run_oracle_job() missing 1 required positional argument: 'connection_strin python_student 1 1,938 Aug-06-2021, 08:05 PM
Last Post: SheeppOSU
  python 3: TypeError: a bytes-like object is required, not 'str' wardancer84 3 6,378 Jul-09-2021, 05:55 PM
Last Post: deanhystad
  TypeError: max_value() missing 2 required positional arguments: 'alpha' and 'beta' Anldra12 2 4,167 May-15-2021, 04:15 PM
Last Post: Anldra12
  TypeError: __init__() got an unexpected keyword argument 'value' Anldra12 7 22,438 May-11-2021, 06:35 PM
Last Post: deanhystad
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'Non Anldra12 2 5,108 May-02-2021, 03:45 PM
Last Post: Anldra12
  TypeError: sum() missing 1 required positional argument: 'num2' Insen 3 5,388 Jan-06-2021, 04:25 PM
Last Post: Insen

Forum Jump:

User Panel Messages

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