user3527975
user3527975

Reputation: 1773

How do I see graphs in Ipython when using axes

I know similar question has been asked. But those people didn't use axes in their questions. I have started my notebook server using --pylab=inline. And this is my code

from datetime import datetime
import pandas as pd
import numpy as np

import pickle
import matplotlib.pyplot as plt

df = pickle.load( open( "path to my pickle file", "rb" ) )

df_stack = df.ix[1]
#fig = figure()
ax = plt.subplot(111)

badge_list = []
label_ticks = []
date_list = []

yval = 0
for pr, date in df_stack.iteritems():
    if date != 'NA' :
        date_list.append(date)
        label_ticks.append(yval)
        pr_list.append(pr)
        yval = yval + 1
ax.plot_date(date_list, label_ticks)
ax.set_yticks(label_ticks)
ax.set_yticklabels(pr_list, rotation = 90)
ax.set_ylim(ax.get_ylim()[0]-1,ax.get_ylim()[1]+1)

This doesn't show my plot. Even if I do plt.show() I cannot see the graph.

Upvotes: 0

Views: 70

Answers (1)

DrV
DrV

Reputation: 23510

Maybe you have commented out the important part (creating the figure). I started the notebook server with:

ipython notebook --pylab=inline

And then tried this program:

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([0,1],[1,0])

This looks like:

enter image description here

Upvotes: 1

Related Questions