How to Change Color of Line graphs in Statsmodel Decomposition PlotsHow can I do a line break (line continuation) in Python?How do you change the size of figures drawn with matplotlib?Plot two graphs in same plot in RHow to read a file line-by-line into a list?How to put the legend out of the plotHaving line color vary with data index for line graph in matplotlib?Plotting line(color, attribue defined) graph using pandasHow to change colors of points in Python's ggplotAnimated plot with different color for every data pointPandas Series not plotting to timeseries chart
<schwitz>, <zwinker> etc. Does German always use 2nd Person Singular Imperative verbs for emoticons? If so, why?
How to query contacts with no cases, opportunities etc
Can I call 112 to check a police officer's identity in the Czech Republic?
affect vs effect
Why does resistance reduce when a conductive fabric is stretched?
During copyediting, journal disagrees about spelling of paper's main topic
Does Google Maps take into account hills/inclines for route times?
Correlation of independent random processes
Extract an attribute value from XML
Replacements for swear words
How the name "craqueuhhe" is read
What's the point of this scene involving Flash Thompson at the airport?
Crowbar circuit causes unexpected behavior for op amp circuit
How can one write good dialogue in a story without sounding wooden?
Referring to different instances of the same character in time travel
The monorail explodes before I can get on it
Filtering fine silt/mud from water (not necessarily bacteria etc.)
How can an advanced civilization forget how to manufacture its technology?
'rm' (delete) thousands of files selectively
Are neural networks prone to catastrophic forgetting?
What is this welding tool I found in my attic?
Password maker in c#
Were there any new Pokémon introduced in the movie Pokémon: Detective Pikachu?
When did the Roman Empire fall according to contemporaries?
How to Change Color of Line graphs in Statsmodel Decomposition Plots
How can I do a line break (line continuation) in Python?How do you change the size of figures drawn with matplotlib?Plot two graphs in same plot in RHow to read a file line-by-line into a list?How to put the legend out of the plotHaving line color vary with data index for line graph in matplotlib?Plotting line(color, attribue defined) graph using pandasHow to change colors of points in Python's ggplotAnimated plot with different color for every data pointPandas Series not plotting to timeseries chart
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
The default color of the seasonal decomposition graphs is a light blue.
1. How can you change the colors so that each of the lines is a different color?
2. If each plot can not have a separate color, how would I change all of the colors to say red?
I've tried adding arguments to decomposition.plot(color = 'red')
and searching the documentation for clues.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# I want 7 days of 24 hours with 60 minutes each
periods = 7 * 24 * 60
tidx = pd.date_range('2016-07-01', periods=periods, freq='D')
np.random.seed([3,1415])
# This will pick a number of normally distributed random numbers
# where the number is specified by periods
data = np.random.randn(periods)
ts = pd.Series(data=data, index=tidx, name='TimeSeries')
decomposition = sm.tsa.seasonal_decompose(ts, model ='additive')
fig = decomposition.plot()
plt.show()
A decomposition plot in which each graph is a different color.
python plot statsmodels
add a comment |
The default color of the seasonal decomposition graphs is a light blue.
1. How can you change the colors so that each of the lines is a different color?
2. If each plot can not have a separate color, how would I change all of the colors to say red?
I've tried adding arguments to decomposition.plot(color = 'red')
and searching the documentation for clues.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# I want 7 days of 24 hours with 60 minutes each
periods = 7 * 24 * 60
tidx = pd.date_range('2016-07-01', periods=periods, freq='D')
np.random.seed([3,1415])
# This will pick a number of normally distributed random numbers
# where the number is specified by periods
data = np.random.randn(periods)
ts = pd.Series(data=data, index=tidx, name='TimeSeries')
decomposition = sm.tsa.seasonal_decompose(ts, model ='additive')
fig = decomposition.plot()
plt.show()
A decomposition plot in which each graph is a different color.
python plot statsmodels
add a comment |
The default color of the seasonal decomposition graphs is a light blue.
1. How can you change the colors so that each of the lines is a different color?
2. If each plot can not have a separate color, how would I change all of the colors to say red?
I've tried adding arguments to decomposition.plot(color = 'red')
and searching the documentation for clues.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# I want 7 days of 24 hours with 60 minutes each
periods = 7 * 24 * 60
tidx = pd.date_range('2016-07-01', periods=periods, freq='D')
np.random.seed([3,1415])
# This will pick a number of normally distributed random numbers
# where the number is specified by periods
data = np.random.randn(periods)
ts = pd.Series(data=data, index=tidx, name='TimeSeries')
decomposition = sm.tsa.seasonal_decompose(ts, model ='additive')
fig = decomposition.plot()
plt.show()
A decomposition plot in which each graph is a different color.
python plot statsmodels
The default color of the seasonal decomposition graphs is a light blue.
1. How can you change the colors so that each of the lines is a different color?
2. If each plot can not have a separate color, how would I change all of the colors to say red?
I've tried adding arguments to decomposition.plot(color = 'red')
and searching the documentation for clues.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# I want 7 days of 24 hours with 60 minutes each
periods = 7 * 24 * 60
tidx = pd.date_range('2016-07-01', periods=periods, freq='D')
np.random.seed([3,1415])
# This will pick a number of normally distributed random numbers
# where the number is specified by periods
data = np.random.randn(periods)
ts = pd.Series(data=data, index=tidx, name='TimeSeries')
decomposition = sm.tsa.seasonal_decompose(ts, model ='additive')
fig = decomposition.plot()
plt.show()
A decomposition plot in which each graph is a different color.
python plot statsmodels
python plot statsmodels
asked Mar 26 at 4:48
rer49rer49
1088 bronze badges
1088 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The decomposition
object in the code you posted uses pandas in the plotting method. I don't see a way of passing colors directly to the plot
method, and it doesn't take **kwargs.
A work around would be to call the pandas plotting code directly on the object:
fig, axes = plt.subplots(4, 1, sharex=True)
decomposition.observed.plot(ax=axes[0], legend=False, color='r')
axes[0].set_ylabel('Observed')
decomposition.trend.plot(ax=axes[1], legend=False, color='g')
axes[1].set_ylabel('Trend')
decomposition.seasonal.plot(ax=axes[2], legend=False)
axes[2].set_ylabel('Seasonal')
decomposition.resid.plot(ax=axes[3], legend=False, color='k')
axes[3].set_ylabel('Residual')
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%2f55350030%2fhow-to-change-color-of-line-graphs-in-statsmodel-decomposition-plots%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
The decomposition
object in the code you posted uses pandas in the plotting method. I don't see a way of passing colors directly to the plot
method, and it doesn't take **kwargs.
A work around would be to call the pandas plotting code directly on the object:
fig, axes = plt.subplots(4, 1, sharex=True)
decomposition.observed.plot(ax=axes[0], legend=False, color='r')
axes[0].set_ylabel('Observed')
decomposition.trend.plot(ax=axes[1], legend=False, color='g')
axes[1].set_ylabel('Trend')
decomposition.seasonal.plot(ax=axes[2], legend=False)
axes[2].set_ylabel('Seasonal')
decomposition.resid.plot(ax=axes[3], legend=False, color='k')
axes[3].set_ylabel('Residual')
add a comment |
The decomposition
object in the code you posted uses pandas in the plotting method. I don't see a way of passing colors directly to the plot
method, and it doesn't take **kwargs.
A work around would be to call the pandas plotting code directly on the object:
fig, axes = plt.subplots(4, 1, sharex=True)
decomposition.observed.plot(ax=axes[0], legend=False, color='r')
axes[0].set_ylabel('Observed')
decomposition.trend.plot(ax=axes[1], legend=False, color='g')
axes[1].set_ylabel('Trend')
decomposition.seasonal.plot(ax=axes[2], legend=False)
axes[2].set_ylabel('Seasonal')
decomposition.resid.plot(ax=axes[3], legend=False, color='k')
axes[3].set_ylabel('Residual')
add a comment |
The decomposition
object in the code you posted uses pandas in the plotting method. I don't see a way of passing colors directly to the plot
method, and it doesn't take **kwargs.
A work around would be to call the pandas plotting code directly on the object:
fig, axes = plt.subplots(4, 1, sharex=True)
decomposition.observed.plot(ax=axes[0], legend=False, color='r')
axes[0].set_ylabel('Observed')
decomposition.trend.plot(ax=axes[1], legend=False, color='g')
axes[1].set_ylabel('Trend')
decomposition.seasonal.plot(ax=axes[2], legend=False)
axes[2].set_ylabel('Seasonal')
decomposition.resid.plot(ax=axes[3], legend=False, color='k')
axes[3].set_ylabel('Residual')
The decomposition
object in the code you posted uses pandas in the plotting method. I don't see a way of passing colors directly to the plot
method, and it doesn't take **kwargs.
A work around would be to call the pandas plotting code directly on the object:
fig, axes = plt.subplots(4, 1, sharex=True)
decomposition.observed.plot(ax=axes[0], legend=False, color='r')
axes[0].set_ylabel('Observed')
decomposition.trend.plot(ax=axes[1], legend=False, color='g')
axes[1].set_ylabel('Trend')
decomposition.seasonal.plot(ax=axes[2], legend=False)
axes[2].set_ylabel('Seasonal')
decomposition.resid.plot(ax=axes[3], legend=False, color='k')
axes[3].set_ylabel('Residual')
answered Mar 26 at 5:11
johnchasejohnchase
5,3851 gold badge21 silver badges37 bronze badges
5,3851 gold badge21 silver badges37 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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%2f55350030%2fhow-to-change-color-of-line-graphs-in-statsmodel-decomposition-plots%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