diff --git a/plots/README.md b/plots/README.md index b805512..388bb8d 100644 --- a/plots/README.md +++ b/plots/README.md @@ -3,3 +3,7 @@ ## discrete_colour_ramp.py ![discrete colour ramp](png/discrete-colour-ramp.png) + +## discrete_colour_ramp_edges.py + +![discrete colour ramp edges](png/discrete-colour-ramp-edges.png) diff --git a/plots/discrete_colour_ramp.py b/plots/discrete_colour_ramp.py index 2e5ab88..1fc7714 100644 --- a/plots/discrete_colour_ramp.py +++ b/plots/discrete_colour_ramp.py @@ -15,7 +15,7 @@ c_min = -8 c_step = 2 # Create colour map -cmap = plt.cm.get_cmap('Blues', (c_max - c_min + c_step) / c_step) +cmap = plt.cm.get_cmap('YlOrRd', (c_max - c_min + c_step) / c_step) fig, ax = plt.subplots(1, 1, figsize=(6, 4)) diff --git a/plots/discrete_colour_ramp_edges.py b/plots/discrete_colour_ramp_edges.py new file mode 100644 index 0000000..0c7ffef --- /dev/null +++ b/plots/discrete_colour_ramp_edges.py @@ -0,0 +1,39 @@ +import os +import numpy as np +import matplotlib.pyplot as plt + +# Generate dummy data +delta = 0.01 +x = np.arange(-3.0, 3.0, delta) +y = np.arange(-3.0, 3.0, delta) +X, Y = np.meshgrid(x, y) +Z = X * Y + +# Set range and steps for colour bar +c_max = 5 +c_min = -5 +c_step = 1 + +# Create colour map +cmap = plt.cm.get_cmap('YlOrRd', (c_max - c_min) / c_step) + +fig, ax = plt.subplots(1, 1, figsize=(6, 4)) + +# Plot image +im = ax.imshow(Z, + cmap=cmap, + interpolation='bilinear', + vmax=c_max, + vmin=c_min) + +# Add colour bar +plt.colorbar(im, ticks=np.arange(c_min, c_max + 1, c_step)) + +# Hide spines and ticks +ax.set_axis_off() + +# Export figure +png_name = os.path.join( + 'png', + os.path.basename(__file__).replace('.py', '.png').replace('_', '-')) +plt.savefig(png_name, bbox_inches='tight', dpi=100) diff --git a/plots/png/discrete-colour-ramp-edges.png b/plots/png/discrete-colour-ramp-edges.png new file mode 100644 index 0000000..81b210a Binary files /dev/null and b/plots/png/discrete-colour-ramp-edges.png differ diff --git a/plots/png/discrete-colour-ramp.png b/plots/png/discrete-colour-ramp.png index 726fdd3..341efb3 100644 Binary files a/plots/png/discrete-colour-ramp.png and b/plots/png/discrete-colour-ramp.png differ