nc-time-axis icon indicating copy to clipboard operation
nc-time-axis copied to clipboard

Add support for ax.locator_params()

Open sjsmith757 opened this issue 2 years ago • 4 comments

🚀 Pull Request

Description

Added the set_params method to the NetCDFTimeDateLocator class to support updating the number of ticks after the nc-time-axis is created. This allows for the locator parameters of the underlying AutoLocator to be modified. A full list of available parameters is here.

This can be done using plt.locator_params(axis='x') as the simplest or plt.gca().xaxis.get_major_locator().set_params() as a more fine-tuned alternative, assuming the time axis is the x axis.

Fixes SciTools/nc-time-axis#20

sjsmith757 avatar Apr 05 '23 16:04 sjsmith757

Codecov Report

Patch coverage: 25.00% and project coverage change: -1.32 :warning:

Comparison is base (7e9acbd) 93.10% compared to head (84310b1) 91.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
- Coverage   93.10%   91.78%   -1.32%     
==========================================
  Files           1        1              
  Lines         203      207       +4     
  Branches       47       47              
==========================================
+ Hits          189      190       +1     
- Misses          7       10       +3     
  Partials        7        7              
Impacted Files Coverage Δ
nc_time_axis/__init__.py 91.78% <25.00%> (-1.32%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Apr 05 '23 16:04 codecov-commenter

Nice, thanks @sjsmith757 -- to eventually merge this we'll probably want to add a test or two of this new functionality. No worries though if you're too busy to look into that at the moment.

spencerkclark avatar Apr 17 '23 23:04 spencerkclark

Hi @spencerkclark - I've added some unit tests for my new method, as well as one integration test to ensure users can call it simply using the pyplot interface and that the functionality works in the larger context. I think using the plt.locator_params() syntax is the optimal case for end users, so I didn't include a docstring for the new method (it's essentially just a pass-through method anyways). Let me know if you need anything else for this enhancement!

sjsmith757 avatar Jun 28 '23 19:06 sjsmith757

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 08 '24 16:04 CLAassistant