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

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

@rolandog

Description

@rolandog

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions