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

Add a title option in the Python version. #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

neighthan
Copy link
Contributor

This updates the Python plot command and the pplot script with an additional title argument. If given, the title is the first line of the plot string and is centered over the non-axis region of the plot (unless it's too long, then it starts just after the y-axis ends). If no title is given, the behavior is the same as right now.

Example:

$ pplot 1 10 5 3 9 7 10 0.1 --title "Title"
            Title
   10.00  ┼╭╮   ╭╮ 
    8.90  ┤││ ╭╮││ 
    7.80  ┤││ ││││ 
    6.70  ┤││ │╰╯│ 
    5.60  ┤││ │  │ 
    4.50  ┤│╰╮│  │ 
    3.40  ┤│ ╰╯  │ 
    2.30  ┤│     │ 
    1.20  ┤╯     │ 
    0.10  ┼      ╰ 

Note: if there is a title, I decrease the height allotted for the rest of the plot by 1. This means that the rest of the plot will look a little different (the axis values change; see an example below). If you'd prefer, we could leave the height the same and just note (e.g. in the doc string) that a plot with a title will have a height that is 1 larger.

$ pplot 1 10 5 3 9 7 10 0.1
   10.00  ┼╭╮   ╭╮ 
    9.01  ┤││ ╭╮││ 
    8.02  ┤││ ││││ 
    7.03  ┤││ │╰╯│ 
    6.04  ┤││ │  │ 
    5.05  ┤│╰╮│  │ 
    4.06  ┤│ ││  │ 
    3.07  ┤│ ╰╯  │ 
    2.08  ┤│     │ 
    1.09  ┼╯     │ 
    0.10  ┤      ╰ 

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 240ce86 on neighthan:add_title into 714e057 on kroitor:master.

@kroitor kroitor self-assigned this Jul 1, 2019
@kroitor
Copy link
Owner

kroitor commented Jul 1, 2019

Will merge shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants