multiple line plot resolution for each subplot
I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (29,32)
Index DateTimestamp 0.0 5.0 34.0 ... 31.0
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00
the explanation of image should be something like this:

the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns. Here is the code:
#Initialize the figure
plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,6, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df.index, df[v], marker='', color='grey',
linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df.index, df[column], marker='', color=palette(num),
linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,29)
plt.ylim(0,200) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(29) :
plt.tick_params(labelbottom='off')
if num not in [1,15,28] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black',style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Number', ha='center', va='center', rotation='vertical')
However,i am getting this bad image where the figure is blurry and the x-axis is clashing between the subplots of the previous ones. Any idea what i can do to increase the resolution of line plot, each of the subplot and spacing between the previous subplots and the current one

python pandas matplotlib
add a comment |
I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (29,32)
Index DateTimestamp 0.0 5.0 34.0 ... 31.0
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00
the explanation of image should be something like this:

the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns. Here is the code:
#Initialize the figure
plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,6, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df.index, df[v], marker='', color='grey',
linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df.index, df[column], marker='', color=palette(num),
linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,29)
plt.ylim(0,200) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(29) :
plt.tick_params(labelbottom='off')
if num not in [1,15,28] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black',style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Number', ha='center', va='center', rotation='vertical')
However,i am getting this bad image where the figure is blurry and the x-axis is clashing between the subplots of the previous ones. Any idea what i can do to increase the resolution of line plot, each of the subplot and spacing between the previous subplots and the current one

python pandas matplotlib
add a comment |
I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (29,32)
Index DateTimestamp 0.0 5.0 34.0 ... 31.0
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00
the explanation of image should be something like this:

the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns. Here is the code:
#Initialize the figure
plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,6, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df.index, df[v], marker='', color='grey',
linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df.index, df[column], marker='', color=palette(num),
linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,29)
plt.ylim(0,200) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(29) :
plt.tick_params(labelbottom='off')
if num not in [1,15,28] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black',style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Number', ha='center', va='center', rotation='vertical')
However,i am getting this bad image where the figure is blurry and the x-axis is clashing between the subplots of the previous ones. Any idea what i can do to increase the resolution of line plot, each of the subplot and spacing between the previous subplots and the current one

python pandas matplotlib
I have a dataframe,df, which i intend to plot a line chart where we cut the window in several subplots, one per group. Then,each group contains each column which is represented by a thick line displayed on its unique subplot while the other columns are displayed discreetly like the picture below so it won't lead to a spaghetti plot. The dimension of the dataframe is (29,32)
Index DateTimestamp 0.0 5.0 34.0 ... 31.0
0 2017-08-03 00:00:00 10 0 10 0
1 2017-08-04 00:00:00 20 60 1470 20
3 2017-08-05 00:00:00 0 58 0 24
4 2017-08-06 00:00:00 0 0 480 24
5 2017-09-07 00:00:00 0 0 0 25
: : : : : :
: : : : : :
29 2017-09-30 00:00:00
the explanation of image should be something like this:

the y4, y5 .... ontop of each subplot in the picture is the particular column name being displayed which in my dataframe can be 0.0,1.0....25.0. The x-axis tick labels will be the datetimestamp column of my dataframe,df. the Y-axis is the range of values of for all columns. Here is the code:
#Initialize the figure
plt.style.use('seaborn-darkgrid')
#create a color palette
palette = plt.get_cmap('tab20')
#multiple line plot
num=0
for column in df.drop(' DateTimestamp', axis=1):
num+=1
# Find the right spot on the plot
plt.subplot(6,6, num)
# plot every groups, but discreet
for v in df.drop(' DateTimestamp', axis=1):
plt.plot(df.index, df[v], marker='', color='grey',
linewidth=0.6, alpha=0.3)
# Plot the lineplot
plt.plot(df.index, df[column], marker='', color=palette(num),
linewidth=2.4, alpha=0.9, label=column)
# Same limits for everybody!
plt.xlim(0,29)
plt.ylim(0,200) # the limit of the y-axis should be the max value of all possible column values
# Not ticks everywhere
if num in range(29) :
plt.tick_params(labelbottom='off')
if num not in [1,15,28] :
plt.tick_params(labelleft='off')
# Add title
plt.title(column, loc='left', fontsize=12, fontweight=0, color=palette(num) )
#general title
plt.suptitle("Line Plot",fontsize=13, fontweight=0, color='black',style='italic', y=1.02)
#Axis title
plt.text(0.5, 0.02, 'Time', ha='center', va='center')
plt.text(0.06, 0.5, 'Number', ha='center', va='center', rotation='vertical')
However,i am getting this bad image where the figure is blurry and the x-axis is clashing between the subplots of the previous ones. Any idea what i can do to increase the resolution of line plot, each of the subplot and spacing between the previous subplots and the current one

python pandas matplotlib
python pandas matplotlib
asked Nov 13 '18 at 6:21
Bode Bode
14711
14711
add a comment |
add a comment |
0
active
oldest
votes
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%2f53274963%2fmultiple-line-plot-resolution-for-each-subplot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53274963%2fmultiple-line-plot-resolution-for-each-subplot%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