... | @@ -15,20 +15,47 @@ class axMyFirstAxes(MyAxes): |
... | @@ -15,20 +15,47 @@ class axMyFirstAxes(MyAxes): |
|
# This is the function that will format the rawdata so that they can be plotted
|
|
# This is the function that will format the rawdata so that they can be plotted
|
|
def formatRawdata(self, rawdata):
|
|
def formatRawdata(self, rawdata):
|
|
|
|
|
|
|
|
|
|
|
|
# Extract some part of the data
|
|
rawdata1 = rawdata.data[<some key>]
|
|
rawdata1 = rawdata.data[<some key>]
|
|
rawdata2 = rawdata.data[<some key>]
|
|
rawdata2 = rawdata.data[<some key>]
|
|
|
|
|
|
# Extract some part of the data and format them
|
|
# Format the data
|
|
|
|
|
|
if(self.fig.keywords[<some key>]):
|
|
if(self.fig.keywords[<some key>]):
|
|
# format in a certain way
|
|
# format in a certain way
|
|
else:
|
|
else:
|
|
# format in another way
|
|
# format in another way
|
|
|
|
|
|
xdata = <some formular>
|
|
# Put everything you need into the data of the axes
|
|
ydata = <some formular>
|
|
|
|
|
|
|
|
self.data = {'xdata': xdata,
|
|
self.data = {'xdata': xdata,
|
|
'ydata': ydata}
|
|
'ydata': ydata,
|
|
|
|
'xlabel': xlabel,
|
|
|
|
'ylabel': ylabel}
|
|
|
|
|
|
|
|
# Returning True or False is not optional
|
|
|
|
return(True)
|
|
|
|
|
|
|
|
|
|
|
|
# This function is the plotting procedure
|
|
|
|
def plotting(self):
|
|
|
|
|
|
|
|
# You can get the keywords you need from the figure
|
|
|
|
xrange = self.fig.keywords.get('xrange', None)
|
|
|
|
yrange = self.fig.keywords.get('yrange', None)
|
|
|
|
|
|
|
|
# All matplotlib functions are available (see http://matplotlib.org/api/axes_api.html)
|
|
|
|
self.plot(self.data['xdata'], self.data['ydata'])
|
|
|
|
|
|
|
|
# Any decoration you need
|
|
|
|
self.set_xlabel(self.data['xlabel'])
|
|
|
|
self.set_ylabel(self.data['ylabel'])
|
|
|
|
|
|
|
|
if xrange is not None:
|
|
|
|
self.set_xlim(xrange)
|
|
|
|
|
|
|
|
if yrange is not None:
|
|
|
|
self.set_ylim(yrange)
|
|
|
|
|
|
|
|
# Returning True or False is not optional
|
|
|
|
return(True)
|
|
``` |
|
``` |
|
|
|
\ No newline at end of file |