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

Fix cannot apply both size and shape to points in a plot-by series #3402

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

jnumainville
Copy link
Contributor

Fixes #3323

Verified by running the code from the issue above:

from deephaven import empty_table
from deephaven.plot import Figure
import math

math_funcs = ["sin", "cos"]
shapes = ["SQUARE", "CIRCLE", "UP_TRIANGLE", "DOWN_TRIANGLE", "RIGHT_TRIANGLE", "LEFT_TRIANGLE", "DIAMOND"]
size = 50
# Unsupported shapes: ["ELLIPSE", "HORIZONTAL_RECTANGLE", "VERTICAL_RECTANGLE"]

# Create a generic table that has enough columns to display all the shapes
# Re-uses some of the funcs
t = empty_table(size).update([f"name=`` + shapes[(int)Math.floor(i / Math.ceil(size / {len(shapes)}))]", "x=i*0.1"])
for i in range(len(shapes)):
    t = t.update([f"y{i}=Math.{math_funcs[i % len(math_funcs)]}(x+{math.floor(i / len(math_funcs))})"])

# Create a plot by figure
p2 = Figure().plot_xy(series_name="Multi", t=t, by=["name"], x="x", y="y1").line(visible=True)
for i in range(len(shapes)):
    # apply both shapes and sizes to points
    p2 = p2.point(shape=shapes[i], multi_series_key=[shapes[i]], size=len(shapes) - i, visible=True)
p2 = p2.show()

With the following graph as an output:
Screenshot 2023-02-02 at 2 47 05 PM

The different series have different shapes and sizes, as expected.

@jnumainville jnumainville added the bug Something isn't working label Feb 2, 2023
@jnumainville jnumainville self-assigned this Feb 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@jnumainville
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

…gureAPI.java

Co-authored-by: Mike Bender <mikebender@deephaven.io>
mofojed
mofojed previously approved these changes Feb 3, 2023
jmao-denver
jmao-denver previously approved these changes Feb 3, 2023
Copy link
Contributor

@jmao-denver jmao-denver left a comment

Choose a reason for hiding this comment

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

The change does make the code a little harder to follow but I don't see a clearly better alternative.

@jnumainville jnumainville merged commit 227eb5e into deephaven:main Feb 10, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working NoDocumentationNeeded NoReleaseNotesNeeded No release notes are needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python: Cannot apply both size and shape to points in a plot-by series
4 participants