Best Python code snippet using autotest_python
graphing_utils.py
Source: graphing_utils.py
...231 # markers in the legend.232 for line in legend.get_lines():233 line.set_marker(_LEGEND_MARKER_TYPE)234 return (figure, area_data)235def _get_adjusted_bar(x, bar_width, series_index, num_plots):236 """\237 Adjust the list 'x' to take the multiple series into account. Each series238 should be shifted such that the middle series lies at the appropriate x-axis239 tick with the other bars around it. For example, if we had four series240 (i.e. four bars per x value), we want to shift the left edges of the bars as241 such:242 Bar 1: -2 * width243 Bar 2: -width244 Bar 3: none245 Bar 4: width246 """247 adjust = (-0.5 * num_plots - 1 + series_index) * bar_width248 return [x_val + adjust for x_val in x]249# TODO(showard): merge much of this function with _create_line by extracting and250# parameterizing methods251def _create_bar(plots, labels, plot_info):252 """\253 Given all the data for the metrics, create a line plot.254 plots: list of dicts containing the plot data.255 x: list of x-values for the plot256 y: list of corresponding y-values257 errors: errors for each data point, or None if no error information258 available259 label: plot title260 labels: list of x-tick labels261 plot_info: a MetricsPlot262 """263 area_data = []264 bars = []265 figure, height = _create_figure(_SINGLE_PLOT_HEIGHT)266 # Set up the plot267 subplot = figure.add_subplot(1, 1, 1)268 subplot.set_xticks(range(0, len(labels)))269 subplot.set_xlim(-1, len(labels))270 subplot.set_xticklabels(labels, rotation=90, size=_BAR_XTICK_LABELS_SIZE)271 # draw a bold line at y=0, making it easier to tell if bars are dipping272 # below the axis or not.273 subplot.axhline(linewidth=2, color='black')274 # width here is the width for each bar in the plot. Matplotlib default is275 # 0.8.276 width = 0.8 / len(plots)277 # Plot the data278 for plot_index, (plot, color) in enumerate(zip(plots, _colors(len(plots)))):279 # Invert the y-axis if needed280 if plot['label'] in plot_info.inverted_series:281 plot['y'] = [-y for y in plot['y']]282 adjusted_x = _get_adjusted_bar(plot['x'], width, plot_index + 1,283 len(plots))284 bar_data = subplot.bar(adjusted_x, plot['y'],285 width=width, yerr=plot['errors'],286 facecolor=color,287 label=plot['label'])288 bars.append(bar_data[0])289 # Construct the information for the drilldowns.290 # See comment in _create_line for why we need a separate loop to do this.291 for plot_index, plot in enumerate(plots):292 adjusted_x = _get_adjusted_bar(plot['x'], width, plot_index + 1,293 len(plots))294 # Let matplotlib plot the data, so that we can get the data-to-image295 # coordinate transforms296 line = subplot.plot(adjusted_x, plot['y'], linestyle='None')[0]297 label = plot['label']298 upper_left_coords = line.get_transform().transform(zip(adjusted_x,299 plot['y']))300 bottom_right_coords = line.get_transform().transform(301 [(x + width, 0) for x in adjusted_x])302 # Get the drilldown query303 drill = plot_info.query_dict['__' + label + '__']304 # Set the title attributes305 x_labels = [labels[x] for x in plot['x']]306 titles = ['%s - %s: %f' % (plot['label'], label, y)...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!