-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set different axis scales in the radar chart #65
Comments
Hi @jingyao16, The question is too brief and I am not sure if I understand exactly what is being asked. Code Example from pycirclize import Circos
import pandas as pd
import matplotlib.pyplot as plt
# Create RPG jobs parameter dataframe (4 jobs, 8 parameters)
df = pd.DataFrame(
data=[
[80, 80, 80, 80, 80, 80, 80, 80],
[90, 20, 95, 95, 30, 30, 80, 70],
[60, 90, 20, 20, 100, 90, 50, 70],
[70, 50, 60, 40, 60, 40, 100, 60],
],
index=["Hero", "Warrior", "Wizard", "Assassin"],
columns=["HP", "MP", "ATK", "DEF", "SP.ATK", "SP.DEF", "SPD", "LUK"],
)
print(df)
# Create 2 x 2 subplots
fig = plt.figure(figsize=(16, 16), dpi=100)
fig.subplots(2, 2, subplot_kw=dict(polar=True))
fig.subplots_adjust(wspace=0.15, hspace=0.15)
# Plot radar chart into subplots for each target
for target_name, ax in zip(df.index, fig.axes):
target_df = df.loc[[target_name]]
# Initialize Circos instance for radar chart plot
circos = Circos.radar_chart(
target_df,
vmax=100,
marker_size=6,
cmap=dict(Hero="salmon", Warrior="skyblue", Wizard="lime", Assassin="magenta"),
grid_interval_ratio=0.2,
line_kws_handler=lambda _: dict(lw=2, ls="solid"),
marker_kws_handler=lambda _: dict(marker="D", ec="grey", lw=0.5),
)
# Plot figure & set legend on upper right
circos.plotfig(ax=ax)
circos.ax.legend(loc="upper right", fontsize=10)
fig.savefig("example.png") example.png FYI: https://moshi4.github.io/pyCirclize/plot_tips/#subplots |
Thanks for your prompt reply. However, I supply my question, how to set axes with different scales in one plot? For example, I want some axes to be linear but with different intervals like [0,20,40] and [1,5,7], and some axes to be logarithmic ones like [1, 10, 100]. |
There is no function in pyCirclize to set different axis scales to radar charts. |
Maybe my previous answer was an incorrect understanding of the question. I interpreted your question as 2. and gave an answer, but would 1. be the correct interpretation?
The vmax and grid_interval_ratio arguments of the Circos.radar_chart() method can be used to change the scale for the entire axis. I plan to allow the vmin argument to be set as well in the next release. It may be a bit difficult to implement to support logarithms. e.g. |
Thanks for your reply. Yes, my question is actually to change the scale for multiple axes in one radar chart. Get it. No worry, I can handle it by manually post-precessing. |
hi,
thanks for your wonderful contribution.
Q: Can I use different axes in the radar chart?
The text was updated successfully, but these errors were encountered: