Skip to content
This repository has been archived by the owner on Apr 16, 2018. It is now read-only.

figsize does not work when exporting sagews plots to PDF #202

Open
rolandog opened this issue Sep 12, 2015 · 6 comments
Open

figsize does not work when exporting sagews plots to PDF #202

rolandog opened this issue Sep 12, 2015 · 6 comments

Comments

@rolandog
Copy link

Hi. I've been trying to export to PDF a Sage WorkSheet that has plots.

When exporting a Notebook to PDF, all plots are scaled to the width of the page (even if there is some vertical overflow when a narrow chart is plotted); I had read in the documentation that the default figsize is 4, so I figured since the charts all seem to occupy the width of the page, that a more reasonable size like 2 would occupy half as much. However, I haven't been able to make it work, and I think that this is a bug.

I tried prepending or appending sage.plot.graphics.Graphics.SHOW_OPTIONS['figsize'] = 2 as was specified in stack overflow about this very same issue, but the results were the same (as was also reported back then). The issue seems to be reported in track ticket #16212, but only as a lack of documentation and not as a problem in the behavior of the PDF export outcome.

Different examples, but same results:

x = var('x')
y_1 = x
y_2 = x^2
the_plot = plot(y_1, (x, 0, 1), fill = y_2, aspect_ratio = 1) + plot(y_2, (x, 0, 1))
the_plot.show(figsize = [2, 2])

I also tried different approaches, such as not using the show() method:

x = var('x')
y_1 = x
y_2 = x^2
the_plot = plot([y_1, y_2], (x, 0, 1), fill = y_2, aspect_ratio = 1, figsize = [2, 2])
the_plot

Or, even omitting the aspect_ratio attribute:

x = var('x')
y_1 = x
y_2 = x^2
the_plot = plot([y_1, y_2], (x, 0, 1), fill = y_2, figsize = [2, 2])
the_plot

The issue I encountered was not shown when displaying the equation in the Notebook in SageCloud (those were displayed properly, and scaled accordingly).

Any workarounds would be greatly appreciated, since I haven't been able to find any documentation to help me out, so far.

@williamstein
Copy link
Contributor

Hi,

Can you recreate this issue at https://github.com/sagemathinc/smc/issues, since we're not using this repo anymore.

Also, it's not a bug but the functionality you want simply isn't implemented. if you're interested in implementing it I can provide some guidance. Otherwise you'll have to wait until somebody gets to do it (or you could pay to have us make it a top priority if it is super important for you).

@rolandog
Copy link
Author

Can you recreate this issue at https://github.com/sagemathinc/smc/issues, since we're not using this repo anymore.

Will do!

Also, it's not a bug but the functionality you want simply isn't implemented.

I think it may qualify as a bug, if the aspect ratio of the chart is lower than that of 8.5:11 (or maybe 6.5:9 because of 1" margins?) (e.g, a tall image forced to fit to the width of the PDF, though I may have to recreate it and prove it has to be such a ratio).

if you're interested in implementing it I can provide some guidance. Otherwise you'll have to wait until somebody gets to do it (or you could pay to have us make it a top priority if it is super important for you).

I just recently started dabbling in Python, but I would really like to give it a try and see if I can help out!

@williamstein
Copy link
Contributor

What's your name on SageMathCloud so I can add you to a project for fixing this? (or the email address you registered using).

@rolandog
Copy link
Author

Hi William, I just recreated the bug, as you requested, in the smc repository. As for the username: I believe it is rolandog@gmail.com (I may have signed using Google).

@williamstein
Copy link
Contributor

I added you -- you can now open that project.

On Tue, Sep 15, 2015 at 1:05 PM, rolandog notifications@github.com wrote:

Hi William, I just recreated the bug, as you requested, in the smc
repository sagemathinc/cocalc#114. As for the
username: I believe it is rolandog@gmail.com (I may have signed using
Google).


Reply to this email directly or view it on GitHub
#202 (comment).

William (http://wstein.org)

@rolandog
Copy link
Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants