'AxesSubplot' object is not callable

Viewed 83

I am trying to plot multiple plot using function. When I am doing scaling ax.axes it is showing

'AxesSubplot' object is not callable

Is there any way to handle this error?

from matplotlib import pyplot as plt

import numpy as np

def draw_line(ax,array):
    ax.axes([0, 0, 2, 2])
    ax.scatter(x=actual,y=pred)

# example data and figure
example_list = [[1,2,3],[4,5,6],[3,2,5],[3,2,5],[3,2,5],[3,2,5]]
fig, axis = plt.subplots(nrows=2, ncols=3)

# loop over elements in subplot and data, plot each one
for ax,i in zip(axis.flatten(),example_list):
    draw_line(ax,i) 
0 Answers
Related