Skip to content

Adding twin axes into polar coordinate system #12506

@519165198

Description

@519165198

Bug report

Adding twin x Axes into polar coordinate system seems does not work
Bug summary

Code for reproduction

import numpy as np
from matplotlib.ticker import FormatStrFormatter
import matplotlib.pyplot as plt


labels = np.array(['E', '', 'N', '', 'W', '', 'S', ''])
dataLength = 8
data = np.array([3.23, 3.23, 9.68, 3.23, 12.90, 32.26, 6.45, 29.03])
angles = np.linspace(0, 2*np.pi, dataLength, endpoint=False)

width = np.pi/8*np.array([1]*8)

ax = plt.subplot(111, projection='polar')
ax2 = ax.twinx()

bars = ax.bar(angles, data, alpha=0.4, label=labels, width=width, bottom=0.0, color="red")

data = np.array([10.3, 2.23, 15.68, 13.23, 12.90, 12.26, 8.45, 29.03])
data = np.concatenate((data, [data[0]]))
angles = np.concatenate((angles, [angles[0]]))

plots = ax.plot(angles, data, alpha=0.7, linestyle="--", linewidth=1, color="blue")
plt.fill(angles, data, facecolor='blue', alpha=0.25)

gridLines, gridLabel = ax.set_thetagrids(angles * 180/np.pi, labels, fontproperties="DejaVu Sans")

ax.yaxis.set_major_formatter(FormatStrFormatter('%d%%'))

plt.yticks(fontsize=8)
plt.xticks(fontsize=15)

[label.set_fontweight('bold') for label in ax.get_xticklabels()]
[label.set_color('blue') for label in ax.get_yticklabels()]

plt.show()

Actual outcome


Expected outcome

Matplotlib version

  • Operating system:
  • Matplotlib version:
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Labels

    New featurestatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: polar

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy