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

rgbcolor bug bites pdfs, casting to int solves it #4146

Closed
sagetrac-mhampton mannequin opened this issue Sep 18, 2008 · 1 comment
Closed

rgbcolor bug bites pdfs, casting to int solves it #4146

sagetrac-mhampton mannequin opened this issue Sep 18, 2008 · 1 comment

Comments

@sagetrac-mhampton
Copy link
Mannequin

sagetrac-mhampton mannequin commented Sep 18, 2008

Colored text breaks pdf saves. PNG saves and show() work fine.

It seems to be fixed by forcing the rgbcolor into ints, i.e. rgbcolor = (int(1),int(0),int(0)) works fine.

Here's an example:

t1 = text('Hi, this is a bug',(1,1), rgbcolor = (1,0,0))
t1.save(DATA+'bugplot.pdf')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mh/sagetest-notebook/worksheets/admin/73/code/7.py", line 6, in <module>
    t1.save(DATA+\u0027bugplot.pdf\u0027)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module>
    
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/sage/plot/plot.py", line 1605, in save
    canvas.print_figure(filename, dpi=dpi)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 1310, in print_figure
    **kwargs)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 1204, in print_pdf
    return pdf.print_pdf(*args, **kwargs)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line 1864, in print_pdf
    self.figure.draw(renderer)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/figure.py", line 759, in draw
    for a in self.axes: a.draw(renderer)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/axes.py", line 1523, in draw
    a.draw(renderer)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/text.py", line 329, in draw
    ismath=self.is_math_text(line))
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line 1428, in draw_text
    self.check_gc(gc, gc._rgb)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line 1191, in check_gc
    if delta: self.file.output(*delta)
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line 451, in output
    self.write(fill(map(pdfRepr, data)))
  File "/Volumes/D/sage-3.1.2/local/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line 182, in pdfRepr
    % type(obj)
TypeError: Don't know a PDF representation for <type 'sage.rings.integer.Integer'> objects.

Component: graphics

Keywords: pdf, save, text, rgbcolor

Issue created by migration from https://trac.sagemath.org/ticket/4146

@sagetrac-mhampton sagetrac-mhampton mannequin added this to the sage-3.4.1 milestone Sep 18, 2008
@shumow
Copy link

shumow commented Jan 23, 2009

comment:1

William suggested that this probably got fixed in matplotlib as pdf rendering got more mature/stable/done and/or less experimental.

@shumow shumow closed this as completed Jan 23, 2009
@sagetrac-mabshoff sagetrac-mabshoff mannequin modified the milestones: sage-3.4.1, sage-3.3 Jan 23, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants