title: How to pass a (*args,**kwargs) type of attribute to a function within class?
body: <p>I want to create a module for a custom plot drawing for my scientific data, but I do not know how to pass an argument of type <code>(*arg2,**kwarg2)</code> to a method.</p>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  # class of figures for channel flow
  # with one subfigure
  
  class Homfig:
  
      # *args: list of plot features for ax1.plot
      #     (xdata,ydata,str linetype,str label)
      # **kwargs: list of axes features for ax1.set_$(STH)
      #     possible keys:
      #     title,xlabel,ylabel,xlim,ylim,xscale,yscale
  
      def __init__(self,*args,**kwargs):
          self.args = args
          self.kwargs = kwargs
          self.fig = plt.figure()
          self.ax = self.fig.add_subplot(111)
  
          for key, val in self.kwargs.iteritems():
              getattr(self.ax,'set_'+key)(val)
  
      def hdraw(self):
          for arg in self.args:
              self.ax.plot(*arg)
              leg = self.ax.legend(loc=4)
  </code></pre>
  
  <p>The problem is that <code>arg</code> is itself a tuple like <code>(*agr2,**kwarg2)</code> and when I call
      self.ax.plot(*arg)
  it does not see named variables.
  Function <code>hdraw</code> should operate on the input it got in <code>*args</code> from init, and data for plot lines are passed in <code>arg</code>.
  How can I express that <code>arg</code> consists of unnamed and named variables?
  <code>self.ax.plot</code> may be called more then once, when I want to have several lines (with different <code>label</code>, <code>linetype</code>, etc., in one plot.)</p>
  
  <p>I call the module from other python script with:</p>
  
  <pre><code>meanfig = hfig.Homfig((datax,datay),title='test plot')
  meanfig.hdraw()
  </code></pre>
  
  <p>How can I add features like label or linetype to the self.ax.plot, for example:</p>
  
  <pre><code>meanfig = hfig.Homfig((datax,datay,label="test_label",linetype ='o'),title='test plot')
  </code></pre>