<jupyter_start><jupyter_text>Table of Contents[Preparation](preparation)[User data vectors](userdatavectors)[Graphs](graphs)  Preparation<jupyter_code>%run "../Functions/4. User comparison.ipynb"<jupyter_output><empty_output><jupyter_text>Data vectors of users<jupyter_code># small sample
#allData = getAllUserVectorData( getAllUsers()[:10] )

# complete set
#allData = getAllUserVectorData( getAllUsers() )

# subjects which answered the gform
#allData = getAllUserVectorData( getAllResponders()[:10] )
allData = getAllUserVectorData( getAllResponders() )
allData<jupyter_output><empty_output><jupyter_text>Graphs<jupyter_code>columnAllData = allData.T
columnAllData['scorebefore'][:5]
plt.plot(columnAllData['craft'], columnAllData['equip'], 'ro')
plt.xlabel('craft')
plt.ylabel('equip')
plt.plot(columnAllData['sessionsCount'], columnAllData['craft'], 'ro')
plt.xlabel('sessionsCount')
plt.ylabel('craft')
columnAllData.columns
for column in columnAllData.columns:
    print(column)
columnAllData.columns[1]
len(columnAllData.columns)
for i in range(1,len(columnAllData.columns)):
    for j in range(i+1,len(columnAllData.columns)):
        print(i,j)
        print(columnAllData.columns[i], columnAllData.columns[j])
def plotFromAllUsersData(allUsersData, xcolumnname, ycolumnname):
    plt.title("plotting '" + ycolumnname + "' against '" + xcolumnname + "'")
    plt.plot(
                allUsersData[xcolumnname],
                allUsersData[ycolumnname],
                'ro'
            )
    plt.xlabel(xcolumnname)
    plt.ylabel(ycolumnname)
    #plt.show()
plotFromAllUsersData(
                        columnAllData,
                        columnAllData.columns[1],
                        columnAllData.columns[2]
                    )<jupyter_output><empty_output><jupyter_text>Subplot tests<jupyter_code>plt.figure(1)

#plt.subplot(131)
plt.subplot(311)
plotFromAllUsersData(
                        columnAllData,
                        columnAllData.columns[2],
                        columnAllData.columns[3]
                    )

plt.grid(True)

#plt.subplot(132)
plt.subplot(321)
plotFromAllUsersData(
                        columnAllData,
                        columnAllData.columns[2],
                        columnAllData.columns[4]
                    )
plt.grid(True)

#plt.subplot(133)
plt.subplot(331)
plotFromAllUsersData(
                        columnAllData,
                        columnAllData.columns[2],
                        columnAllData.columns[5]
                    )
plt.grid(True)

plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,
                    wspace=0.35)

plt.show()
fig = plt.figure()

ax1 = fig.add_subplot(221)
ax1.plot([1,2,3,4,5], [10,5,10,5,10], 'r-')

ax2 = fig.add_subplot(222)
ax2.plot([1,2,3,4], [1,4,9,16], 'k-')

ax3 = fig.add_subplot(223)
ax3.plot([1,2,3,4], [1,10,100,1000], 'b-')

ax4 = fig.add_subplot(224)
ax4.plot([1,2,3,4], [0,0,1,1], 'g-')


plt.tight_layout()
fig = plt.gcf()
fig = plt.figure(figsize=(16,4))


ax1 = fig.add_subplot(131)
ax1.plot([1,2,3,4,5], [10,5,10,5,10], 'r-')


ax2 = fig.add_subplot(132)
ax2.plot([1,2,3,4], [1,4,9,16], 'k-')


ax3 = fig.add_subplot(133)
ax3.plot([1,2,3,4], [1,10,100,1000], 'b-')


plt.tight_layout()

fig = plt.gcf()
def subplotFromAllUsersData(ax, allUsersData, xcolumnname, ycolumnname):
    plt.title("'" + str(ycolumnname) + "' against '" + str(xcolumnname) + "'")
    ax.plot(
                allUsersData[xcolumnname],
                allUsersData[ycolumnname],
                'ro'
            )
    plt.xlabel(xcolumnname)
    plt.ylabel(ycolumnname)
    #plt.show()
fig = plt.figure(figsize=(16,4))


ax1 = fig.add_subplot(131)
subplotFromAllUsersData(
                        ax1,
                        columnAllData,
                        columnAllData.columns[2],
                        columnAllData.columns[3]
                    )


ax2 = fig.add_subplot(132)
subplotFromAllUsersData(
                        ax2,
                        columnAllData,
                        columnAllData.columns[2],
                        columnAllData.columns[4]
                    )


ax3 = fig.add_subplot(133)
subplotFromAllUsersData(
                        ax3,
                        columnAllData,
                        columnAllData.columns[2],
                        columnAllData.columns[5]
                    )


plt.tight_layout()

fig = plt.gcf()
for i in range(0,6):
    position = 131 + (i % 3)

    if i % 3 == 0:
        fig = plt.figure(figsize=(16,4))

    ax1 = fig.add_subplot(position)
    subplotFromAllUsersData(
                            ax1,
                            columnAllData,
                            columnAllData.columns[2],
                            columnAllData.columns[3+i]
                        )<jupyter_output><empty_output><jupyter_text>Automation tests<jupyter_code>len(columnAllData.columns)
graphsCount = len(columnAllData.columns) * (len(columnAllData.columns) - 1) / 2
graphsCount<jupyter_output><empty_output><jupyter_text>TODO FIXME  1 column of graphs graphsProgressBar = FloatProgress(min=0, max=graphsCount)display(graphsProgressBar)graphsProgressBar.value = 0for i in range(0,len(columnAllData.columns)):    xcolumnname = columnAllData.columns[i]    for j in range(i+1,len(columnAllData.columns)):        ycolumnname = columnAllData.columns[j]        plotFromAllUsersData(columnAllData, xcolumnname, ycolumnname)        graphsProgressBar.value += 1print("done in " + str(graphsProgressBar.value) + " steps.")  3 columns of graphs<jupyter_code>graphsProgressBar = FloatProgress(min=0, max=graphsCount)
display(graphsProgressBar)
graphsProgressBar.value = 0
for i in range(0,len(columnAllData.columns)):
    xcolumnname = columnAllData.columns[i]
    for j in range(i+1,len(columnAllData.columns)):
        ycolumnname = columnAllData.columns[j]
        
        # actual plotting
        position = 131 + (graphsProgressBar.value % 3)

        if graphsProgressBar.value % 3 == 0:
            fig = plt.figure(figsize=(16,4))

        ax = fig.add_subplot(position)
        subplotFromAllUsersData(
                                ax,
                                columnAllData,
                                xcolumnname,
                                ycolumnname
                            )
        
        graphsProgressBar.value += 1
print("done in " + str(graphsProgressBar.value) + " steps.")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1254054054054054, 'fraction_numerical': 0.03613899613899614, 'mean_word_length': 2.3852587558808156, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '491152', 'license': 'CC0-1.0', 'n_tokens_mistral': 2266, 'n_tokens_neox': 2087, 'n_words': 304, 'path': 'v1.52/Tests/4.2 User comparison tests graphs.ipynb', 'repo_name': 'CyberCRI/herocoli-metrics-redwire', 'size': '6475'}