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

colorbar labelling bug (1.5 regression) #5673

Closed
Assignees
efiring
Milestone
@jswhit

Description

@jswhit

This is 1.5 regression, the following test script works in 1.4.3.

The bug only occurs when using a custom colormap.

import matplotlib.pyplot as pltimport numpy as npfrom matplotlib import mlab, cm, colors# make up fake data.delta = 0.5x = np.arange(-3.0, 4.001, delta)y = np.arange(-4.0, 3.001, delta)X, Y = np.meshgrid(x, y)Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)Z = (Z1 - Z2) * 20000 ; Z -= Z.min(); Z *= 0.5# levels to contourclevs = [0,2,5,10,20,50,100,300,500,700,1000,1500,2000,2500,3000,3500]# contour data, make colorbarfig = plt.figure(figsize=(9.,6.3))colorst =\['White','#E4FFFF','#C4E8FF','#8FB3FF','#D8F9D8','#A6ECA6','#42F742','Yellow','Gold',\ 'Orange','#FCD5D9','#F6A3AE','#FA5257','Orchid','#AD8ADB','#A449FF','LightGray']custom_cm = colors.ListedColormap(colorst, name='colorst', N=None)ax = fig.add_axes([0.03,.12,0.94,.83])cs = plt.contourf(X, Y, Z, clevs, colors=colorst)cax = fig.add_axes([0.1,0.05,0.8,0.03])cbar = fig.colorbar(cs,extend='neither', \      orientation='horizontal',cax=cax,drawedges=True,ticks=clevs)plt.show()

The resulting image

colorbar_bug

does not show all the colorbar labels.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp