Python Forum
Mathplotlib - passing reference to axs to function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mathplotlib - passing reference to axs to function
#4
Dean

I had previously tried what you are suggesting:

def showEvents(ax, events):
    for ev in events.values():
        ax.axvlines(ev[6], ev[1], ev[2], color = ev[3], \
             linestyle = ev[4], marker = ev[5], label = ev[0])
and then call it as
showEvents(ax1, allEvents)
and receive the error
Error:
ax.axvlines(ev[6], ev[1], ev[2], color = ev[3], \ AttributeError: 'AxesSubplot' object has no attribute 'axvlines'
I had hoped that doing the eval of the concatenation would resolve the issue. But it does not.
Reply


Messages In This Thread
RE: Mathplotlib - passing reference to axs to function - by qmfoam - Aug-14-2020, 05:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  passing dictionary to the function mark588 2 1,068 Dec-19-2022, 07:28 PM
Last Post: deanhystad
  reference from another function Frankduc 10 2,497 Mar-01-2022, 01:10 PM
Last Post: Frankduc
  How to automatically close mathplotlib output window? Pedroski55 2 1,997 Jun-17-2021, 09:00 AM
Last Post: Pedroski55
  Passing flags to python script, through a function xbit 4 4,122 Apr-20-2021, 06:32 AM
Last Post: ndc85430
  Passing argument from top-level function to embedded function JaneTan 2 2,327 Oct-15-2020, 03:50 PM
Last Post: deanhystad
  passing variable to function Rejoice 4 2,970 Sep-11-2020, 03:27 AM
Last Post: Pleiades
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,635 Sep-07-2020, 08:02 AM
Last Post: perfringo
  reference in pop function for linked list oloap 0 1,614 Mar-14-2020, 05:52 PM
Last Post: oloap
  Passing variable to another function JonnyDriller 10 3,990 Feb-05-2020, 03:46 AM
Last Post: JonnyDriller
  Passing an argument by reference Exsul 12 4,883 Aug-22-2019, 07:29 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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