Pandas/matplotlib line plot does not show x axis text labels Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceSelect Distinct Years and Months for Django Archive PageIrregular matplotlib date x-axis labels?Save plot to image file instead of displaying it using MatplotlibHow to make IPython notebook matplotlib plot inlinePython Merging Ordered Lists' Outputcomparing date using dd/mm/yy format in pythonFormat x-axis on chart created with pandas plot methodPandas mapping with multiple conditionsHow to understand pandas Period object?Get 95 percentile of the variables for SON, DJF, MAM over multiple years' data
Estimate capacitor parameters
How to market an anarchic city as a tourism spot to people living in civilized areas?
Single author papers against my advisor's will?
Fishing simulator
I'm thinking of a number
Determine whether f is a function, an injection, a surjection
What to do with post with dry rot?
Stars Make Stars
Strange behaviour of Check
I'm having difficulty getting my players to do stuff in a sandbox campaign
Estimated State payment too big --> money back; + 2018 Tax Reform
What did Darwin mean by 'squib' here?
How to rotate it perfectly?
Array/tabular for long multiplication
What kind of display is this?
Replacing HDD with SSD; what about non-APFS/APFS?
What do you call a plan that's an alternative plan in case your initial plan fails?
Problem when applying foreach loop
Who can trigger ship-wide alerts in Star Trek?
What LEGO pieces have "real-world" functionality?
How can I make names more distinctive without making them longer?
Cold is to Refrigerator as warm is to?
New Order #5: where Fibonacci and Beatty meet at Wythoff
How does modal jazz use chord progressions?
Pandas/matplotlib line plot does not show x axis text labels
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceSelect Distinct Years and Months for Django Archive PageIrregular matplotlib date x-axis labels?Save plot to image file instead of displaying it using MatplotlibHow to make IPython notebook matplotlib plot inlinePython Merging Ordered Lists' Outputcomparing date using dd/mm/yy format in pythonFormat x-axis on chart created with pandas plot methodPandas mapping with multiple conditionsHow to understand pandas Period object?Get 95 percentile of the variables for SON, DJF, MAM over multiple years' data
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Issue
Plotting data from a DataFrame into a line plot excludes "dates" on the x axis.
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
north_result_df.plot.line()
Line plot requires dates just above 'months' on the x axis. Dates show if they are numeric and not strings...any help would be greatly appreciated! As you can tell i am pretty new to Pandas...
Solution
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df.index, north_result_df["total"])
plt.show()
python pandas matplotlib
|
show 2 more comments
Issue
Plotting data from a DataFrame into a line plot excludes "dates" on the x axis.
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
north_result_df.plot.line()
Line plot requires dates just above 'months' on the x axis. Dates show if they are numeric and not strings...any help would be greatly appreciated! As you can tell i am pretty new to Pandas...
Solution
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df.index, north_result_df["total"])
plt.show()
python pandas matplotlib
Which version of pandas? In my 0.24.1 it works and looks as expected.
– JoergVanAken
Mar 8 at 15:23
1
This issue is still not fixed.
– ImportanceOfBeingErnest
Mar 8 at 18:00
Great....anyway around it Ernest?
– bsod_
Mar 8 at 19:24
My suggestion would be the same as the answer below: use matplotlib directly instead.
– ImportanceOfBeingErnest
Mar 8 at 19:43
1
I have no idea whatlist(data.aggregate(pipeline))
does. But if you have a usual dataframe with numerical values in a column and a normal index (no multiindex, no PeriodIndex) you can useplt.plot(df.index, df["column"])
.
– ImportanceOfBeingErnest
Mar 8 at 19:47
|
show 2 more comments
Issue
Plotting data from a DataFrame into a line plot excludes "dates" on the x axis.
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
north_result_df.plot.line()
Line plot requires dates just above 'months' on the x axis. Dates show if they are numeric and not strings...any help would be greatly appreciated! As you can tell i am pretty new to Pandas...
Solution
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df.index, north_result_df["total"])
plt.show()
python pandas matplotlib
Issue
Plotting data from a DataFrame into a line plot excludes "dates" on the x axis.
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
north_result_df.plot.line()
Line plot requires dates just above 'months' on the x axis. Dates show if they are numeric and not strings...any help would be greatly appreciated! As you can tell i am pretty new to Pandas...
Solution
north_result = list(data.aggregate(pipeline))
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df.index, north_result_df["total"])
plt.show()
python pandas matplotlib
python pandas matplotlib
edited Mar 8 at 20:01
bsod_
asked Mar 8 at 14:47
bsod_bsod_
310315
310315
Which version of pandas? In my 0.24.1 it works and looks as expected.
– JoergVanAken
Mar 8 at 15:23
1
This issue is still not fixed.
– ImportanceOfBeingErnest
Mar 8 at 18:00
Great....anyway around it Ernest?
– bsod_
Mar 8 at 19:24
My suggestion would be the same as the answer below: use matplotlib directly instead.
– ImportanceOfBeingErnest
Mar 8 at 19:43
1
I have no idea whatlist(data.aggregate(pipeline))
does. But if you have a usual dataframe with numerical values in a column and a normal index (no multiindex, no PeriodIndex) you can useplt.plot(df.index, df["column"])
.
– ImportanceOfBeingErnest
Mar 8 at 19:47
|
show 2 more comments
Which version of pandas? In my 0.24.1 it works and looks as expected.
– JoergVanAken
Mar 8 at 15:23
1
This issue is still not fixed.
– ImportanceOfBeingErnest
Mar 8 at 18:00
Great....anyway around it Ernest?
– bsod_
Mar 8 at 19:24
My suggestion would be the same as the answer below: use matplotlib directly instead.
– ImportanceOfBeingErnest
Mar 8 at 19:43
1
I have no idea whatlist(data.aggregate(pipeline))
does. But if you have a usual dataframe with numerical values in a column and a normal index (no multiindex, no PeriodIndex) you can useplt.plot(df.index, df["column"])
.
– ImportanceOfBeingErnest
Mar 8 at 19:47
Which version of pandas? In my 0.24.1 it works and looks as expected.
– JoergVanAken
Mar 8 at 15:23
Which version of pandas? In my 0.24.1 it works and looks as expected.
– JoergVanAken
Mar 8 at 15:23
1
1
This issue is still not fixed.
– ImportanceOfBeingErnest
Mar 8 at 18:00
This issue is still not fixed.
– ImportanceOfBeingErnest
Mar 8 at 18:00
Great....anyway around it Ernest?
– bsod_
Mar 8 at 19:24
Great....anyway around it Ernest?
– bsod_
Mar 8 at 19:24
My suggestion would be the same as the answer below: use matplotlib directly instead.
– ImportanceOfBeingErnest
Mar 8 at 19:43
My suggestion would be the same as the answer below: use matplotlib directly instead.
– ImportanceOfBeingErnest
Mar 8 at 19:43
1
1
I have no idea what
list(data.aggregate(pipeline))
does. But if you have a usual dataframe with numerical values in a column and a normal index (no multiindex, no PeriodIndex) you can use plt.plot(df.index, df["column"])
.– ImportanceOfBeingErnest
Mar 8 at 19:47
I have no idea what
list(data.aggregate(pipeline))
does. But if you have a usual dataframe with numerical values in a column and a normal index (no multiindex, no PeriodIndex) you can use plt.plot(df.index, df["column"])
.– ImportanceOfBeingErnest
Mar 8 at 19:47
|
show 2 more comments
1 Answer
1
active
oldest
votes
you can use pyplot
import matplotlib.pyplot as plt
north_result =[5,6,7,2,8,5,4,8,9,4,1,5]
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df)
plt.show()
the result will be like:
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
1
Final solution added to question
– bsod_
Mar 8 at 20:02
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55065606%2fpandas-matplotlib-line-plot-does-not-show-x-axis-text-labels%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
you can use pyplot
import matplotlib.pyplot as plt
north_result =[5,6,7,2,8,5,4,8,9,4,1,5]
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df)
plt.show()
the result will be like:
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
1
Final solution added to question
– bsod_
Mar 8 at 20:02
add a comment |
you can use pyplot
import matplotlib.pyplot as plt
north_result =[5,6,7,2,8,5,4,8,9,4,1,5]
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df)
plt.show()
the result will be like:
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
1
Final solution added to question
– bsod_
Mar 8 at 20:02
add a comment |
you can use pyplot
import matplotlib.pyplot as plt
north_result =[5,6,7,2,8,5,4,8,9,4,1,5]
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df)
plt.show()
the result will be like:
you can use pyplot
import matplotlib.pyplot as plt
north_result =[5,6,7,2,8,5,4,8,9,4,1,5]
dates =['Jun','Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May']
north_result_df = pd.DataFrame(north_result, index=dates)
north_result_df.index.name = 'Months'
plt.plot(north_result_df)
plt.show()
the result will be like:
answered Mar 8 at 14:59
Rehim AlizadehRehim Alizadeh
638
638
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
1
Final solution added to question
– bsod_
Mar 8 at 20:02
add a comment |
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
1
Final solution added to question
– bsod_
Mar 8 at 20:02
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
Cheers however I now get - TypeError: unhashable type: 'numpy.ndarray' - north_result_df is declared as follows = north_result = list(street.aggregate(pipeline))
– bsod_
Mar 8 at 19:20
1
1
Final solution added to question
– bsod_
Mar 8 at 20:02
Final solution added to question
– bsod_
Mar 8 at 20:02
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55065606%2fpandas-matplotlib-line-plot-does-not-show-x-axis-text-labels%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Which version of pandas? In my 0.24.1 it works and looks as expected.
– JoergVanAken
Mar 8 at 15:23
1
This issue is still not fixed.
– ImportanceOfBeingErnest
Mar 8 at 18:00
Great....anyway around it Ernest?
– bsod_
Mar 8 at 19:24
My suggestion would be the same as the answer below: use matplotlib directly instead.
– ImportanceOfBeingErnest
Mar 8 at 19:43
1
I have no idea what
list(data.aggregate(pipeline))
does. But if you have a usual dataframe with numerical values in a column and a normal index (no multiindex, no PeriodIndex) you can useplt.plot(df.index, df["column"])
.– ImportanceOfBeingErnest
Mar 8 at 19:47