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;








1















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:



enter image description here



Am I missing something?










share|improve this question






















  • 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

















1















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:



enter image description here



Am I missing something?










share|improve this question






















  • 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













1












1








1








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:



enter image description here



Am I missing something?










share|improve this question














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:



enter image description here



Am I missing something?







python matplotlib latex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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












1 Answer
1






active

oldest

votes


















1














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()





share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









1














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()





share|improve this answer























  • 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















1














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()





share|improve this answer























  • 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













1












1








1







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()





share|improve this answer













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()






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현