-
-
Notifications
You must be signed in to change notification settings - Fork 111
Document the size and layout options #1545
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
doc/ref/plot_options/size.ipynb:12
- [nitpick] Consider standardizing the capitalization for consistency; the notebook header uses 'Size and Layout Options' while this directive uses 'Size And Layout Options'.
.. plotting-options-table:: Size And Layout Options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few quick questions on the options:
- Should fontsize and fontscale be in the same option group?
- Should aspect and data_aspect be in this size and layout group?
"source": [ | ||
"## `frame_width / frame_height`\n", | ||
"\n", | ||
"The `frame_width` and `frame_height` options determine the width and height of the data area within the plot. They define the size of the plot’s core region (excluding axes, legends, and margins), allowing precise control over how the data is displayed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool, I had never really thought about this (or forgot!). Like in HoloViews docs, it could be nice to show two plots with frame_height/width set, one without a legend or colorbar and one with, to see the inner plots have the same dimension.
"import hvplot.xarray # noqa\n", | ||
"import hvsampledata\n", | ||
"\n", | ||
"df = hvsampledata.air_temperature(\"xarray\")\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pick just one timestamp to avoid the non-interactive widgets.
"import hvplot.xarray # noqa\n", | ||
"import hvsampledata\n", | ||
"\n", | ||
"df = hvsampledata.air_temperature(\"xarray\")\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pick just one timestamp to avoid the non-interactive widgets.
"import hvplot.xarray # noqa\n", | ||
"import hvsampledata\n", | ||
"\n", | ||
"df = hvsampledata.air_temperature(\"xarray\")\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pick just one timestamp to avoid the non-interactive widgets.
"source": [ | ||
"## `padding`\n", | ||
"\n", | ||
"The `padding` option expands the plot’s automatically computed axis limits by a given fraction. When hvPlot determines the x and y ranges based on your data, it finds the minimum and maximum values needed to display all points. With padding applied, these ranges are extended by the specified fraction so that data points near the edges have more space. The padding value can be given as a single number for uniform padding, a tuple to specify different padding for the x- and y-axes, or even a nested tuple to set distinct padding for the upper and lower bounds of each axis." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's a good idea to set tiles=True
in this example (the axes are distributed differently). Might be best to use a simpler dummy and more geometric dataset in this case.
Something like this maybe:
import pandas as pd
df = pd.DataFrame({'x': [0, 1, 0, -1], 'y': [-1, 0, 1, 0]})
df.hvplot.scatter(x='x', y='y', padding=(0.5, 0.1))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the file be named size_and_layout
?
fixes #1544
This PR adds the Size and Layout options to the reference docs.