Skip to content

AttributeError: 'list' object has no attribute 'size' #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
warriorjacq9 opened this issue May 2, 2023 · 2 comments
Closed

AttributeError: 'list' object has no attribute 'size' #26

warriorjacq9 opened this issue May 2, 2023 · 2 comments

Comments

@warriorjacq9
Copy link

After trying to make a plot with this code:

plt.plot((_x, _i, {'legend': 'incandescent'}),
         (_x, _c, {'legend': 'CFC'}),
         (_x, _h, {'legend': 'Halogen'}),
         (_x, _l, {'legend': 'LED'}),
         _with='lines',
         terminal='dumb 120,40')

I get this error:

Traceback (most recent call last):
  File "index.py", line 47, in <module>
    terminal='dumb 120,40')
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2669, in plot
    globalplot.plot(*curves)
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2501, in plot
    *curves, **jointOptions), )
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2486, in make_subplot_data
    subplotOptions)
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2122, in _massageAndValidateArgs
    curves = [ reformat(curve) for curve in curves ]
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2122, in <listcomp>
    curves = [ reformat(curve) for curve in curves ]
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2105, in reformat
    if all( x.size <= 0 for x in curve ):
  File "/usr/local/lib/python3.7/site-packages/gnuplotlib.py", line 2105, in <genexpr>
    if all( x.size <= 0 for x in curve ):
AttributeError: 'list' object has no attribute 'size'

Expected output is a graph showing all four lines across x.

@dkogan
Copy link
Owner

dkogan commented May 2, 2023

All your data arguments should be numpy arrays. I bet some of them are plain Python lists. Yes?

@warriorjacq9
Copy link
Author

Thanks so much! I was using plain lists. After modifying it to use numpy lists it worked properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants