Title: Inconsistent behavior of backends when rendering latex colors · Issue #6724 · matplotlib/matplotlib · GitHub
Open Graph Title: Inconsistent behavior of backends when rendering latex colors · Issue #6724 · matplotlib/matplotlib
X Title: Inconsistent behavior of backends when rendering latex colors · Issue #6724 · matplotlib/matplotlib
Description: MPL 1.5.1 on Python 3.5 (Anaconda) running on Red Hat 6.5. This issue is a followup to the discussion on matplotlib-users Creating Colored Axis Labels using LaTeX in Interactive Mode, which in turn is a followup to Stack Overflow Inconsi...
Open Graph Description: MPL 1.5.1 on Python 3.5 (Anaconda) running on Red Hat 6.5. This issue is a followup to the discussion on matplotlib-users Creating Colored Axis Labels using LaTeX in Interactive Mode, which in turn...
X Description: MPL 1.5.1 on Python 3.5 (Anaconda) running on Red Hat 6.5. This issue is a followup to the discussion on matplotlib-users Creating Colored Axis Labels using LaTeX in Interactive Mode, which in turn...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/6724
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent behavior of backends when rendering latex colors","articleBody":"MPL 1.5.1 on Python 3.5 (Anaconda) running on Red Hat 6.5.\n\nThis issue is a followup to the discussion on matplotlib-users [Creating Colored Axis Labels using LaTeX in Interactive Mode](https://mail.python.org/pipermail/matplotlib-users/2016-July/000557.html), which in turn is a followup to Stack Overflow [Inconsistent rendering of hdashrule in matplotlib axis labels](http://stackoverflow.com/questions/38274681/inconsistent-rendering-of-hdashrule-in-matplotlib-axis-labels).\n\nIn my attempts to get latex colors to show up correctly in axis labels using interactive backends with LaTeX enabled, I came across http://matplotlib.org/users/pgf.html. I expected to be able to do the following:\n\n```\nimport matplotlib as mpl\nfrom matplotlib.backends.backend_pgf import FigureCanvasPgf\nmatplotlib.backend_bases.register_backend('png', FigureCanvasPgf)\nfrom matplotlib import pyplot as plt\n\nmatplotlib.rc('pgf', texsystem='pdflatex') # from running latex -v\npreamble = matplotlib.rcParams.setdefault('pgf.preamble', [])\npreamble.append(r'\\usepackage{color}')\npreamble.append(r'\\usepackage{dashrule}')\n\nax = plt.plot((0, 1), (1, 2))[0].axes\nax.set_ylabel(r'Y $\\;$ \\textcolor[rgb]{1.0, 0.0, 0.0}{\\hdashrule[0.5ex]{3cm}{1pt}{1pt 0pt}}')\nax.set_xlabel(r'N $\\;$ \\textcolor[rgb]{0.0, 1.0, 0.0}{\\rule[0.5ex]{3cm}{1pt}}')\nplt.savefig('test.png')\n```\n\nWith the default backend, this does not work at all, and the labels are rendered as raw strings containing TeX commands. With `mpl.use('pgf')`, the lines in the labels are rendered black instead of the intended color. Please see the SO question and mailing list discussion for more info.\n","author":{"url":"https://github.com/madphysicist","@type":"Person","name":"madphysicist"},"datePublished":"2016-07-11T19:43:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/6724/matplotlib/issues/6724"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:494f0624-71e5-358d-36f2-84679610d873 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EEE:3E37F3:16D4019:1E28EDC:6A51C049 |
| html-safe-nonce | 4b8eab07d8cdf043a119505ae1aae37c7e7d6f3116ae19aabd641c947f24e8ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUVFOjNFMzdGMzoxNkQ0MDE5OjFFMjhFREM6NkE1MUMwNDkiLCJ2aXNpdG9yX2lkIjoiODg5MDM3NTMzNDMyNDcxNTU5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 45d019e59bf243d746ee3ecda4227ee56949e833fb9d3125c312cb2042898774 |
| hovercard-subject-tag | issue:164917803 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/6724/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35db39873ec403cad4b6576b350b1ba88870fa6d3d709c094f4d11d82d9e5bb3/matplotlib/matplotlib/issues/6724 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35db39873ec403cad4b6576b350b1ba88870fa6d3d709c094f4d11d82d9e5bb3/matplotlib/matplotlib/issues/6724 |
| og:image:alt | MPL 1.5.1 on Python 3.5 (Anaconda) running on Red Hat 6.5. This issue is a followup to the discussion on matplotlib-users Creating Colored Axis Labels using LaTeX in Interactive Mode, which in turn... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | madphysicist |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width