Latex colors not rendered in matplotlib textPartial coloring of text in matplotlibHow to print colored text in terminal in Python?How do you change the size of figures drawn with matplotlib?How to wrap text in LaTeX tables?Inserting code in this LaTeX document with indentationMatplotlib latex working directory / search pathSave plot to image file instead of displaying it using MatplotlibHow to make IPython notebook matplotlib plot inlineInstallation Issue with matplotlib PythonUsing matplotlib *without* TCLMatplotlib Latex does not show custom box around word
How can I get people to remember my character's gender?
Make me a minimum magic sum
about academic proof-reading, what to do in this situation?
Is disk brake effectiveness mitigated by tyres losing traction under strong braking?
Why does sound not move through a wall?
How to preserve a rare version of a book?
Is the book wrong about the Nyquist Sampling Criterion?
How do I, as a DM, handle a party that decides to set up an ambush in a dungeon?
Why did WWI include Japan?
In "Avengers: Endgame", what does this name refer to?
What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?
Who filmed the Apollo 11 trans-lunar injection?
Where to draw the line between quantum mechanics theory and its interpretation(s)?
no sense/need/point
Dangerous workplace travelling
Would a small hole in a Faraday cage drastically reduce its effectiveness at blocking interference?
How to remap repeating commands i.e. <number><command>?
Madam I m Adam..please don’t get mad..you will no longer be prime
All of my Firefox add-ons been disabled suddenly, how can I re-enable them?
As a GM, is it bad form to ask for a moment to think when improvising?
Why would one crossvalidate the random state number?
Which "exotic salt" can lower water's freezing point by -70°C?
The origin of list data structure
Sci-fi/fantasy book - ships on steel runners skating across ice sheets
Latex colors not rendered in matplotlib text
Partial coloring of text in matplotlibHow to print colored text in terminal in Python?How do you change the size of figures drawn with matplotlib?How to wrap text in LaTeX tables?Inserting code in this LaTeX document with indentationMatplotlib latex working directory / search pathSave plot to image file instead of displaying it using MatplotlibHow to make IPython notebook matplotlib plot inlineInstallation Issue with matplotlib PythonUsing matplotlib *without* TCLMatplotlib Latex does not show custom box around word
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Tex's textcolor
seems to be ignored in my plottling script
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc(
'text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r'textcolorredaaaaaaa')
plt.show()
does not give me a red text, it produces:
Am I missing something?
python matplotlib latex
add a comment |
Tex's textcolor
seems to be ignored in my plottling script
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc(
'text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r'textcolorredaaaaaaa')
plt.show()
does not give me a red text, it produces:
Am I missing something?
python matplotlib latex
Check this
– Sheldore
Mar 23 at 10:49
In principle, matplotlib cannot colorize parts of a text differently; a workaround is shown in this example.
– ImportanceOfBeingErnest
Mar 23 at 10:54
add a comment |
Tex's textcolor
seems to be ignored in my plottling script
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc(
'text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r'textcolorredaaaaaaa')
plt.show()
does not give me a red text, it produces:
Am I missing something?
python matplotlib latex
Tex's textcolor
seems to be ignored in my plottling script
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc(
'text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r'textcolorredaaaaaaa')
plt.show()
does not give me a red text, it produces:
Am I missing something?
python matplotlib latex
python matplotlib latex
asked Mar 23 at 3:09
P. CamilleriP. Camilleri
6,61942249
6,61942249
Check this
– Sheldore
Mar 23 at 10:49
In principle, matplotlib cannot colorize parts of a text differently; a workaround is shown in this example.
– ImportanceOfBeingErnest
Mar 23 at 10:54
add a comment |
Check this
– Sheldore
Mar 23 at 10:49
In principle, matplotlib cannot colorize parts of a text differently; a workaround is shown in this example.
– ImportanceOfBeingErnest
Mar 23 at 10:54
Check this
– Sheldore
Mar 23 at 10:49
Check this
– Sheldore
Mar 23 at 10:49
In principle, matplotlib cannot colorize parts of a text differently; a workaround is shown in this example.
– ImportanceOfBeingErnest
Mar 23 at 10:54
In principle, matplotlib cannot colorize parts of a text differently; a workaround is shown in this example.
– ImportanceOfBeingErnest
Mar 23 at 10:54
add a comment |
1 Answer
1
active
oldest
votes
It's explained in more detail here : https://matplotlib.org/users/usetex.html but seems like it only works when you export it to a ps file. For me, it works in color if you're saving it as a ps file while the same file inline doesn't work.
Slight workaround here.
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc('text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r"aaaaaaa", color='r')
#plt.savefig(r"foo.ps")
# you can include the above line if you're using your old code.
plt.show()
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
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%2f55310241%2flatex-colors-not-rendered-in-matplotlib-text%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
It's explained in more detail here : https://matplotlib.org/users/usetex.html but seems like it only works when you export it to a ps file. For me, it works in color if you're saving it as a ps file while the same file inline doesn't work.
Slight workaround here.
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc('text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r"aaaaaaa", color='r')
#plt.savefig(r"foo.ps")
# you can include the above line if you're using your old code.
plt.show()
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
add a comment |
It's explained in more detail here : https://matplotlib.org/users/usetex.html but seems like it only works when you export it to a ps file. For me, it works in color if you're saving it as a ps file while the same file inline doesn't work.
Slight workaround here.
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc('text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r"aaaaaaa", color='r')
#plt.savefig(r"foo.ps")
# you can include the above line if you're using your old code.
plt.show()
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
add a comment |
It's explained in more detail here : https://matplotlib.org/users/usetex.html but seems like it only works when you export it to a ps file. For me, it works in color if you're saving it as a ps file while the same file inline doesn't work.
Slight workaround here.
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc('text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r"aaaaaaa", color='r')
#plt.savefig(r"foo.ps")
# you can include the above line if you're using your old code.
plt.show()
It's explained in more detail here : https://matplotlib.org/users/usetex.html but seems like it only works when you export it to a ps file. For me, it works in color if you're saving it as a ps file while the same file inline doesn't work.
Slight workaround here.
import matplotlib as matplotlib
from matplotlib import pyplot as plt
matplotlib.rcParams.update('text.usetex': True)
matplotlib.rc('text.latex', preamble=r"usepackagexcolor")
fig, ax = plt.subplots()
ax.set_ylabel(r"aaaaaaa", color='r')
#plt.savefig(r"foo.ps")
# you can include the above line if you're using your old code.
plt.show()
answered Mar 23 at 3:47
rpm787rpm787
514
514
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
add a comment |
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
I'm trying to make it work in a more complicated code, involving an Animation that I save as gif. So saving to ps is not really I option unfortunately, I think.
– P. Camilleri
Mar 23 at 4:13
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
Yeah, that was the problem a lot of people had. Is it possible to use the method above to do it(which doesn't involve saving to ps i.e. using color='r') , or does the code involved something else ?
– rpm787
Mar 23 at 4:16
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
I am using this to color only a portion of the text so I don't think I can
– P. Camilleri
Mar 23 at 6:20
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%2f55310241%2flatex-colors-not-rendered-in-matplotlib-text%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
Check this
– Sheldore
Mar 23 at 10:49
In principle, matplotlib cannot colorize parts of a text differently; a workaround is shown in this example.
– ImportanceOfBeingErnest
Mar 23 at 10:54