Skip to content

Commit

Permalink
add taylor test
Browse files Browse the repository at this point in the history
  • Loading branch information
jukent committed May 1, 2024
1 parent 862f525 commit ac13d72
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/test_taylor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import pytest
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

import geocat.viz as gv

@pytest.mark.mpl_image_compare
def test_plot():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')

taylor.add_corr_grid(np.array([0.6, 0.9]))

taylor.add_model_set([1.230, 0.988, 1.092],
[0.958, 0.973, 0.740],
percent_bias_on=True, # indicate marker and size to be plotted based on bias_array
bias_array=[2.7, -1.5, 17.31], # specify bias array
color='red',
label='Model A',
fontsize=16)

taylor.add_model_set([1.129, 0.996, 1.016],
[0.963, 0.975, 0.801],
percent_bias_on=True,
bias_array=[1.7, 2.5, -17.31],
color='blue',
label='Model B',
fontsize=16)

taylor.add_model_name(['a', 'b', 'c'], fontsize=16)

taylor.add_legend(fontsize=16)

taylor.add_bias_legend()

taylor.add_contours(levels=np.arange(0, 1.1, 0.25),
colors='lightgrey',
linewidths=0.5);
return fig

0 comments on commit ac13d72

Please sign in to comment.