matplotlib scatter plots are un-filled/incorrect color (Custom stylesheet)

Viewed 35

I am trying to make a custom stylesheet(Nice.mplstyle I modeled it after 'classic.mplstyle') for "publication quality plots", however when using my sheet with scatter plots it seems like it always colors the center of the scatter markers the incorrect color (blue). I would prefer solid color for my markers following the color cycler. As an aside, matplotlib also doesn't seem to recognise my custom color cycler either. Here is the code I use to test my plots:

import numpy as np
import scipy
import random

def fun(x, a, b, c):
    return a * np.sin(b*(x + c))

depth = 500

X = np.linspace(0, 20, depth)
X3 = 0.5*(X+6)
Y = 15 * np.sin(X3)
nY = np.empty(depth)
rand0_1 = np.empty(depth)

for y in Y:
    
    i, = np.where(Y == y)
    rand1_2 = np.random.random() * 7
    rand0_1[i] = (-1) ** random.randrange(1, 3)
    nY[i] = Y[i] +(rand0_1[i] * rand1_2)
    

fitp, fitcov = scipy.optimize.curve_fit(fun, X, nY, p0=[13, 0.3, 9])


plt.style.use('Nice.mplstyle')
# plt.style.use('dark_background')
plt.scatter([X]*2, [nY, fun(X, *fitp)])
# plt.plot(X, fun(X, *fitp))
plt.xlim(0, max(X))
plt.ylim(min(nY)-5, max(nY)+5)```


0 Answers
Related