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

Plotly: Enable specified contour values for ranges; warn otherwise #3757

Merged
merged 5 commits into from
Aug 25, 2021

Commits on Aug 20, 2021

  1. Plotly: Enable specified contour values for ranges; warn otherwise

    Plotly does not support arbitrary contour values, but can plot
    specific contours if they are an equally-spaced range.  This
    commit implements the plotting of contours if the `levels`
    keyword argument is passed an `AbstractRange`, or if a set
    of arbitrary values are passed.  In the latter case, however,
    since this is not supported by Plotly, a range based on the
    first and last values of the collection passed in is created
    and used to define the contours.  A warning is then issued to
    the user.
    
    Otherwise, any other types are assumed to be number-like and
    adjusted as previously.  Note that Plotly does not guarantee
    the exact number of contours will be used.
    
    This partly addresses JuliaPlots#3356.
    
    See plotly/plotly.js#4503 (Plotly issue
    tracking the ability to set arbitrary contours).
    anowacki committed Aug 20, 2021
    Configuration menu
    Copy the full SHA
    79ce34a View commit details
    Browse the repository at this point in the history
  2. Add tests for contour levels and the start of Plotly tests

    - Test that the `levels` keyword argument is correctly stored.
    - For the Plotly (and PlotlyJS) backend, test that `levels`
      is correctly converted to backend-specific settings.
    anowacki committed Aug 20, 2021
    Configuration menu
    Copy the full SHA
    f1c0c7e View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2021

  1. Remove mention of tuples from description of levels

    The `levels` keyword argument does not actually support
    values of type `NTuple{2,Integer}` despite the existing documentation,
    so remove the mention of this from `_arg_desc` and update the
    description of what `levels` means.
    anowacki committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    fbabf50 View commit details
    Browse the repository at this point in the history
  2. Plotly: Remove argument checking for levels

    Checking of the `levels` keyword argument will be moved out
    of individual backends' code, so we can assume that `levels`
    if present in `plotattributes` is either an `AbstractVector` or
    `Integer`.
    anowacki committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    33a7e12 View commit details
    Browse the repository at this point in the history
  3. Check contour levels has correct value for all backends

    This commit moves the check for the correctness of the `levels`
    keyword argument into `RecipesPipeline.preprocess_attributes!(::KW)`
    and calls the new function `check_contour_levels`, which in turn
    will throw an `ArgumentError` if the argument is not correct.
    
    To that end:
    - Remove the check for non-integer and non-vector values of
      `levels` from the PyPlot backend code, and
    - Add low-level tests for the new function and high-level tests
      for contour plots.
    anowacki committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    0b800ac View commit details
    Browse the repository at this point in the history