Reputation: 11
How can I get rid of the last two lines (horizontal, vertical) in the chart. I tried all kind off different methods as below, but those two keep there. Can anyone point me in the direction where my code is flawed.
The ca.plot coordinates is a method called by Prince for plotting the results of a CA as matplotlib.
ax = ca.plot_coordinates(
X=X,
ax=None,
marker = "o",
color='k',
figsize=(32, 18),
x_component=0,
y_component=1,show_row_labels=False,show_col_labels=False,
)
ax.set_axis_off()
ax.get_figure().gca().set_title("")
ax.grid(False)
ax.get_legend().remove()
ax.axes.get_xaxis().set_visible(False)
ax.axes.get_yaxis().set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['bottom'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.set_xticks([])
ax.set_yticks([])
ax.get_figure ()
Upvotes: 1
Views: 92
Reputation: 40667
I don't know this library, but my quick analysis of the code shows that these lines are hard-coded:
ca.plot_coordinates()
calls plot.stylize_axis()
, which in turns draws these two lines whether you want them or not (L21–22):
ax.axhline(y=0, linestyle='-', linewidth=1.2, color=GRAY['dark'], alpha=0.6)
ax.axvline(x=0, linestyle='-', linewidth=1.2, color=GRAY['dark'], alpha=0.6)
Thankfully, the artists thus created should be stored in ax.lines
, so you should be able to remove the first two lines there:
del ax.lines[:2]
Upvotes: 1