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

Figure().figure_title() does not render a title in the IDE or in Jupyter #1674

Closed
alexpeters1208 opened this issue Nov 29, 2023 · 1 comment · Fixed by #1676
Closed

Figure().figure_title() does not render a title in the IDE or in Jupyter #1674

alexpeters1208 opened this issue Nov 29, 2023 · 1 comment · Fixed by #1676
Assignees
Labels
bug Something isn't working web-client-ui

Comments

@alexpeters1208
Copy link

Description

When creating a plot in the IDE or Jupyter with the Figure() function, using the .figure_title() method does not render a title.

Steps to reproduce

Go to the IDE and run this code:

from deephaven import read_csv
from deephaven.plot.figure import Figure

# source the data
source = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/MetricCentury/csv/metriccentury.csv")

# plot the data
plot_single = Figure().\
    plot_xy(series_name="Distance", t=source.where(filters=["SpeedKPH > 0"]), x="Time", y="DistanceMeters").\
    figure_title("Title").\
    show()

Expected results

I expect the rendered plot to have a title.

Actual results

The rendered plot does not have a title.

Versions

  • Deephaven: 0.31.0
  • Browser: Safari
@alexpeters1208 alexpeters1208 added bug Something isn't working web-client-ui triage Issue requires triage labels Nov 29, 2023
@mofojed mofojed transferred this issue from deephaven/deephaven-core Dec 7, 2023
@mofojed mofojed removed the triage Issue requires triage label Dec 7, 2023
@mofojed
Copy link
Member

mofojed commented Dec 7, 2023

Fix for this is simple enough - for some reason Web UI was pulling from the first chart title set, rather than the figure title that was set.

mofojed added a commit that referenced this issue Dec 19, 2023
…1676)

- Previously for some reason we were mapping the first subplot chart
title to the figure title, which was incorrect. Instead map the Figure
title attribute to the figure, and then chart title to the individual
subplots
- Annoyingly plotly doesn't have a chart title property, so we need to
map these titles to `annotations` to get it to work correctly
- Fixes #1674 , Fixes #1675 
- Tested with the following snippet:
```
from deephaven.plot.figure import Figure
from deephaven import read_csv

insurance = read_csv("https://media.githubusercontent.com/media/deephaven/examples/main/Insurance/csv/insurance.csv")

insurance_by_region = insurance.view(formulas=["region", "expenses"]).avg_by(["region"])
insurance_by_sex = insurance.view(formulas=["sex", "expenses"]).avg_by(["sex"])
insurance_by_children = insurance.view(formulas=["children", "expenses"]).avg_by(["children"]).sort(order_by=["children"])
insurance_by_smoker = insurance.view(["smoker", "expenses"]).avg_by(["smoker"])

insurance_cat_plots = Figure(rows=2, cols=2).\
    new_chart(row=0, col=0).\
    plot_cat(series_name="Region", t=insurance_by_region, category="region", y="expenses").\
    chart_title(title="Average charge ($) by region").\
    new_chart(row=0, col=1).\
    plot_cat(series_name="Sex", t=insurance_by_sex, category="sex", y="expenses").\
    chart_title(title="Average charge ($) by sex").\
    new_chart(row=1, col=0).\
    plot_cat(series_name="Children", t=insurance_by_children, category="children", y="expenses").\
    chart_title(title="Average charge ($) per number of children").\
    new_chart(row=1, col=1).\
    plot_cat(series_name="Smoker", t=insurance_by_smoker, category="smoker", y="expenses").\
    chart_title(title="Average charge ($) smokers vs nonsmokers").\
    chart_legend(visible=False).\
    figure_title("Figure Title").\
    show()
```


![image](https://github.com/deephaven/web-client-ui/assets/4505624/f9a6f7fc-3110-492a-8d57-1d49616ce387)
mofojed added a commit to deephaven/deephaven-core that referenced this issue Dec 22, 2023
Release notes https://github.com/deephaven/web-client-ui/releases/tag/v0.58.0

### Bug Fixes

* `figure_title` and `chart_title` were not mapped up correctly ([#1676](deephaven/web-client-ui#1676)) ([73e0b65](deephaven/web-client-ui@73e0b65)), closes [#1674](deephaven/web-client-ui#1674) [#1675](deephaven/web-client-ui#1675)


### Features

* "Group" column for rollup/tree tables ([#1636](deephaven/web-client-ui#1636)) ([ba1d51b](deephaven/web-client-ui@ba1d51b)), closes [#1555](deephaven/web-client-ui#1555)
* Add alt+click shortcut to copy cell and column headers ([#1694](deephaven/web-client-ui#1694)) ([4a8a81a](deephaven/web-client-ui@4a8a81a)), closes [deephaven/web-client-ui#1585](deephaven/web-client-ui#1585)
* Theming - Spectrum variable mapping and light theme ([#1680](deephaven/web-client-ui#1680)) ([2278697](deephaven/web-client-ui@2278697)), closes [#1669](deephaven/web-client-ui#1669) [#1539](deephaven/web-client-ui#1539)




---------

Co-authored-by: deephaven-internal <deephaven-internal@users.noreply.github.com>
Co-authored-by: mikebender <mikebender@deephaven.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working web-client-ui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants