Beispiel #1
0
def buildGraph():
	"""
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
	global line, fig, plots

	# Initialize ax (subplot holder)
	ax = None

	# Create as many plots as we need to
	# TODO: Allow customization of view
	fig,ax = plt.subplots(nrows=len(plots), ncols=1, sharex=sharex, sharey=sharey)

	# Loop through our registered plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPacket, delayTime = getRows(plot["table"], age=plot["age"])

		# Move over our ax element. If only one registered plot, this will be ax itself, it more than one, it will be in a numpy array.
		# Make sure we're looking at a list
		if isinstance(ax,np.ndarray) == True:
			# Numpy won't let us pop. We'll grab the top, then remove it.
			plot["ax"] = ax[0]
			ax = np.delete(ax,0, axis=0)
		else:
			# This is the case where we're only plotting one thing. Just copy it over.
			plot["ax"] = ax

		# Plot our initial data points, saving the line object we will use later to update it for animations.
		# TODO: Allow customization here
		plot["line"] = plot["ax"].plot(timeStamps, delayTime, '-', linewidth=1)[0]

		# Format the background grid
		#ax.grid(color='r', linestyle='--', linewidth=1)
		# TODO: Allow customization here
		plot["ax"].grid(True, 'major')

		# Set our axis labels.
		plot["ax"].set_xlabel("time (local time)")
		plot["ax"].set_ylabel("round trip time (s)")

		# Set plot title based on plot parameters
		plot["ax"].set_title(plot["title"])

		# Add human fiendly times along the bottom
		addTimeTicks(timeStamps, plot["ax"])

	# Add the footer
	footer(plt)
Beispiel #2
0
def buildGraph():
	"""
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
	global line, fig, plots

	# Initialize ax (subplot holder)
	ax = None

	# Create as many plots as we need to
	# TODO: Allow customization of view
	fig,ax = plt.subplots(nrows=len(plots), ncols=1, sharex=sharex, sharey=sharey)

	# Loop through our registered plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPacket, delayTime = getRows(plot["table"], age=plot["age"])

		# Move over our ax element. If only one registered plot, this will be ax itself, it more than one, it will be in a numpy array.
		# Make sure we're looking at a list
		if isinstance(ax,np.ndarray) == True:
			# Numpy won't let us pop. We'll grab the top, then remove it.
			plot["ax"] = ax[0]
			ax = np.delete(ax,0, axis=0)
		else:
			# This is the case where we're only plotting one thing. Just copy it over.
			plot["ax"] = ax

		# Plot our initial data points, saving the line object we will use later to update it for animations.
		# TODO: Allow customization here
		plot["line"] = plot["ax"].plot(timeStamps, delayTime, '-', linewidth=1)[0]

		# Format the background grid
		#ax.grid(color='r', linestyle='--', linewidth=1)
		# TODO: Allow customization here
		plot["ax"].grid(True, 'major')

		# Set our axis labels.
		plot["ax"].set_xlabel("time (local time)")
		plot["ax"].set_ylabel("round trip time (s)")

		# Set plot title based on plot parameters
		plot["ax"].set_title(plot["title"])

		# Add human fiendly times along the bottom
		addTimeTicks(timeStamps, plot["ax"])

	# Add the footer
	footer(plt)
Beispiel #3
0
def buildGraph():
    """
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
    global line, fig, plots

    # Initialize ax (subplot holder)
    ax = None

    # Generate our figure object
    fig = plt.figure()

    # Loop through our registered plots
    for plot in plots:

        # Create the pie chart plot for this pie chart
        plot["ax"] = plt.subplot2grid((gridx, gridy),
                                      (plot["locy"], plot["locx"]),
                                      aspect=1)

        # Grab our row information
        timeStamps, isDroppedPacket, delayTime = getRows(plot["table"],
                                                         age=plot["age"])

        # Plot our initial data points, saving the line object we will use later to update it for animations.
        # TODO: Allow customization here
        plot["ax"].pie([isDroppedPacket.count(0),
                        isDroppedPacket.count(1)], [0, 0.05],
                       ["Not Dropped", "Dropped"],
                       shadow=True,
                       autopct="%.0f%%",
                       startangle=45,
                       colors=[colorGood, colorBad])

        # Set plot title based on plot parameters
        plot["ax"].set_title(plot["title"])

    # Add the footer
    footer(plt)
Beispiel #4
0
def buildGraph():
	"""
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
	global line, fig, plots

	# Initialize ax (subplot holder)
	ax = None

	# Generate our figure object
	fig = plt.figure()

	# Loop through our registered plots
	for plot in plots:

		# Create the pie chart plot for this pie chart
		plot["ax"] = plt.subplot2grid((gridx,gridy), (plot["locy"],plot["locx"]), aspect=1)

		# Grab our row information
		timeStamps, isDroppedPacket, delayTime = getRows(plot["table"], age=plot["age"])

		# Plot our initial data points, saving the line object we will use later to update it for animations.
		# TODO: Allow customization here
		plot["ax"].pie([isDroppedPacket.count(0),isDroppedPacket.count(1)],[0,0.05],["Not Dropped","Dropped"], shadow=True, autopct="%.0f%%", startangle=45, colors=[colorGood,colorBad])

		# Set plot title based on plot parameters
		plot["ax"].set_title(plot["title"])

	# Add the footer
	footer(plt)