Python matplotlib.legend() Examples
The following are 5
code examples of matplotlib.legend().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib
, or try the search function
.
Example #1
Source File: _base.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def get_legend(self): """Return the `Legend` instance, or None if no legend is defined.""" return self.legend_
Example #2
Source File: _base.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_legend(self): """Return the `Legend` instance, or None if no legend is defined.""" return self.legend_
Example #3
Source File: _base.py From coffeegrindsize with MIT License | 5 votes |
def get_legend(self): """Return the `Legend` instance, or None if no legend is defined.""" return self.legend_
Example #4
Source File: _base.py From twitter-stock-recommendation with MIT License | 5 votes |
def get_legend(self): """Return the `Legend` instance, or None if no legend is defined.""" return self.legend_
Example #5
Source File: plot.py From faster-rcnn-scenarios with MIT License | 4 votes |
def plot_chart(log_file, path_to_png, mode=PLOT_MODE.NORMAL): mean_ap=0 phases, detected_mean_ap = parse_log(log_file) if detected_mean_ap != None: mean_ap=detected_mean_ap print "Processing %s with mAP=%f" % (path_to_png, mean_ap) plt.figure(1, figsize=(8, 32)) end_phase=min(len(phases), 4) for phase_idx in range(0,end_phase): phase=np.array(phases[phase_idx]) plt.subplot(411+phase_idx) label = LABELS[phase_idx] plt.title("%s%s"%( "mAP = %f "%mean_ap if phase_idx == 0 else "",str(label[phase_idx]))) for x_label,y_label in FIELDS[phase_idx]: ## TODO: more systematic color cycle for lines color = [random.random(), random.random(), random.random()] linewidth = 0.75 ## If there too many datapoints, do not use marker. ## use_marker = False use_marker = True # if (mode==PLOT_MODE.MOVING_AVG): x_data = [row[x_label] for row in phase] y_data = [row[y_label] for row in phase] if mode==PLOT_MODE.MOVING_AVG: y_data=moving_average(y_data, 100) elif mode == PLOT_MODE.BOTH: marker = random_marker() plt.plot(x_data, y_data, label=label, color=color, marker=marker, linewidth=linewidth) color = [random.random(), random.random(), random.random()] y_data = moving_average(y_data, 100) if not use_marker: plt.plot(x_data, y_data, label = label, color = color, linewidth = linewidth) else: marker = random_marker() plt.plot(x_data, y_data, label = label, color = color, marker = marker, linewidth = linewidth) #legend_loc = get_legend_loc(chart_type) #plt.legend(loc = legend_loc, ncol = 1) # ajust ncol to fit the space #plt.xlabel(x_axis_field) #plt.ylabel(y_axis_field) # plt.annotate(fontsize='xx-small') print "Saving...", plt.savefig(path_to_png, dpi=600) print "done" plt.show()