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

Add plot style guides back #5919

Merged
merged 12 commits into from Nov 29, 2023
Merged

Add plot style guides back #5919

merged 12 commits into from Nov 29, 2023

Conversation

MarcSkovMadsen
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen commented Nov 25, 2023

Closes #5002

The guides for styling altair, matplotlib, plotly and vega were lost when upgrading to Panel 1.0.

This adds the key material back as markdown files.

Todo

  • Get Review
  • Philipp should upload and replace assets.
  • Build docs and test this will work with pyodide. Can be done after merge.

Assets

Its probably better to download from the links in the markdown files than these.

altair-logo
echarts-logo
matplotlib-logo
plotly-logo
vega-logo

ECharts Styles

echarts-styles

echarts-styles.mp4

Created using

import panel as pn

THEME = "default"

ECHARTS_THEMES = {
    "infographic": "https://fastly.jsdelivr.net/npm/echarts/theme/infographic.js?_v_=20200710_1",
    "macarons": "https://fastly.jsdelivr.net/npm/echarts/theme/macarons.js?_v_=20200710_1",
    "roma": "https://fastly.jsdelivr.net/npm/echarts/theme/roma.js?_v_=20200710_1",
    "shine": "https://fastly.jsdelivr.net/npm/echarts/theme/shine.js?_v_=20200710_1",
    "vintage": "https://fastly.jsdelivr.net/npm/echarts/theme/vintage.js?_v_=20200710_1",
}

pn.pane.ECharts.param.theme.objects = pn.pane.ECharts.param.theme.objects + list(
    ECHARTS_THEMES
)

pn.extension("echarts", js_files=ECHARTS_THEMES)

echart_bar = {
    "title": {"text": "ECharts Example"},
    "tooltip": {},
    "legend": {"data": ["Sales"]},
    "xAxis": {"data": ["shirt", "cardign", "chiffon shirt", "pants", "heels", "socks"]},
    "yAxis": {},
    "series": [{"name": "Sales", "type": "bar", "data": [5, 20, 36, 10, 10, 20]}],
}

plot = pn.pane.ECharts(
    echart_bar,
    height=500,
    sizing_mode="stretch_width",
    theme=THEME,
)
component=pn.Column(plot.param.theme, plot, sizing_mode="stretch_width")
pn.template.FastListTemplate(
    logo="https://panel.holoviz.org/_static/logo_horizontal_dark_theme.png",
    title="ECharts Themes", accent="black",
    main=[component], main_layout=None,
).servable()

Copy link

codecov bot commented Nov 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e3fdd48) 84.15% compared to head (95669c6) 84.20%.
Report is 11 commits behind head on main.

❗ Current head 95669c6 differs from pull request most recent head e809499. Consider uploading reports for the commit e809499 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5919      +/-   ##
==========================================
+ Coverage   84.15%   84.20%   +0.04%     
==========================================
  Files         291      291              
  Lines       42786    42907     +121     
==========================================
+ Hits        36007    36128     +121     
  Misses       6779     6779              
Flag Coverage Δ
ui-tests 40.84% <0.00%> (-0.09%) ⬇️
unitexamples-tests 72.50% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@@ -0,0 +1,56 @@
# Style Altair Plots

This guide addresses how to style Altair plots displayed using the [Vega pane](../../../examples/reference/panes/Vega.ipynb).
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please check if this will work when rendered for all the .md files.

I have not been able to find links from docs to reference guides in the existing documentation, so I don't know if this will work.

doc/how_to/styling/index.md Outdated Show resolved Hide resolved
panel/models/echarts.ts Outdated Show resolved Hide resolved
panel/models/echarts.py Show resolved Hide resolved
panel/models/echarts.ts Outdated Show resolved Hide resolved
@philippjfr
Copy link
Member

Docs are building now.

@philippjfr
Copy link
Member

Issues

  • Altair
    • Reference doc link does not work (should drop the .ipynb extension)
    • Plot has zero height (height="container" will not work here unless the container has height)
  • ECharts
    • GIF missing
  • Matplotlib
    • Plot has no height (scale_height is not appropriate here)
  • Vega
    • Plot has zero height (height="container" will not work here unless the container has height)

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Nov 27, 2023

Extra Issue

  • Logo Files not used on index page for ECharts, Matplotlib and Plotly.

image

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Nov 27, 2023

I'll try to fix the issues I can fix now.

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Nov 27, 2023

I can see that the issue with the logos is that when the documentation is built it no longer uses the relative paths to images. It puts them all into an _images folder. I think this could cause lots of issues @philippjfr .

For now I will rename the logo images be appending a -logo to the name.

@MarcSkovMadsen
Copy link
Collaborator Author

I've started a new docs build in https://github.com/holoviz/panel/actions/runs/7009397100

@philippjfr
Copy link
Member

I can see that the issue with the logos is that when the documentation is built it no longer uses the relative paths to images. It puts them all into an _images folder. I think this could cause lots of issues @philippjfr .

Indeed, this is default Sphinx behavior I think, will see if we can override that.

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Nov 27, 2023

Issues

[x] The logos will need some comenality too

image

@MarcSkovMadsen
Copy link
Collaborator Author

Restarted docs build. Expect the Echarts missing gif to be only issue outstanding.

@MarcSkovMadsen
Copy link
Collaborator Author

All issues solved except the ECharts gif is missing. Will leave that for you @philippjfr .

@philippjfr philippjfr merged commit df64dd4 into main Nov 29, 2023
11 of 12 checks passed
@philippjfr philippjfr deleted the enhancement/add-pane-styling branch November 29, 2023 14:29
@philippjfr philippjfr modified the milestones: v1.4.0, v1.3.3 Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotting styling guides are gone
2 participants