Title: [Bug]: Changing color using ax.tick_params · Issue #24227 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Changing color using ax.tick_params · Issue #24227 · matplotlib/matplotlib
X Title: [Bug]: Changing color using ax.tick_params · Issue #24227 · matplotlib/matplotlib
Description: Bug summary When trying to change the color of the x and y axis I am using ax.tick_param. If I use label color 'r' or labelcolor='#00000077', but if I write label color='grey' or a hex value: #bdbdbd then the background changes too. Is t...
Open Graph Description: Bug summary When trying to change the color of the x and y axis I am using ax.tick_param. If I use label color 'r' or labelcolor='#00000077', but if I write label color='grey' or a hex value: #bdbd...
X Description: Bug summary When trying to change the color of the x and y axis I am using ax.tick_param. If I use label color 'r' or labelcolor='#00000077', but if I write label color='grey...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24227
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Changing color using ax.tick_params","articleBody":"### Bug summary\r\n\r\nWhen trying to change the color of the x and y axis I am using `ax.tick_param`.\r\nIf I use label color `'r'` or `labelcolor='#00000077'`, but if I write label `color='grey'` or a hex value: `#bdbdbd` then the background changes too. Is that expected?\r\n\r\nThis works:\r\n```\r\nax.tick_params(labelsize=22, labelcolor='#00000077', top = False, left=False)\r\n```\r\n\r\nThis doesnt:\r\n```\r\nax.tick_params(labelsize=22, labelcolor='#BDBDBD', top = False, left=False)\r\n```\r\n\r\n\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nurl='https://raw.githubusercontent.com/Curbal-Data-Labs/Matplotlib-Labs/master/2018w48.csv'\r\ndataset = pd.read_csv(url)\r\n\r\ndataset.drop_duplicates(['city','item'], inplace=True)\r\ndataset.pivot_table(index='city', columns='item', values='cost', aggfunc='sum', margins = True).sort_values('All', ascending=True).drop('All', axis=1)\r\n\r\ndf = dataset.pivot_table(index='city', columns='item', values='cost', aggfunc='sum', margins = True).sort_values('All', ascending=True).drop('All', axis=1).sort_values('All', ascending=False, axis=1).drop('All').reset_index()\r\n\r\n# comma replace\r\nfor c in df.columns[1:]:\r\n df[c] = df[c].str.replace(',','.').astype(float)\r\n\r\nfig, axes = plt.subplots(nrows=1, ncols=5, figsize=(30,10), sharey=True)\r\n\r\ncolors = ['green','blue','red','black','brown'] \r\ncol_names = ['Dinner','Drinks at Dinner','2 Longdrinks','Club entry','Cinema entry']\r\n\r\nfor i, (ax,col,c) in enumerate(zip(axes.ravel(), col_names, colors)):\r\n ax.plot(df.loc[:,col], df['city'], marker='o', markersize=25, lw=0, color=c)\r\n ax.set_title(col)\r\n for i,j in zip(df[col], df['city']):\r\n ax.annotate('$'+str(i), xy=(i, j), xytext=(i-4,j), color=\"white\", fontsize=8)\r\n ax.set_xticks([])\r\n ax.spines[['top', 'right', 'left', 'bottom']].set_visible(False)\r\n ax.grid(True, axis='y', linestyle='solid', linewidth=2)\r\n ax.grid(True, axis='x', linestyle='solid', linewidth=0.2)\r\n ax.xaxis.tick_top() \r\n ax.xaxis.set_label_position('top')\r\n ax.set_xlim(xmin=0, xmax=160)\r\n ax.xaxis.set_major_formatter('${x:1.0f}')\r\n ax.tick_params(labelsize=8, labelcolor = #bdbdbd, top=False, left=False)\r\n\r\nplt.show()\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n\r\n\r\n### Expected outcome\r\n\r\n\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Operating system\r\n\r\nWin11\r\n\r\n### Matplotlib Version\r\n\r\n3.5.1\r\n\r\n### Matplotlib Backend\r\n\r\n_No response_\r\n\r\n### Python version\r\n\r\n3.10\r\n\r\n### Jupyter version\r\n\r\n3.3.2\r\n\r\n### Installation\r\n\r\nconda","author":{"url":"https://github.com/ruthpozuelo","@type":"Person","name":"ruthpozuelo"},"datePublished":"2022-10-20T12:58:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/24227/matplotlib/issues/24227"}
| 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:a8ba2eac-fa30-ee38-dfe2-18446fcce116 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82E6:365801:15EF0E:201D9A:6A560284 |
| html-safe-nonce | ef8f6fe55376c4c62af857fd3739fed0741e9873e32ed27e8d8fb4d5914df345 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkU2OjM2NTgwMToxNUVGMEU6MjAxRDlBOjZBNTYwMjg0IiwidmlzaXRvcl9pZCI6IjQzMDgzNzQ4NjcxMjcxNzM3NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0a7b70ab14b22535ca8ae52aaf91649f3539554b250bc9d787de7dc88ff5183e |
| hovercard-subject-tag | issue:1416579408 |
| 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/24227/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04fb41e2257a0b864333644bedcc56e50ec56acd74af75f312b9ee65220edda9/matplotlib/matplotlib/issues/24227 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04fb41e2257a0b864333644bedcc56e50ec56acd74af75f312b9ee65220edda9/matplotlib/matplotlib/issues/24227 |
| og:image:alt | Bug summary When trying to change the color of the x and y axis I am using ax.tick_param. If I use label color 'r' or labelcolor='#00000077', but if I write label color='grey' or a hex value: #bdbd... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ruthpozuelo |
| hostname | github.com |
| expected-hostname | github.com |
| None | f4368738fc918fecd9b3958f6b49218bbe60d4185f38e72e3954e11f1ad0213a |
| 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 | ed27e29ef37c0e8f612ea3fed8118b955b8314e2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width