Tabstops render as squares

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Joe
Reply | Threaded
Open this post in threaded view
|

Tabstops render as squares

Joe
Hello,

I was trying to render a pdf document with some data
aligned by tabstops.
But Matplotlib renders the tabs as squares,
at first I thought it is related to the pdf, but it
also happens with titles or labels.

I know it does not make much sense there, but
this is as far as I could break it down.

-----------
import matplotlib
from pylab import *

#matplotlib.rcParams['pdf.fonttype'] = 42 #42 #TTF 42, 3 ?

matplotlib.rcParams['ps.useafm'] = True
matplotlib.rcParams['pdf.use14corefonts'] = True

#this seems to work, but only on my simple example
#it throws a lot of latex errors with my original code.
#matplotlib.rcParams['text.usetex'] = True

figure(figsize=(3,3))
title('Page' + '\t' + 'One')
show()
------------

And ideas how to solve this?

Joe

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Tabstops render as squares

Jouni K. Seppänen
Joe <[hidden email]> writes:

> I was trying to render a pdf document with some data
> aligned by tabstops.

I don't think there is any support for that kind of text layout.
The closest feature is probably pyplot.table:

https://matplotlib.org/api/_as_gen/matplotlib.pyplot.table.html
http://matplotlib.org/examples/pylab_examples/table_demo.html

Another possibility is to use a monospaced font and align with spaces
(possibly using str.expandtabs to generate the spaces):

https://stackoverflow.com/a/30111217/26575

--
Jouni K. Seppänen
http://www.iki.fi/jks

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users