How to change the color of the axis, ticks and labels

As a quick example (using a slightly cleaner method than the potentially duplicate question): import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot(range(10)) ax.set_xlabel(‘X-axis’) ax.set_ylabel(‘Y-axis’) ax.spines[‘bottom’].set_color(‘red’) ax.spines[‘top’].set_color(‘red’) ax.xaxis.label.set_color(‘red’) ax.tick_params(axis=”x”, colors=”red”) plt.show() Alternatively [t.set_color(‘red’) for t in ax.xaxis.get_ticklines()] [t.set_color(‘red’) for t in ax.xaxis.get_ticklabels()]

2D grid data visualization in Python

Matplotlib has the imshow method for plotting arrays: import matplotlib as mpl from matplotlib import pyplot import numpy as np # make values from -5 to 5, for this example zvals = np.random.rand(100,100)*10-5 # make a color map of fixed colors cmap = mpl.colors.ListedColormap([‘blue’,’black’,’red’]) bounds=[-6,-2,2,6] norm = mpl.colors.BoundaryNorm(bounds, cmap.N) # tell imshow about color map … Read more

PHP allocate color without image resource

16711680 (decimal) is 0x00FF0000 (hexadecimal) 00 – Alpha value (0 dec) FF – Red (255 dec) 00 – Green (0 dec) 00 – Blue (0 dec) See http://www.php.net/manual/en/function.imagecolorallocatealpha.php to set the alpha byte Edit: Also, to answer your first question — yes, you can create a color without an image resource (and, consequently without a … Read more

Java Smooth Color Transition

You’re using the wrong sign in the calcuations. Should be plus, not minus, to apply the ratio properly. int red = (int)Math.abs((ratio * FAR.getRed()) + ((1 – ratio) * CLOSE.getRed())); int green = (int)Math.abs((ratio * FAR.getGreen()) + ((1 – ratio) * CLOSE.getGreen())); int blue = (int)Math.abs((ratio * FAR.getBlue()) + ((1 – ratio) * CLOSE.getBlue())); The … Read more