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

[Bug]: LogLocator with subs argument fragile. #24092

Closed
Labels
Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!topic: ticks axis labels
Milestone
@peterdsharpe

Description

@peterdsharpe

Bug summary

Logarithmic tick markers do not appear if the y-axis scales a sufficient range, with thesubs keyword argument ofticker.LogLocator set to non-trivial values.

Code for reproduction

importmatplotlib.pyplotaspltimportmatplotlib.tickerimportnumpyasnpll=matplotlib.ticker.LogLocator(subs=(1,2,5))### The following code produces a plot with y-axis ticks at the expected locations.fig,ax=plt.subplots()x=np.arange(8)plt.semilogy(x,10**x)ax.yaxis.set_major_locator(ll)ax.yaxis.set_minor_locator(ll)plt.title("Good Plot")plt.show()### The following code produces a plot with no y-axis ticks, which is unexpected and undesired.fig,ax=plt.subplots()x=np.arange(9)# The only change is this lineplt.semilogy(x,10**x)ax.yaxis.set_major_locator(ll)ax.yaxis.set_minor_locator(ll)plt.title("Bad Plot")plt.show()### The problem is isolated to here, which returns correct values in the first case, but np.array([]) in the second case:print(ll.tick_values(1,1e7))print(ll.tick_values(1,1e8))

Actual outcome

image

image

Expected outcome

I expect to see ticks in both cases, as appears in the "Good Plot".

Additional information

The problem is isolated toticker.LogLocator.tick_values(). This returns correct values in the first case (e.g.,np.array([1.e-01 2.e-01 5.e-01 1.e+00 2.e+00 5.e+00 1.e+01 2.e+01 5.e+01 1.e+02 2.e+02 5.e+02])), butnp.array([]) in the second case.

Operating system

Windows

Matplotlib Version

3.5.2

Matplotlib Backend

module://backend_interagg

Python version

3.9.13

Jupyter version

No response

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!topic: ticks axis labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp