Plot-style of matplotlib

Multi tool use
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'd like to know why matplotlib
outputs plots in different styles depending on which system I run the file. For example, I let the same code run twice, once on a Windows machine and once on Ubuntu system, and got the following two plots
The information in the plots is obviously the same, but is there a special command to let matplotlib
know that I'd, for example, would like all my plots to be produced in the "Ubuntu style" (lower of the two) version?
python python-3.x matplotlib plot
add a comment |
I'd like to know why matplotlib
outputs plots in different styles depending on which system I run the file. For example, I let the same code run twice, once on a Windows machine and once on Ubuntu system, and got the following two plots
The information in the plots is obviously the same, but is there a special command to let matplotlib
know that I'd, for example, would like all my plots to be produced in the "Ubuntu style" (lower of the two) version?
python python-3.x matplotlib plot
It's to do with the backend that is used - it's different by default for Windows and Unix. matplotlib.org/faq/usage_faq.html#what-is-a-backend You can set it like this:backend : WXAgg
– Ben Jones
Nov 16 '18 at 13:05
1
You have two different versions of matplotlib installed on both systems. Check the version viaprint(matplotlib.__version__)
. Obviously you can install the same version on all your computers and get the same output. I don't know which of the two plots you call "Ubuntu style", which would be important to know for alternative solutions.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:08
It has nothing to do with the backend though, as claimed by the other comment.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:09
@ImportanceOfBeingErnest Thanks for the info, I edited the question. Would still be nice to know how I could change it to the other version withou having to install different versions.
– Sito
Nov 16 '18 at 13:11
Ah yes you're right @ImportanceOfBeingErnest
– Ben Jones
Nov 16 '18 at 13:27
add a comment |
I'd like to know why matplotlib
outputs plots in different styles depending on which system I run the file. For example, I let the same code run twice, once on a Windows machine and once on Ubuntu system, and got the following two plots
The information in the plots is obviously the same, but is there a special command to let matplotlib
know that I'd, for example, would like all my plots to be produced in the "Ubuntu style" (lower of the two) version?
python python-3.x matplotlib plot
I'd like to know why matplotlib
outputs plots in different styles depending on which system I run the file. For example, I let the same code run twice, once on a Windows machine and once on Ubuntu system, and got the following two plots
The information in the plots is obviously the same, but is there a special command to let matplotlib
know that I'd, for example, would like all my plots to be produced in the "Ubuntu style" (lower of the two) version?
python python-3.x matplotlib plot
python python-3.x matplotlib plot
edited Nov 16 '18 at 13:09
Sito
asked Nov 16 '18 at 13:02
SitoSito
192313
192313
It's to do with the backend that is used - it's different by default for Windows and Unix. matplotlib.org/faq/usage_faq.html#what-is-a-backend You can set it like this:backend : WXAgg
– Ben Jones
Nov 16 '18 at 13:05
1
You have two different versions of matplotlib installed on both systems. Check the version viaprint(matplotlib.__version__)
. Obviously you can install the same version on all your computers and get the same output. I don't know which of the two plots you call "Ubuntu style", which would be important to know for alternative solutions.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:08
It has nothing to do with the backend though, as claimed by the other comment.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:09
@ImportanceOfBeingErnest Thanks for the info, I edited the question. Would still be nice to know how I could change it to the other version withou having to install different versions.
– Sito
Nov 16 '18 at 13:11
Ah yes you're right @ImportanceOfBeingErnest
– Ben Jones
Nov 16 '18 at 13:27
add a comment |
It's to do with the backend that is used - it's different by default for Windows and Unix. matplotlib.org/faq/usage_faq.html#what-is-a-backend You can set it like this:backend : WXAgg
– Ben Jones
Nov 16 '18 at 13:05
1
You have two different versions of matplotlib installed on both systems. Check the version viaprint(matplotlib.__version__)
. Obviously you can install the same version on all your computers and get the same output. I don't know which of the two plots you call "Ubuntu style", which would be important to know for alternative solutions.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:08
It has nothing to do with the backend though, as claimed by the other comment.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:09
@ImportanceOfBeingErnest Thanks for the info, I edited the question. Would still be nice to know how I could change it to the other version withou having to install different versions.
– Sito
Nov 16 '18 at 13:11
Ah yes you're right @ImportanceOfBeingErnest
– Ben Jones
Nov 16 '18 at 13:27
It's to do with the backend that is used - it's different by default for Windows and Unix. matplotlib.org/faq/usage_faq.html#what-is-a-backend You can set it like this:
backend : WXAgg
– Ben Jones
Nov 16 '18 at 13:05
It's to do with the backend that is used - it's different by default for Windows and Unix. matplotlib.org/faq/usage_faq.html#what-is-a-backend You can set it like this:
backend : WXAgg
– Ben Jones
Nov 16 '18 at 13:05
1
1
You have two different versions of matplotlib installed on both systems. Check the version via
print(matplotlib.__version__)
. Obviously you can install the same version on all your computers and get the same output. I don't know which of the two plots you call "Ubuntu style", which would be important to know for alternative solutions.– ImportanceOfBeingErnest
Nov 16 '18 at 13:08
You have two different versions of matplotlib installed on both systems. Check the version via
print(matplotlib.__version__)
. Obviously you can install the same version on all your computers and get the same output. I don't know which of the two plots you call "Ubuntu style", which would be important to know for alternative solutions.– ImportanceOfBeingErnest
Nov 16 '18 at 13:08
It has nothing to do with the backend though, as claimed by the other comment.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:09
It has nothing to do with the backend though, as claimed by the other comment.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:09
@ImportanceOfBeingErnest Thanks for the info, I edited the question. Would still be nice to know how I could change it to the other version withou having to install different versions.
– Sito
Nov 16 '18 at 13:11
@ImportanceOfBeingErnest Thanks for the info, I edited the question. Would still be nice to know how I could change it to the other version withou having to install different versions.
– Sito
Nov 16 '18 at 13:11
Ah yes you're right @ImportanceOfBeingErnest
– Ben Jones
Nov 16 '18 at 13:27
Ah yes you're right @ImportanceOfBeingErnest
– Ben Jones
Nov 16 '18 at 13:27
add a comment |
1 Answer
1
active
oldest
votes
The upper plot is produced with a version of matplotlib >= 2.0. The lower plot is produced with a version < 2.0. The style changes are documented in the Changes to the default style.
It's hardly possible to make a matplotlib version < 2.0 produce the exact output you'd get with matplotlib >= 2.0, although you might copy the style sheet from a newer version to the old one and set the parameters accordingly.
The inverse is however possible. To get the old (classic) style in a new version of matplotlib should be possible via
import matplotlib.pyplot as plt
plt.style.use("classic")
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
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%2f53338458%2fplot-style-of-matplotlib%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 upper plot is produced with a version of matplotlib >= 2.0. The lower plot is produced with a version < 2.0. The style changes are documented in the Changes to the default style.
It's hardly possible to make a matplotlib version < 2.0 produce the exact output you'd get with matplotlib >= 2.0, although you might copy the style sheet from a newer version to the old one and set the parameters accordingly.
The inverse is however possible. To get the old (classic) style in a new version of matplotlib should be possible via
import matplotlib.pyplot as plt
plt.style.use("classic")
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
add a comment |
The upper plot is produced with a version of matplotlib >= 2.0. The lower plot is produced with a version < 2.0. The style changes are documented in the Changes to the default style.
It's hardly possible to make a matplotlib version < 2.0 produce the exact output you'd get with matplotlib >= 2.0, although you might copy the style sheet from a newer version to the old one and set the parameters accordingly.
The inverse is however possible. To get the old (classic) style in a new version of matplotlib should be possible via
import matplotlib.pyplot as plt
plt.style.use("classic")
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
add a comment |
The upper plot is produced with a version of matplotlib >= 2.0. The lower plot is produced with a version < 2.0. The style changes are documented in the Changes to the default style.
It's hardly possible to make a matplotlib version < 2.0 produce the exact output you'd get with matplotlib >= 2.0, although you might copy the style sheet from a newer version to the old one and set the parameters accordingly.
The inverse is however possible. To get the old (classic) style in a new version of matplotlib should be possible via
import matplotlib.pyplot as plt
plt.style.use("classic")
The upper plot is produced with a version of matplotlib >= 2.0. The lower plot is produced with a version < 2.0. The style changes are documented in the Changes to the default style.
It's hardly possible to make a matplotlib version < 2.0 produce the exact output you'd get with matplotlib >= 2.0, although you might copy the style sheet from a newer version to the old one and set the parameters accordingly.
The inverse is however possible. To get the old (classic) style in a new version of matplotlib should be possible via
import matplotlib.pyplot as plt
plt.style.use("classic")
answered Nov 16 '18 at 13:19


