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

Ease setting figure dimensions in-line #29

Open
hugetim opened this issue Aug 29, 2023 Discussed in #24 · 3 comments
Open

Ease setting figure dimensions in-line #29

hugetim opened this issue Aug 29, 2023 Discussed in #24 · 3 comments
Labels
enhancement New feature or request

Comments

@hugetim
Copy link
Owner

hugetim commented Aug 29, 2023

Use literal "default"s for pystata.config.set_graph_size for nbstata's default. This will probably require a breaking change to the API, but it's worth it.

Discussed in #24

Originally posted by friosavila May 11, 2023
Hi Tim
I was wondering if there is anyway to modify how nbstata works regarding figures.
I know that currently, you can change the setup if you would like to obtain larger or smaller figures to be output in jupyter notebook.
However, would it be possible to use information from "xsize() and ysize()" to be used to change those settings in a more dynamic way?

Thank you!

@hugetim
Copy link
Owner Author

hugetim commented Aug 29, 2023

This change (for version 1.0) will follow pystata's API more closely, in the sense that if you only set one dimension (at a time), the other dimension is also updated, using the default aspect ratio.

In other words,
%set graph_width = 3
followed by
%set graph_height = 3
will give you a different result than specifying both together:

%%
set graph_width = 3
set graph_height = 3

which will be the only way to get a square aspect ratio.

@hugetim
Copy link
Owner Author

hugetim commented Sep 1, 2023

For now (version 0.x), there's a workaround:

%%set
graph_width = default
graph_height = default

Or, if you want it to not cause errors when exported to a do file:

*%%set
/*
graph_width = default
graph_height = default
*/

Or, equivalently, add these lines to the config file:

graph_width = default
graph_height = default

hugetim added a commit that referenced this issue Sep 1, 2023
@riosavila
Copy link

Thank you! This now works like a charm!

@hugetim hugetim added the enhancement New feature or request label Sep 13, 2023
@hugetim hugetim changed the title Enable setting figure dimensions in-line Ease setting figure dimensions in-line Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants