GithubHelp home page GithubHelp logo

pubplot's People

Contributors

hsadok avatar wwoods avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wwoods 108anup

pubplot's Issues

Various Fixes / Improvements

Hi Hugo,

Thank you again for putting this on GitHub; I appreciate the work and thought you've put into this framework. I'm working with IEEEtran.cls as well, and can get figures to work perfectly with the following bug fixes / improvements:

  • The argument to pubplot.Document() is somewhat confusing. I think I understand why you opted for documentclass instead of document_class, to mirror LaTeX; but in that case, I would recommend something like pubplot.Document({'documentclass': '[journal]IEEEtran'}) rather than having two separate fields (so that this option is specified as it would be in the LaTeX document).
  • The IEEEtran.cls file includes \usepackage{times}, which pubplot does not currently support. I recommend adding an argument like: pubplot.Document({'documentclass': '[journal]IEEEtran', 'packages': ['times']}). Or, to be more flexible: pubplot.Document({'documentclass': '[journal]IEEEtran', 'preamble': [r'\usepackage{times}']}).
  • The font size for figure captions is incorrectly detected, I believe. This may be just because I have tweaked the style file a little bit, but I think that all figure captions in IEEEtran use \footnotesize, not \small. You have \small hardcoded rather than detected for most figure font sizes, so I believe this is the discrepancy.
  • Related: it is unnecessarily difficult to adjust figure font sizes. I would recommend detecting if a user has passed e.g. pubplot.Document({...}, style={'font.size': '8'}, and override all font settings with the specified font.size key. If the user of your library is wanting to override this value, they probably want it to be the default for everything, and could then manually specify xtick.labelsize for instance. Adding this would make the previous issue less of a bother.
  • Need a Document.figure() method which takes a GridSpec for the axes rather than always using subplots ([GridSpec](https://matplotlib.org/users/gridspec.html; or perhaps better, using fig.add_gridspec and fig.add_subplot). What I would recommend is having Document.figure() return a figure object without creating any axes, and then hook into Figure.add_gridspec and Figure.add_subplot like the second link.
  • The implementation of tight_layout is wrong, leading to font sizes not matching the document. Currently, pubplot does Figure(..., tight_layout=True) in document.py and later canvas.print_figure(..., bbox_inches='tight') in figure.py. To get the spacing / sizing right, these need to be Figure(..., tight_layout={'pad': 0}) and canvas.print_figure(..., bbox_inches='tight', pad_inches=0) respectively.

Since you've already put a bit of time into this project, I'll go ahead and make a pull request with everything except the figure caption size detection for IEEEtran. We can have a dialog there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.