Skip to content

Added option for an offset for MultipleLocator #21168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

jondoesntgit
Copy link
Contributor

PR Summary

Allows for an optional kwarg offset to be passed to MultipleLocator. For example, allows ticks to be placed at (.5, 1.5, 2.5, 3.5) with MultipleLocator(base=1, offset=.5).

PR Checklist

I cannot get matplotlib to build locally.

$ python setup.py install
[...]
In file included from src/py_converters.cpp:3:
In file included from src/py_converters.h:17:
src/_backend_agg_basic_types.h:7:10: fatal error: 'vector' file not found
#include <vector>
         ^~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(matplotlib-env)

Once I can build, I can finish the other check marks in your checklist:

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Other questions:

  • Which branch should I try to merge into? I'm assuming it's not master. Is 3.5.x the right target?

story645 and others added 30 commits August 26, 2021 23:06
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Fixes matplotlib#20516

PGF's `random steps` decoration seems to be the most similar,
but does not exactly match the behaviour described in matplotlib's docs.
Therefore I repurposed the `randomness` argument as a seed to give
control on how the line looks afterwards.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Switch documented deprecations in mathtext by `__getattr__` deprecations
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
…_output

API: rename draw_no_output to draw_without_rendering
Make warning for no-handles legend more explicit.
Remove unused HostAxes._get_legend_handles.
- parse() already normalizes prop=None to prop=FontProperties().
- We don't need to explicitly attach a canvas to a plain Figure() before
  calling savefig() anymore; FigureCanvasBase is always attached and
  handles the dispatching to the correct concrete canvas class.
According to the docs, this function was added in GTK 2.2, so probably
was only needed when we supported GTK2.

It also no longer exists in GTK4.
Since these examples don't need to support the very oldest GTK3, I took
the opportunity to rewrite them using the recommended Application-styled
model.
timhoffm and others added 17 commits September 22, 2021 13:41
Fix DATA_PARAMETER_PLACEHOLDER interpolation for quiver&contour{,f}.
... and small local cleanups.
- Use finite differences to estimate derivative rather than splines
  (which are conceptually much more complicated).
- Include a "constant error" case, which shows that the band does have
  constant width in that case.
- Force the axes aspect to 1 (so that constant width actually appears
  constant).
- Use np.full() to set up the codes array.
The pixel-sized marker previously use (",") was so small that it looked
more like a rendering artefact than an actual data point.
DOC: Increase marker size in double_pendulum example.
DOC: Improve curve_error_band example.
DOC: Docstring cleanups around DATA_PARAMETER_PLACEHOLDER.
MNT: Simplify argument parsing in stem().
There is no need to generate a regular grid and statistically choose
points from that. Instead, we can immediately choose random points.
Add conda environment.yml for developers
Co-authored-by: hannah <story645@gmail.com>
More (minor) plot types gallery fixes.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@jklymak jklymak marked this pull request as draft October 12, 2021 12:55
@jklymak
Copy link
Member

jklymak commented Oct 12, 2021

I moved to draft. Let us know if you still cannot build locally. There are quite a few of us using apple and I don't recall any (recent) issues building. Though there was something about clang versus cpp at some point, the solution to which you may be able to find in old issues.

@jondoesntgit
Copy link
Contributor Author

jondoesntgit commented Oct 13, 2021 via email

@tacaswell
Copy link
Member

This PR is affected by a re-writing of our history to remove a large number of accidentally committed files see discourse for details.

To recover this PR it will need be rebased onto the new default branch (main). There are several ways to accomplish this, but we recommend (assuming that you call the matplotlib/matplotlib remote "upstream"

git remote update
git checkout main
git merge --ff-only upstream/main
git checkout YOUR_BRANCH
git rebase --onto=main upstream/old_master
# git rebase -i main # if you prefer
git push --force-with-lease   # assuming you are tracking your branch

If you do not feel comfortable doing this or need any help please reach out to any of the Matplotlib developers. We can either help you with the process or do it for you.

Thank you for your contributions to Matplotlib and sorry for the inconvenience.

@jondoesntgit
Copy link
Contributor Author

Thanks @tacaswell @jklymak,

The PR only changes three lines of code (should take 30 seconds for someone who already has a dev install of matplotlib). I can try rebasing, but it will take me a lot longer than 30 seconds to figure everything out.

You can see the three simple changes here: ba6aeff

Jonathan

@rcomer
Copy link
Member

rcomer commented Mar 24, 2023

This seems like a useful thing to have, so I have picked it up in #25542. I think we can close this one now. Thank you for your work and for providing clear directions to the relevant commit @jondoesntgit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.