Matplotlib Axvline Wahrheit mehrdeutig oder Listenproblem?Python

Python-Programme
Guest
 Matplotlib Axvline Wahrheit mehrdeutig oder Listenproblem?

Post by Guest »

Ich versuche, einige vertikale Linien in einem Diagramm mit einer "Liste" von Ganzzahlen (1 ... 300) und einigen "Werten" (Floats) zu zeichnen. Das Folgende funktioniert, wenn x = [48], aber wenn x auf x = [48, 83, 155, 292] eingestellt ist, der folgende Code: < /p>

pylab.plot(list, values, label='Trend', color='k', linestyle='-')
pylab.axvline(x, linewidth=1, color='g')
< /code>

Generiert diesen Fehler: < /p>

File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2053, in axvline
ret = ax.axvline(x, ymin, ymax, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 3478, in axvline
scalex = (xxxmax) ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
< /code>

Was bedeutet es? (Ich fand es ziemlich lustig, dass Python vorgibt zu wissen, wann die Wahrheit mehrdeutig ist). Kann ich keine Liste an axvline übergeben?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post