Graphing Data over time with a line graph












0














So I need to graph on what day there where followers using a line graph. But nothing shows up heres my code



def follower_timeplot(self,g,node):
dic={node: list(g.predecessors(node))}
lst=
D={}
for item in dic[node]:
lst.append(g[item][node]['Timecreated'])
D = {x:lst.count(x) for x in lst}
df= pd.Series(D, name='DateValue')
df.index.name = 'Date'
df.columns=['cnt']
df.reset_index()
#print(df)
plt.plot(x='Date', y='cnt')


this is a method that takes in a graph from networkx and looks a certian node and any indegree "Timecreated" is put in a dateframe then graphed.



So in short i need a line graph of the people following exaple date in the data frame looks like



Date
2011-01-18 1
2016-09-30 2
2015-10-07 1
2018-05-08 1
2018-11-18 1
2013-02-05 2
2018-06-04 2
2018-11-17 1
2018-11-15 2
2018-08-22 2
2012-12-14 1
2018-03-13 1
2013-05-02 1
2017-11-19 1
2017-06-11 2
2017-12-17 2









share|improve this question






















  • Is this all of your code? You are missing plt.show()
    – pxe
    Nov 22 at 17:37
















0














So I need to graph on what day there where followers using a line graph. But nothing shows up heres my code



def follower_timeplot(self,g,node):
dic={node: list(g.predecessors(node))}
lst=
D={}
for item in dic[node]:
lst.append(g[item][node]['Timecreated'])
D = {x:lst.count(x) for x in lst}
df= pd.Series(D, name='DateValue')
df.index.name = 'Date'
df.columns=['cnt']
df.reset_index()
#print(df)
plt.plot(x='Date', y='cnt')


this is a method that takes in a graph from networkx and looks a certian node and any indegree "Timecreated" is put in a dateframe then graphed.



So in short i need a line graph of the people following exaple date in the data frame looks like



Date
2011-01-18 1
2016-09-30 2
2015-10-07 1
2018-05-08 1
2018-11-18 1
2013-02-05 2
2018-06-04 2
2018-11-17 1
2018-11-15 2
2018-08-22 2
2012-12-14 1
2018-03-13 1
2013-05-02 1
2017-11-19 1
2017-06-11 2
2017-12-17 2









share|improve this question






















  • Is this all of your code? You are missing plt.show()
    – pxe
    Nov 22 at 17:37














0












0








0







So I need to graph on what day there where followers using a line graph. But nothing shows up heres my code



def follower_timeplot(self,g,node):
dic={node: list(g.predecessors(node))}
lst=
D={}
for item in dic[node]:
lst.append(g[item][node]['Timecreated'])
D = {x:lst.count(x) for x in lst}
df= pd.Series(D, name='DateValue')
df.index.name = 'Date'
df.columns=['cnt']
df.reset_index()
#print(df)
plt.plot(x='Date', y='cnt')


this is a method that takes in a graph from networkx and looks a certian node and any indegree "Timecreated" is put in a dateframe then graphed.



So in short i need a line graph of the people following exaple date in the data frame looks like



Date
2011-01-18 1
2016-09-30 2
2015-10-07 1
2018-05-08 1
2018-11-18 1
2013-02-05 2
2018-06-04 2
2018-11-17 1
2018-11-15 2
2018-08-22 2
2012-12-14 1
2018-03-13 1
2013-05-02 1
2017-11-19 1
2017-06-11 2
2017-12-17 2









share|improve this question













So I need to graph on what day there where followers using a line graph. But nothing shows up heres my code



def follower_timeplot(self,g,node):
dic={node: list(g.predecessors(node))}
lst=
D={}
for item in dic[node]:
lst.append(g[item][node]['Timecreated'])
D = {x:lst.count(x) for x in lst}
df= pd.Series(D, name='DateValue')
df.index.name = 'Date'
df.columns=['cnt']
df.reset_index()
#print(df)
plt.plot(x='Date', y='cnt')


this is a method that takes in a graph from networkx and looks a certian node and any indegree "Timecreated" is put in a dateframe then graphed.



So in short i need a line graph of the people following exaple date in the data frame looks like



Date
2011-01-18 1
2016-09-30 2
2015-10-07 1
2018-05-08 1
2018-11-18 1
2013-02-05 2
2018-06-04 2
2018-11-17 1
2018-11-15 2
2018-08-22 2
2012-12-14 1
2018-03-13 1
2013-05-02 1
2017-11-19 1
2017-06-11 2
2017-12-17 2






python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 17:29









Bruce Craig

1




1












  • Is this all of your code? You are missing plt.show()
    – pxe
    Nov 22 at 17:37


















  • Is this all of your code? You are missing plt.show()
    – pxe
    Nov 22 at 17:37
















Is this all of your code? You are missing plt.show()
– pxe
Nov 22 at 17:37




Is this all of your code? You are missing plt.show()
– pxe
Nov 22 at 17:37












1 Answer
1






active

oldest

votes


















0














Try to use pandas plot function instead. Also remember to add plt.show() to your code.



df.plot()
plt.show()





share|improve this answer





















  • how would i space the graph out more its only by year
    – Bruce Craig
    Nov 23 at 20:34










  • I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
    – Cedric Zoppolo
    Nov 23 at 21:11











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435865%2fgraphing-data-over-time-with-a-line-graph%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Try to use pandas plot function instead. Also remember to add plt.show() to your code.



df.plot()
plt.show()





share|improve this answer





















  • how would i space the graph out more its only by year
    – Bruce Craig
    Nov 23 at 20:34










  • I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
    – Cedric Zoppolo
    Nov 23 at 21:11
















0














Try to use pandas plot function instead. Also remember to add plt.show() to your code.



df.plot()
plt.show()





share|improve this answer





















  • how would i space the graph out more its only by year
    – Bruce Craig
    Nov 23 at 20:34










  • I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
    – Cedric Zoppolo
    Nov 23 at 21:11














0












0








0






Try to use pandas plot function instead. Also remember to add plt.show() to your code.



df.plot()
plt.show()





share|improve this answer












Try to use pandas plot function instead. Also remember to add plt.show() to your code.



df.plot()
plt.show()






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 at 18:21









Cedric Zoppolo

1,24711327




1,24711327












  • how would i space the graph out more its only by year
    – Bruce Craig
    Nov 23 at 20:34










  • I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
    – Cedric Zoppolo
    Nov 23 at 21:11


















  • how would i space the graph out more its only by year
    – Bruce Craig
    Nov 23 at 20:34










  • I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
    – Cedric Zoppolo
    Nov 23 at 21:11
















how would i space the graph out more its only by year
– Bruce Craig
Nov 23 at 20:34




how would i space the graph out more its only by year
– Bruce Craig
Nov 23 at 20:34












I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
– Cedric Zoppolo
Nov 23 at 21:11




I'm not sure I understand your question. If my answer does help you please consider to accept the question (green tick) and/or upvote. I think you should ask another question for what you mention in this comment and show the graph that results from your code and explain in detail what you expect.
– Cedric Zoppolo
Nov 23 at 21:11


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53435865%2fgraphing-data-over-time-with-a-line-graph%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo