Skip to content
Snippets Groups Projects
Select Git revision
  • Product/1555-readOnlyResources
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2583-treeBug
  • Hotfix/2504-formGen
  • Issue/2309-docs
  • Issue/2462-removeTraces
  • Hotfix/2459-EncodingPath
  • Hotfix/2452-linkedDeletion
  • Issue/1792-newMetadataStructure
  • Hotfix/2384-guestsAndLinked
  • v2.8.14-Hotfix2365
  • Hotfix/2365-targetClassWorks
  • Hotfix/2371-fixGitLabinRCV
  • Fix/xxxx-activateGitlab
  • Test/xxxx-enablingGitLab
  • Issue/2349-gitlabHttps
  • Issue/2287-guestRole
  • Hotfix/2296-selectedValuesNotReturned
  • Issue/2102-gitLabResTypeRCV
  • v2.11.5
  • v2.11.4
  • v2.11.3
  • v2.11.2
  • v2.11.1
  • v2.11.0
  • v2.10.3
  • v2.10.2
  • v2.10.1
  • v2.10.0
  • v2.9.4
  • v2.9.3
  • v2.9.2
  • v2.9.1
  • v2.9.0
  • v2.8.16
  • v2.8.15
  • v2.8.14
  • v2.8.13
  • v2.8.12
41 results

nunit3-junit.xslt

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test.py 2.83 KiB
    import numpy as np
    import matplotlib.pyplot as plt
    from plotid.tagplot import tagplot
    from plot_serializer.serializer import Serializer
    from plot_serializer.deserializer import Deserializer
    
    np.random.seed(19680801)
    
    X = np.linspace(0.5, 3.5, 100)
    Y1 = 3 + np.cos(X)
    Y2 = 1 + np.cos(1 + X / 0.75) / 2
    Y3 = np.random.uniform(Y1, Y2, len(X))
    
    # fig1 = plt.figure(figsize=(7.5, 7.5))
    # ax = fig1.add_axes([0.2, 0.17, 0.68, 0.7], aspect=1)
    # ax2 = fig1.add_axes([0.3, 0.2, 0.8, 0.9], aspect=2)
    # fig,axs = plt.subplots(2,1)
    
    
    
    # ax.set_xlim(0, 4)
    # ax.set_ylim(0, 4)
    
    # ax.tick_params(which="major", width=1.0, length=10, labelsize=14)
    # ax.tick_params(which="minor", width=1.0, length=5, labelsize=10, labelcolor="0.25")
    
    # ax.grid(linestyle="--", linewidth=0.5, color=".25", zorder=-10)
    
    # axs[0].plot(X, Y1, c="C0", lw=2.5, label="Blue signal", zorder=10)
    # axs[0].plot(X, Y2, c="C1", lw=2.5, label="Orange signal")
    # # ax.scatter(X[::3], Y3[::3], label="scatter")
    
    # ax.set_title("Example figure", fontsize=20, verticalalignment="bottom")
    # ax.set_xlabel("TIME in s", fontsize=14)
    # ax.set_ylabel("DISTANCE in m", fontsize=14)
    # ax.legend(loc="upper right", fontsize=14)
    
    # fig2 = plt.subplots(figsize=(7.5, 7.5))
    # ax2 = fig2.add_axes([0.2, 0.17, 0.68, 0.7], aspect=1)
    
    # axs[1].plot(X, Y1 * 2, c="C0", lw=2.5, label="Blue signal", zorder=10)
    # axs[1].plot(X, Y2 * 2, c="C1", lw=2.5, label="Orange signal")
    
    # plotids = tagplot(
    #     [fig1, fig2], "matplotlib", prefix="id:", id_method="random", location="southeast"
    # )
    
    fig,axs = plt.subplots(2,1)
    axs[0].plot(X, Y1, c="C0", lw=2.5, label="Blue signal", zorder=10)
    axs[0].plot(X, Y2, c="C1", lw=2.5, label="Orange signal")
    axs[1].plot(X, Y1 * 2, c="C3", lw=2.5, label="Blue signal", zorder=10)
    axs[1].plot(X, Y2 * 2, c="C4", lw=2.5, label="Orange signal")
    
    
    # fig = plt.figure()
    # ax1 = fig.add_axes([0.1, 0.8, 0.8, 0.4])
    # ax2 = fig.add_axes([0.1, 0.2, 0.8, 0.4])
    
    # ax1.plot(X, Y1, c="C0", lw=2.5, label="Blue signal", zorder=10)
    # ax1.plot(X, Y2, c="C1", lw=2.5, label="Orange signal")
    # ax2.plot(X, Y1, c="C3", lw=2.5, label="Blue signal", zorder=10)
    # ax2.plot(X, Y2, c="C4", lw=2.5, label="Orange signal")
    
    s = Serializer(fig)
    # s.plot.id = plotids.figure_ids[0]
    # s.plot.axes[0].xunit = "second"
    # s.plot.axes[0].yunit = "meter"
    s.add_custom_metadata({"date_created": "22.08.2023"}, s.plot)
    s.add_plot_metadata("1","title1","test")
    s.add_axis_metadata(0,"title0","xlabel","ylabel")
    s.add_axis_metadata(1,"title1","xlabel","ylabel")
    json_object_1 = s.to_json()
    
    # s2 = Serializer(fig2)
    # # s2.add_id(plotids.figure_ids[1])
    # s2.add_custom_metadata({"date_created": "11.08.2023"},s2.plot)
    
    # json_object_2 = s2.to_json()
    
    with open("test_plot.json", "w") as outfile:
        outfile.write(json_object_1)
        # outfile.write(json_object_2)
    
    ds = Deserializer()
    fig = ds.json_to_matplotlib("test_plot.json")
    
    fig.show()
    
    plt.show()
    
    
    
    
    pass