1

I am trying to rotate the starting figure 45 degrees instead of a square I have a diamond-shaped fig, I used this code

# import the packages
import matplotlib.pyplot as plt
from matplotlib.transforms import Affine2D
import mpl_toolkits.axisartist.floating_axes as floating_axes

# set the figure size
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True

# plot the figure
fig = plt.figure()

scales = (0, 5, 0, 5)

# Add 2D affine transformation
t = Affine2D().rotate_deg(25)

# Add floating axes
h = floating_axes.GridHelperCurveLinear(t, scales)
ax = floating_axes.FloatingSubplot(fig, 111, grid_helper=h)

fig.add_subplot(ax)

plt.show()

and I got back a this diamond-shaped plot but the classic functions now don't work on the new shape (tick_params and ax.spines don't work) plus when I draw on some scatterpoints they are not plotted correctly.

My question is how do I rotate the plot 45 degrees to get a diamond-shaped fig that has the functions working, and then how do I rotate my datapoints to fit the new shape ? thanks

hrokr
  • 3,276
  • 3
  • 21
  • 39
  • In sort, it's going to take a fair amount of work. [This should get you started](https://stackoverflow.com/questions/62357483/how-to-rotate-a-subplot-by-45-degree-in-matplotlib) – hrokr Apr 22 '23 at 23:44

0 Answers0