Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Histogram missing in Matplotlib 2.1.0 #9628

Closed
@abcdabcd987

Description

@abcdabcd987

Bug report

Bug summary

Histogram missing in Matplotlib 2.1.0. See the following figures, one is from 2.1.0 and the other is from 2.0.2.

Code for reproduction

This code is exactly the same code we are using except the data is changed to random one. I suppose it will be minimal enough?

#!/usr/bin/env python3importnumpyasnpimportmatplotlibimportmatplotlib.pyplotaspltimportmatplotlib.tickerastickerimportcollectionsdefplot_figure(distribution):percentile= [95,99]percentile_color='yg'mean_color='c'bins=100legend_handle= []legend_title= []fig, (ax0,ax1)=plt.subplots(2,sharex=True)fig.subplots_adjust(hspace=0)mu,sigma=100,15xs_downstream=mu+sigma*np.random.randn(10000)xs_upstream=mu+sigma*np.random.randn(10000)xmin=min(np.min(xs_downstream),np.min(xs_upstream))xmax=max(np.max(xs_downstream),np.max(xs_upstream))hist0=ax0.hist(xs_downstream,bins=bins,range=(xmin,xmax),color='red',label='{} workload with Proxy'.format(distribution.capitalize()))handles,labels=ax0.get_legend_handles_labels()line=ax0.axvline(x=np.mean(xs_downstream),color=mean_color,linewidth=1)legend_title.append('Mean')legend_handle.append(line)forpercent,colorinzip(percentile,percentile_color):line=ax0.axvline(x=xs_downstream[int(percent/100*len(xs_downstream))],color=color,linewidth=1)legend_title.append('{}th percentile'.format(percent))legend_handle.append(line)ax0.set_yscale('log')legend_title+=labelslegend_handle+=handleshist1=ax1.hist(xs_upstream,bins=bins,range=(xmin,xmax),color='blue',label='{} workload without Proxy'.format(distribution.capitalize()))handles,labels=ax1.get_legend_handles_labels()legend_title+=labelslegend_handle+=handlesax1.axvline(x=np.mean(xs_upstream),color=mean_color,linewidth=1)forpercent,colorinzip(percentile,percentile_color):ax1.axvline(x=xs_upstream[int(percent/100*len(xs_upstream))],color=color,linewidth=1)ax1.set_yscale('log')ax0.legend(legend_handle,legend_title)ax1.set_xlabel('latency (ms)')fig.savefig('latency-{}.pdf'.format(distribution))defmain():plot_figure('zipf')plot_figure('uniform')if__name__=='__main__':main()

Actual outcome

qq20171030-095657 2x

Expected outcome

qq20171030-095722 2x

Works well in 2.0.2.

Matplotlib version

  • Operating system: Both macOS High Sierra and Ubuntu 17.10
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())):MacOSX
  • Python version:3.6.3
  • Jupyter version (if applicable):
  • Other libraries:

Installed usingpip3

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp