Не выводится график функции в Python

Я пытаюсь сделать график, используя библиотеку matplotlib, но постоянно выводится эта ошибка:

Traceback (most recent call last):
  File "c:\Users\hybas\Desktop\umorist\bot_new.py", line 182, in draw_figures_function 
    plt.plot(x, y, 'b')
  File "C:\Python310\lib\site-packages\matplotlib\pyplot.py", line 2769, in plot       
    return gca().plot(
  File "C:\Python310\lib\site-packages\matplotlib\axes\_axes.py", line 1632, in plot   
    lines = [*self._get_lines(*args, data=data, **kwargs)]
  File "C:\Python310\lib\site-packages\matplotlib\axes\_base.py", line 312, in __call__
    yield from self._plot_args(this, kwargs)
  File "C:\Python310\lib\site-packages\matplotlib\axes\_base.py", line 498, in _plot_args
    raise ValueError(f"x and y must have same first dimension, but "
ValueError: x and y must have same first dimension, but have shapes (1000,) and (1,)

как я понял, переменные x и y разного типа, из за чего вызывается ошибка. Но как превратить их в один тип, работающий для этой библиотеки? x Значение я получаю из сообщения пользователя телеграмм боту. Вот код самой программы:

from ast import arg
import logging
from re import X
import string
from turtle import st
import bs4
import random
import logging #Модуль для ведения журнала логов
import wikipediaapi
import webbrowser
import traceback
from termcolor import colored
from pyowm import OWM
from pyowm.utils.config import get_default_config
import googletrans
from youtube_search import YoutubeSearch
from langdetect import detect_langs
import json
import numpy as np
import matplotlib.pyplot as plt
import os

from aiogram import Bot, Dispatcher, executor, types

logging.basicConfig(level=logging.INFO)

bot = Bot(token='токен')
dp = Dispatcher(bot)

#ответ на команды
@dp.message_handler(commands=['start'])
async def begin(message: types.Message):
    await bot.send_message(message.chat.id, "Привет")

@dp.message_handler(commands=['bot'])
async def begin(message: types.Message):
    await bot.send_message(message.chat.id, "на месте")

@dp.message_handler(commands=['help'])
async def begin(message: types.Message):
    await bot.send_message(message.chat.id, "Могу переводить, находить в википедии что то")

#ВСЕ СООБЩЕНИЯ ПИСАТЬ С МАЛЕНЬКОЙ! Только ответы можно как угодно
@dp.message_handler(content_types=['text'])
async def get_message(message):

    temp_string = message.text.lower()
    temp_string = temp_string.split(" ")
    command = temp_string[0]
    command_options = [str(input_part) for input_part in temp_string[1:len(temp_string)]]

    async def draw_figures_function(*args: tuple):
        try:
            if not args[0]: return

            x = np.linspace(-3,3,1000)
            y = args[0]

            fig = plt.figure()

            ax = fig.add_subplot(1, 1, 1)
            ax.spines['left'].set_position('center')
            ax.spines['bottom'].set_position('zero')
            ax.spines['right'].set_color('none')
            ax.spines['top'].set_color('none')
            ax.xaxis.set_ticks_position('bottom')
            ax.yaxis.set_ticks_position('left')

            plt.plot(x, y, 'b')
            ax.grid()
            plt.savefig('C:/Users/hybas/Desktop/umorist/models/foo.png')

            photo = open('C:/Users/hybas/Desktop/umorist/models/foo.png', 'rb')
            await bot.send_photo(message.chat.id, photo=photo)
            photo.close()

            if os.path.isfile('C:/Users/hybas/Desktop/umorist/models/foo.png'): 
                os.remove('C:/Users/hybas/Desktop/umorist/models/foo.png')
            plt.close()
        except:
            traceback.print_exc()

    commands = {
    ("пересечение", "пересекаются", "across"): draw_figures_function,
}
    async def execute_command_with_name(command_name: str, args: list):
      for key in commands.keys():
          if command_name in key:
            try:
                await commands[key](args)
            except:
              await bot.send_message(message.chat.id, "ошибка, БЗЗ")

          else:
              pass  # print("Command not found")

    await execute_command_with_name(command, command_options)

if __name__ == "__main__":
    executor.start_polling(dp, skip_updates=True)

Ответы (0 шт):