ImportanceOfBeingErnestImportanceOfBeingErnest
141k13166243
141k13166243
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
add a comment |
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
Works perfectly, thanks!
– Sito
Nov 16 '18 at 13:28
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%2f53338458%2fplot-style-of-matplotlib%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
5 b,b,n2B1pc qnl5aj iG2 iF3d8vj8hlUHQDnDemyrA7B
It's to do with the backend that is used - it's different by default for Windows and Unix. matplotlib.org/faq/usage_faq.html#what-is-a-backend You can set it like this:
backend : WXAgg
– Ben Jones
Nov 16 '18 at 13:05
1
You have two different versions of matplotlib installed on both systems. Check the version via
print(matplotlib.__version__)
. Obviously you can install the same version on all your computers and get the same output. I don't know which of the two plots you call "Ubuntu style", which would be important to know for alternative solutions.– ImportanceOfBeingErnest
Nov 16 '18 at 13:08
It has nothing to do with the backend though, as claimed by the other comment.
– ImportanceOfBeingErnest
Nov 16 '18 at 13:09
@ImportanceOfBeingErnest Thanks for the info, I edited the question. Would still be nice to know how I could change it to the other version withou having to install different versions.
– Sito
Nov 16 '18 at 13:11
Ah yes you're right @ImportanceOfBeingErnest
– Ben Jones
Nov 16 '18 at 13:27