Skip to content
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

Support cticks #1368

Merged
merged 4 commits into from
Jul 19, 2024
Merged

Support cticks #1368

merged 4 commits into from
Jul 19, 2024

Conversation

ahuang11
Copy link
Collaborator

I tried very long time to get the matplotlib test to work, but couldn't :/

If I set hv.extension("matplotlib"), this works; but without that extension, it doesn't detect cbar weirdly.

import pandas as pd
import holoviews as hv
import hvplot.xarray
import numpy as np
import xarray as xr

backend = "matplotlib"
da2 = xr.DataArray(
    data=np.arange(27).reshape((3, 3, 3)),
    coords={"y": [0, 1, 2], "x": [0, 1, 2]},
    dims=["y", "x", "other"],
    name="test2",
)

plot = da2.isel(other=2).hvplot(cticks=[5, 10])
handles = hv.renderer(backend).get_plot(plot).handles
if backend == 'matplotlib':
    print(handles)
    assert handles["cbar"].get_ticks().tolist() == [5, 10]

@ahuang11 ahuang11 requested a review from maximlt July 11, 2024 17:17
hvplot/converter.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.44%. Comparing base (6c96c7e) to head (a145f55).
Report is 8 commits behind head on main.

Files Patch % Lines
hvplot/converter.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1368      +/-   ##
==========================================
+ Coverage   87.39%   88.44%   +1.04%     
==========================================
  Files          50       50              
  Lines        7490     7389     -101     
==========================================
- Hits         6546     6535      -11     
+ Misses        944      854      -90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ahuang11 ahuang11 requested a review from maximlt July 16, 2024 21:59
@@ -209,8 +209,8 @@ class HoloViewsConverter:
Axis labels for the x-axis, y-axis, and colorbar
xlim/ylim (default=None): tuple or list
Plot limits of the x- and y-axis
xticks/yticks (default=None): int or list
Ticks along x- and y-axis specified as an integer, list of
xticks/yticks/cticks (default=None): int or list
Copy link
Member

Choose a reason for hiding this comment

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

Minor update, reflecting the changes made to the Customization guide to the converter docstring.

@maximlt maximlt merged commit 4d295b7 into main Jul 19, 2024
8 checks passed
@maximlt maximlt deleted the add_cticks branch July 19, 2024 09:48
@philipc2 philipc2 mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants