2

I am trying to plot a simple 2 dimensional Bar Graph for two lists in python. (note that max of this list is 4) I want to plot this list and its corresponding index using Matplotlib. My code is this

import numpy as np
import matplotlib.pyplot as pl
bitpos = np.arange(len(sumlist))
pl.bar(bitpos,sumlist, align='center', alpha=0.5)
pl.ylabel('mismatch count')
pl.xlabel('bitposition')

The graph although plots correctly but the bars are touching the top of the graph (see the graph below) I want to create some empty space above the graph for a better presentation.

Example Plot to illustrate my problem

1 Answer 1

1

If you want to add some space to the top of your plot, you can add something like:

pl.ylim((0., 5.))

to the bottom of your current script.This changes the y limits of your plot to 0 and 5 (currently they are 0 and 4).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.