Giter VIP home page Giter VIP logo

graph-paper.py's Introduction

graph-paper.py

→ Version française (link to french readme).

Simple script to create graph papers (with linear or log scale) using python3 and matplotlib. Ones can set the parameters à the beginning of the scripts. To use it, run (if matplotlib is installed):

python3 graph-paper.py

To select log scale, set xdecade and ydecade at the appropriate number of decades. Setting one of these variables to zero means linear scale. Example, for semi-log paper with three log modules on the x-axis and a linear y-axis, use :

# Number of decades for log scale
# set to zero for linear scale
xdecades = 3
ydecades = 0

The output file is created only if the variable save is set to True :

save = True

The output file name is set with filename and extension. Some widdcards are availlable :

  • %x and %y are replaced by the value of xdecades and ydecades.
  • %s is replaced by _semilog_n-decades or _log_n-m-decades (or nothing for linear scale).

For example :

filename="Papier%s"
extension=".pdf"

The paper and figure geometries are set by the following variables :

landscape   = True  # if true, swap width and height
centimeters = True  # if false, length unit is inch (matplotlib default)
paperwidth  = 21.0
paperheight = 29.7
figwidth    = 16.0
figheight   = 24.0
rightmargin = 2.5
topmargin   = 2.5

Line style of minor and major grid lines are set by the following variables :

major_linestyle = '-'
major_linewidth = 0.5
major_color     = "black"
major_alpha     = 1.0

minor_linestyle = '-'
minor_linewidth = 0.25
minor_color     = 'black'
minor_alpha     = 0.7

To show the figure, at the moment of the creation, use :

showfig = True

graph-paper.py's People

Contributors

julienlabbe avatar

Watchers

 avatar

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.